shadow: only run {pw,grp}conv at postinst.

This commit is contained in:
Juan RP 2012-10-05 15:25:51 +02:00
parent b1c614f257
commit 9de4768191
2 changed files with 4 additions and 54 deletions

View File

@ -1,59 +1,9 @@
# #
# This script creates default /etc/passwd and /etc/group # This script enables shadow password and groups.
# files if they are unexistent.
#
# Also shadow passwords are enabled.
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:
wheel:x:4:
tty:x:5:
tape:x:6:
daemon:x:7:
floppy:x:8:
disk:x:9:
lp:x:10:
dialout:x:11:
audio:x:12:
video:x:13:
utmp:x:14:
usb:x:15:
cdrom:x:16:
optical:x:17:
mail:x:18:
storage:x:19:
scanner:x:20:
plugdev:x:21:
nogroup:x:99:
users:x:100:
_EOF
echo "Created default /etc/group file."
}
case "${ACTION}" in case "${ACTION}" in
post) post)
echo "Running ${PKGNAME}-${VERSION} post installation hooks..." if [ "$(id -u)" -eq 0 ]; then
[ ! -f ./etc/passwd ] && create_passwd
[ ! -f ./etc/group ] && create_group
if [ ! -f ./etc/shadow ]; then
echo "Enabling shadowed (group) passwords..."
pwconv && grpconv pwconv && grpconv
fi fi
;; ;;

View File

@ -1,7 +1,7 @@
# Template file for 'shadow' # Template file for 'shadow'
pkgname=shadow pkgname=shadow
version=4.1.5.1 version=4.1.5.1
revision=8 revision=9
build_style=gnu-configure build_style=gnu-configure
configure_args="--bindir=/usr/bin --sbindir=/usr/sbin configure_args="--bindir=/usr/bin --sbindir=/usr/sbin
--libdir=/usr/lib --enable-shared --disable-static --libdir=/usr/lib --enable-shared --disable-static
@ -63,7 +63,7 @@ post_install() {
sed -i -e 's/^\(GROUP\)=\(.*\)$/\1=100/' ${DESTDIR}/etc/default/useradd sed -i -e 's/^\(GROUP\)=\(.*\)$/\1=100/' ${DESTDIR}/etc/default/useradd
# Install the cron daily job. # Install the cron daily job.
install -D -m744 ${FILESDIR}/shadow.cron-daily \ install -Dm744 ${FILESDIR}/shadow.cron-daily \
${DESTDIR}/etc/cron.daily/shadow ${DESTDIR}/etc/cron.daily/shadow
# Remove groups.1 manpages that comes with coreutils. # Remove groups.1 manpages that comes with coreutils.