summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan <caleb@alerque.com>2014-03-15 16:16:08 (GMT)
committer Caleb Maclennan <caleb@alerque.com>2014-03-15 16:16:08 (GMT)
commitd79ed707f47039cbd633917499c140c91da0de47 (patch)
tree2837361b68553d7dbd4d765179fa24e341846e73
parent26dfd85ca5ff5cc79744494e1fa8727cedb3102c (diff)
change non-function returns to exit for posix shell compliancerefs/pull/2/head
-rwxr-xr-xbin/gitzone-install14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/gitzone-install b/bin/gitzone-install
index 854d145..3c2704f 100755
--- a/bin/gitzone-install
+++ b/bin/gitzone-install
@@ -24,19 +24,19 @@
if [ -z $1 ]; then
echo "usage: gitzone-install username [ id_rsa.pub ]";
- return 0; fi
+ exit 0; fi
uid="`id -u`"
if ! [ "$uid" = "0" ]; then
echo "this script needs to be run as root."
- return 1; fi
+ exit 1; fi
user="$1"
# check user argument
grep "^$user" /etc/passwd > /dev/null
-if ! [ $? = 0 ]; then echo "error: user not found: $user"; return 1; fi
-if ! [ -r /home/$user ]; then echo "error: user home not found: /home/$user"; return 1; fi
+if ! [ $? = 0 ]; then echo "error: user not found: $user"; exit 1; fi
+if ! [ -r /home/$user ]; then echo "error: user home not found: /home/$user"; exit 1; fi
if [ -r /home/$user/zones/$user/.git ]; then
echo "error: gitzone already installed for user $user";
else # create gitzone directory in user home
@@ -98,12 +98,12 @@ EOF
key="$2" # add ssh key
-if [ -z "$key" ]; then return 0; fi
-if ! [ -r $key ]; then echo "warning: key not found $key"; return 1; fi
+if [ -z "$key" ]; then exit 0; fi
+if ! [ -r $key ]; then echo "warning: key not found $key"; exit 1; fi
mkdir -p /home/$user/.ssh
touch /home/$user/.ssh/authorized_keys
cat $key >> /home/$user/.ssh/authorized_keys
chmod -R go-rwx /home/$user/.ssh
chown -R $user:$user /home/$user/.ssh
echo "ssh public key $key added for $user"
-return 0
+exit 0