#!/usr/bin/sh
#----------------------------------------------------------------------------
# /tmp/preinstall.sh - shadow-pw-mgmt preinstallation
#
# Creation   :  2026-05-27 holbru
# Last update:  $Id$
#
# Copyright (c) 2026-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# set package name
package_name=shadow-pw-mgmt

# ---------------------------------------------------------------------------
# update  
# --------------------------------------------------------------------------- 
installed=$(eisman check shadow 3.6.4)
if [ "${installed}" = "new" ]
then
    if [ -f /etc/filelist.d/shadow-files.txt ]
    then
        /usr/bin/sed -i '/pam.d\/chfn/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/pam.d\/chsh/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/pam.d\/passwd/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/chage/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/chfn/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/chsh/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/expiry/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/newgidmap/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/newuidmap/d' /etc/filelist.d/shadow-files.txt
        /usr/bin/sed -i '/bin\/passwd/d' /etc/filelist.d/shadow-files.txt
    fi
fi

exit 0
# ---------------------------------------------------------------------------
# end
# ---------------------------------------------------------------------------
