Permalink
Browse files

Fix a bug creating users / groups in the correct order during install…

…ation
  • Loading branch information...
1 parent b6a6398 commit 713c4640c59a79584513ac505f46fc4bc9969c2c @kmoore134 kmoore134 committed Mar 4, 2014
Showing with 31 additions and 16 deletions.
  1. +31 −16 src-sh/pbi-manager/pbi-manager
@@ -3219,8 +3219,9 @@ do_pbi_add() {
mk_pbi_extract_dir
pbi_extract_archive
- pbi_add_check_uids
pbi_add_check_gids
+ pbi_add_check_uids
+ pbi_add_check_gids_users
pbi_add_run_script
check_postinstall_script
@@ -3238,7 +3239,7 @@ do_pbi_add() {
}
# Check for any GIDs we need to create
-pbi_add_check_gids() {
+pbi_add_check_gids_users() {
if [ ! -e "${PBI_PROGDIRPATH}/${PBI_INS_GROUPSFILE}" ] ; then return ; fi
runUID=`id -u`
@@ -3248,20 +3249,6 @@ pbi_add_check_gids() {
gID=`echo $gidLine | cut -d ':' -f 3`
gUsers=`echo $gidLine | cut -d ':' -f 4`
- # Is this group already on the system?
- pw groupshow $gName >/dev/null 2>/dev/null
- if [ $? -eq 0 ] ; then
- echo "Using existing group: $gName"
- else
- # Are we installing as root?
- if [ "$runUID" != "0" ] ; then
- echo "Please create group \"$gName\" manually or re-install PBI as root."
- else
- echo "Adding group: $gName"
- pw groupadd $gName -g $gID;
- fi
- fi
-
if [ -n "$gUsers" ] ; then
for gUser in `echo $gUsers | sed 's|,| |g'`
do
@@ -3281,6 +3268,34 @@ pbi_add_check_gids() {
done < ${PBI_PROGDIRPATH}/${PBI_INS_GROUPSFILE}
}
+
+# Check for any GIDs we need to create
+pbi_add_check_gids() {
+ if [ ! -e "${PBI_PROGDIRPATH}/${PBI_INS_GROUPSFILE}" ] ; then return ; fi
+ runUID=`id -u`
+
+ while read gidLine
+ do
+ gName=`echo $gidLine | cut -d ':' -f 1`
+ gID=`echo $gidLine | cut -d ':' -f 3`
+ gUsers=`echo $gidLine | cut -d ':' -f 4`
+
+ # Is this group already on the system?
+ pw groupshow $gName >/dev/null 2>/dev/null
+ if [ $? -eq 0 ] ; then
+ echo "Using existing group: $gName"
+ else
+ # Are we installing as root?
+ if [ "$runUID" != "0" ] ; then
+ echo "Please create group \"$gName\" manually or re-install PBI as root."
+ else
+ echo "Adding group: $gName"
+ pw groupadd $gName -g $gID;
+ fi
+ fi
+ done < ${PBI_PROGDIRPATH}/${PBI_INS_GROUPSFILE}
+}
+
# Check for any UIDs we need to create
pbi_add_check_uids() {
if [ ! -e "${PBI_PROGDIRPATH}/${PBI_INS_USERSFILE}" ] ; then return ; fi

0 comments on commit 713c464

Please sign in to comment.