2009-01-27 18:28:31 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
|
|
|
|
|
|
|
# $1 = chrootdir
|
|
|
|
# $2 = action
|
|
|
|
# $3 = pkgname
|
|
|
|
# $4 = version
|
|
|
|
|
|
|
|
create_passwd()
|
|
|
|
{
|
|
|
|
cat > ./etc/passwd <<_EOF
|
|
|
|
root:x:0:0:root:/root:/bin/bash
|
|
|
|
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
|
|
|
|
_EOF
|
|
|
|
echo "Created default /etc/passwd file."
|
|
|
|
}
|
|
|
|
|
|
|
|
create_group()
|
|
|
|
{
|
|
|
|
# Default group list as specified by LFS.
|
|
|
|
cat > ./etc/group <<_EOF
|
|
|
|
root:x:0:
|
|
|
|
bin:x:1:
|
|
|
|
sys:x:2:
|
|
|
|
kmem:x:3:
|
|
|
|
tty:x:4:
|
|
|
|
tape:x:5:
|
|
|
|
daemon:x:6:
|
|
|
|
floppy:x:7:
|
|
|
|
disk:x:8:
|
|
|
|
lp:x:9:
|
|
|
|
uucp:x:10:
|
|
|
|
audio:x:11:
|
|
|
|
video:x:12:
|
|
|
|
utmp:x:13:
|
|
|
|
usb:x:14:
|
|
|
|
cdrom:x:15:
|
|
|
|
mail:x:34:
|
|
|
|
nogroup:x:99:
|
|
|
|
users:x:1000:
|
|
|
|
_EOF
|
|
|
|
echo "Created default /etc/group file."
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$2" in
|
2009-02-03 16:32:51 +00:00
|
|
|
pre)
|
2009-01-27 18:28:31 +00:00
|
|
|
;;
|
2009-02-03 16:32:51 +00:00
|
|
|
post)
|
2009-02-17 18:41:42 +00:00
|
|
|
echo "Running $3-$4 post installation hook..."
|
2009-01-27 18:28:31 +00:00
|
|
|
if [ "$1" = "NOTSET" ]; then
|
|
|
|
run_cmd="pwconv"
|
|
|
|
else
|
|
|
|
run_cmd="chroot $1 pwconv"
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ ! -f ./etc/passwd ] && create_passwd
|
|
|
|
[ ! -f ./etc/group ] && create_group
|
|
|
|
|
|
|
|
if [ ! -f ./etc/shadow ]; then
|
|
|
|
echo "Enabling shadow passwords..."
|
2009-02-03 16:32:51 +00:00
|
|
|
${run_cmd}
|
2009-01-27 18:28:31 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|