Modify the INSTALL/REMOVE scripts to use predef vars and unneeded chroot calls.

--HG--
extra : convert_revision : dfd737c502bea327054ecff5bc1fa152db6e2009
This commit is contained in:
Juan RP 2009-04-08 03:24:57 +02:00
parent 201be83c73
commit acd07f61e3
8 changed files with 44 additions and 44 deletions

View file

@ -2,35 +2,35 @@
# This script fixes permissions for some files and dirs,
# and creates the policykit system user/group.
#
case "$2" in
case "${ACTION}" in
pre)
;;
post)
echo "Running $3-$4 post installation hooks..."
if ! chroot . getent group policykit >/dev/null; then
chroot . groupadd -r policykit
echo "Running ${PKGNAME}-${VERSION} post installation hooks..."
if ! getent group policykit >/dev/null; then
groupadd -r policykit 2>&1 >/dev/null
[ $? -ne 0 ] && exit $?
echo "Created policykit system group."
fi
if ! chroot . getent passwd policykit >/dev/null; then
chroot . useradd -c "PolicyKit user" \
if ! getent passwd policykit >/dev/null; then
useradd -c "PolicyKit user" \
-d / -s /sbin/nologin -g policykit -r policykit && \
chroot . passwd -l policykit &>/dev/null
passwd -l policykit 2>&1 >/dev/null
[ $? -ne 0 ] && exit $?
echo "Created policykit system user."
fi
chroot . chgrp policykit var/run/PolicyKit
chroot . chgrp policykit var/lib/PolicyKit
chroot . chown policykit var/lib/PolicyKit-public
chroot . chown policykit:policykit var/lib/misc/PolicyKit.reload
chroot . chown policykit usr/libexec/polkit-set-default-helper
chroot . chmod u+s usr/libexec/polkit-set-default-helper
chgrp policykit var/run/PolicyKit
chgrp policykit var/lib/PolicyKit
chown policykit var/lib/PolicyKit-public
chown policykit:policykit var/lib/misc/PolicyKit.reload
chown policykit usr/libexec/polkit-set-default-helper
chmod u+s usr/libexec/polkit-set-default-helper
for i in polkit-read-auth-helper polkit-revoke-helper \
polkit-grant-helper polkit-explicit-grant-helper; do
chroot . chgrp policykit usr/libexec/$i
chroot . chmod g+s usr/libexec/$i
chgrp policykit usr/libexec/$i
chmod g+s usr/libexec/$i
done
chroot . chgrp policykit usr/libexec/polkit-grant-helper-pam
chroot . chmod u+s usr/libexec/polkit-grant-helper-pam
chgrp policykit usr/libexec/polkit-grant-helper-pam
chmod u+s usr/libexec/polkit-grant-helper-pam
;;
esac

View file

@ -1,10 +1,10 @@
#
# This script removes the policykit user/group.
#
case "$2" in
case "${ACTION}" in
pre)
chroot . userdel policykit &>/dev/null
[ $? -eq 0 ] && echo "Removed policykit system user/group."
userdel policykit 2>&1 >/dev/null
[ $? -eq 0 ] && echo "Removed ${PKGNAME} system user/group."
;;
post)
;;