Skip to content

Commit

Permalink
Enforce checking of unix user and group creation.
Browse files Browse the repository at this point in the history
When Group was not created, SETUP_UPDATE_PERMISSIONS failed.
thx Thibaud Raso for report
  • Loading branch information
Tauop committed Jan 4, 2012
1 parent c541a19 commit 4885a3b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions build-utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,28 @@ DOTHIS 'Installing sshGate'
MK "$( eval "echo \"\${${dir}}\"" )"
done

# Create sshGate unix account
grep "^${SSHGATE_GATE_ACCOUNT}:" /etc/passwd >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
useradd "${SSHGATE_GATE_ACCOUNT}"
groupadd "${SSHGATE_GATE_ACCOUNT}"
home_dir=$( cat /etc/passwd | grep "^${SSHGATE_GATE_ACCOUNT}:" | cut -d':' -f6 )
useradd "${SSHGATE_GATE_ACCOUNT}" 2>/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Can't create ${SSHGATE_GATE_ACCOUNT} unix account"
exit 1;
fi
fi

MK "${home_dir}/.ssh/"
# Create sshGate unix group
grep "^${SSHGATE_GATE_ACCOUNT}:" /etc/group >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
groupadd "${SSHGATE_GATE_ACCOUNT}" 2>/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Can't create ${SSHGATE_GATE_ACCOUNT} unix account"
exit 1;
fi
fi

home_dir=$( cat /etc/passwd | grep "^${SSHGATE_GATE_ACCOUNT}:" | cut -d':' -f6 )
MK "${home_dir}/.ssh/"
fi

# install stuff
Expand Down

0 comments on commit 4885a3b

Please sign in to comment.