From acd07f61e3d8c7f7688e0fb0b915672c92d9f109 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 8 Apr 2009 03:24:57 +0200 Subject: [PATCH] Modify the INSTALL/REMOVE scripts to use predef vars and unneeded chroot calls. --HG-- extra : convert_revision : dfd737c502bea327054ecff5bc1fa152db6e2009 --- templates/PolicyKit/INSTALL | 34 +++++++++++++++++----------------- templates/PolicyKit/REMOVE | 6 +++--- templates/dbus/INSTALL | 18 +++++++++--------- templates/dbus/REMOVE | 6 +++--- templates/fontconfig/INSTALL | 2 +- templates/hal/INSTALL | 14 +++++++------- templates/hal/REMOVE | 6 +++--- templates/texinfo/INSTALL | 2 +- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/templates/PolicyKit/INSTALL b/templates/PolicyKit/INSTALL index 284a622165..4f0c44d9a5 100644 --- a/templates/PolicyKit/INSTALL +++ b/templates/PolicyKit/INSTALL @@ -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 diff --git a/templates/PolicyKit/REMOVE b/templates/PolicyKit/REMOVE index b61b623274..31743c86e6 100644 --- a/templates/PolicyKit/REMOVE +++ b/templates/PolicyKit/REMOVE @@ -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) ;; diff --git a/templates/dbus/INSTALL b/templates/dbus/INSTALL index 19d01438d1..bbe1cc7f8b 100644 --- a/templates/dbus/INSTALL +++ b/templates/dbus/INSTALL @@ -4,25 +4,25 @@ # dbus_launch="./usr/libexec/dbus-daemon-launch-helper" -case "$2" in +case "${ACTION}" in pre) ;; post) - echo "Running $3-$4 post installation hooks..." - if ! chroot . getent group dbus >/dev/null; then - chroot . groupadd -r dbus + echo "Running ${PKGNAME}-${VERSION} post installation hooks..." + if ! getent group dbus >/dev/null; then + groupadd -r dbus 2>&1 >/dev/null [ $? -ne 0 ] && exit $? echo "Created dbus system group." fi - if ! chroot . getent passwd dbus >/dev/null; then - chroot . useradd -c "System message bus" \ + if ! getent passwd dbus >/dev/null; then + useradd -c "System message bus" \ -d /var/run/dbus \ -s /sbin/nologin -g dbus -r dbus && \ - chroot . passwd -l dbus &>/dev/null + passwd -l dbus 2>&1 >/dev/null [ $? -ne 0 ] && exit $? echo "Created dbus system user." fi - chroot . chown root:dbus ${dbus_launch} - chroot . chmod 4750 ${dbus_launch} + chown root:dbus ${dbus_launch} + chmod 4750 ${dbus_launch} ;; esac diff --git a/templates/dbus/REMOVE b/templates/dbus/REMOVE index 357867a83a..0ec060b8fa 100644 --- a/templates/dbus/REMOVE +++ b/templates/dbus/REMOVE @@ -1,10 +1,10 @@ # # This script removes the dbus user/group. # -case "$2" in +case "${ACTION}" in pre) - chroot . userdel dbus &>/dev/null - [ $? -eq 0 ] && echo "Removed dbus system user/group." + userdel dbus 2>&1 >/dev/null + [ $? -eq 0 ] && echo "Removed ${PKGNAME} system user/group." ;; post) ;; diff --git a/templates/fontconfig/INSTALL b/templates/fontconfig/INSTALL index 84355520aa..1daa9b2a8f 100644 --- a/templates/fontconfig/INSTALL +++ b/templates/fontconfig/INSTALL @@ -1,7 +1,7 @@ # # This script builds fontconfig's fonts cache. # -case "$2" in +case "${ACTION}" in pre) ;; post) diff --git a/templates/hal/INSTALL b/templates/hal/INSTALL index 7ff1692f6c..38f8400ee6 100644 --- a/templates/hal/INSTALL +++ b/templates/hal/INSTALL @@ -2,21 +2,21 @@ # This script creates the HAL system user/group. # -case "$2" in +case "${ACTION}" in pre) ;; post) - echo "Running $3-$4 post installation hooks..." - if ! chroot . getent group hal >/dev/null; then - chroot . groupadd -r hal + echo "Running ${PKGNAME}-${VERSION} post installation hooks..." + if ! getent group hal >/dev/null; then + groupadd -r hal 2>&1 >/dev/null [ $? -ne 0 ] && exit $? echo "Created HAL system group." fi - if ! chroot . getent passwd hal >/dev/null; then - chroot . useradd -c "HAL daemon" \ + if ! getent passwd hal >/dev/null; then + useradd -c "HAL daemon" \ -d / -s /sbin/nologin -g hal \ -G optical,floppy,storage -r hal && \ - chroot . passwd -l hal &>/dev/null + passwd -l hal 2>&1 >/dev/null [ $? -ne 0 ] && exit $? echo "Created HAL system user." fi diff --git a/templates/hal/REMOVE b/templates/hal/REMOVE index 07b52173b1..166b89e602 100644 --- a/templates/hal/REMOVE +++ b/templates/hal/REMOVE @@ -1,10 +1,10 @@ # # This script removes the HAL user/group. # -case "$2" in +case "${ACTION}" in pre) - chroot . userdel hal &>/dev/null - [ $? -eq 0 ] && echo "Removed HAL system user/group." + userdel hal &>/dev/null + [ $? -eq 0 ] && echo "Removed ${PKGNAME} system user/group." ;; post) ;; diff --git a/templates/texinfo/INSTALL b/templates/texinfo/INSTALL index d0f755f2ab..2ba5fb58f8 100644 --- a/templates/texinfo/INSTALL +++ b/templates/texinfo/INSTALL @@ -4,7 +4,7 @@ texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz texinfo-1.gz texinfo-2.gz texinfo-3.gz" -case "$2" in +case "${ACTION}" in pre) ;; post)