From 1cfc05cef3ac0089428a8e5a4944af86c254d868 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 6 Apr 2013 14:54:21 +0200 Subject: [PATCH] xbps-triggers: system-accounts: fail gracefully if required utils are not available. --- srcpkgs/xbps-triggers/files/system-accounts | 20 ++++++++++++++++++-- srcpkgs/xbps-triggers/template | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/srcpkgs/xbps-triggers/files/system-accounts b/srcpkgs/xbps-triggers/files/system-accounts index b0a640c1a86..cbcb140af9b 100755 --- a/srcpkgs/xbps-triggers/files/system-accounts +++ b/srcpkgs/xbps-triggers/files/system-accounts @@ -38,9 +38,9 @@ group_add() { $GROUPADD -r ${_grname} >/dev/null 2>&1 fi if [ $? -eq 0 ]; then - echo "Created ${grp} ($use_gid) system group." + echo "Created ${_grname} ($use_gid) system group." else - echo "Failed to create ${grp} ($use_gid) system group!" + echo "Failed to create ${_grname} ($use_gid) system group!" exit 1 fi fi @@ -74,11 +74,19 @@ run) post-install) # System groups required by a package. for grp in ${system_groups}; do + if [ ! -x "$GROUPADD" ]; then + echo "WARNING: cannot create ${grp} system group (missing groupadd)" + continue + fi group_add $grp done # System user/group required by a package. for acct in ${system_accounts}; do + if [ ! -x "$USERADD" ]; then + echo "WARNING: cannot create ${acct} system user/group (missing useradd)" + continue + fi eval homedir="\$${acct}_homedir" eval shell="\$${acct}_shell" eval descr="\$${acct}_descr" @@ -110,12 +118,20 @@ run) # if [ "$UPDATE" = "no" ]; then for acct in ${system_accounts}; do + if [ ! -x "$USERDEL" ]; then + echo "WARNING: cannot remove ${acct} system user/group (missing userdel)" + continue + fi $USERDEL ${acct} >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "Removed ${acct} system user/group." fi done for grp in ${system_groups}; do + if [ ! -x "$GROUPDEL" ]; then + echo "WARNING: cannot remove ${acct} system group (missing groupdel)" + continue + fi $GROUPDEL ${grp} >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "Removed ${grp} system group." diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template index b91092f75cc..09a1c1f9cc5 100644 --- a/srcpkgs/xbps-triggers/template +++ b/srcpkgs/xbps-triggers/template @@ -1,6 +1,6 @@ # Template file for 'xbps-triggers' pkgname=xbps-triggers -version=0.65 +version=0.66 revision=1 short_desc="The XBPS triggers for Void Linux" maintainer="Juan RP "