54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
case $1 in
|
|
preinst)
|
|
exit 0
|
|
;;
|
|
postinst)
|
|
if [[ ${TARGET} ]]; then
|
|
if [ ! -f ${TARGET}/etc/shadow ]; then
|
|
echo "Converting /etc/passwd to shadow for ${TARGET}"
|
|
chroot ${TARGET} pwconv
|
|
fi
|
|
|
|
if [ ! -f ${TARGET}/etc/gshadow ]; then
|
|
echo "Converting /etc/group to gshadow for ${TARGET}"
|
|
chroot ${TARGET} grpconv
|
|
fi
|
|
else
|
|
if [ ! -f /etc/shadow ]; then
|
|
echo "Converting /etc/passwd to shadow"
|
|
pwconv
|
|
fi
|
|
|
|
if [ ! -f /etc/gshadow ]; then
|
|
echo "Converting /etc/group to gshadow"
|
|
grpconv
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f ${TARGET}/etc/login.defs ]; then
|
|
cp ${TARGET}/usr/share/shadow/login.defs ${TARGET}/etc/default/login.defs
|
|
fi
|
|
if [ ! -f ${TARGET}/etc/login.access ]; then
|
|
cp ${TARGET}/usr/share/shadow/login.access \
|
|
${TARGET}/etc/default/login.access
|
|
fi
|
|
if [ ! -f ${TARGET}/etc/limits ]; then
|
|
cp ${TARGET}/usr/share/shadow/limits ${TARGET}/etc/limits
|
|
fi
|
|
if [ ! -f ${TARGET}/etc/default/useradd ]; then
|
|
cp ${TARGET}/usr/share/shadow/useradd.default \
|
|
${TARGET}/etc/default/useradd
|
|
fi
|
|
;;
|
|
prerm)
|
|
exit 0
|
|
;;
|
|
postrm)
|
|
exit 0
|
|
;;
|
|
esac
|