(minor) gl-setup fixes

- stop erroring out if run from elsewhere than $HOME (by localising
    the "cd" we need somewhere in between)
  - catch the admin@home.pub usage early
  - minor fix to the backticked commands
  - gl-setup now does 'chmod go-rwx .ssh'
This commit is contained in:
Sitaram Chamarty 2010-07-25 09:01:04 +05:30
parent 4fa5442daa
commit e115129776

View file

@ -28,6 +28,7 @@ then
echo $pubkey_file | grep '.pub$' >/dev/null || die "$pubkey_file must end in .pub" echo $pubkey_file | grep '.pub$' >/dev/null || die "$pubkey_file must end in .pub"
[ -f $pubkey_file ] || die "cant find $pubkey_file" [ -f $pubkey_file ] || die "cant find $pubkey_file"
admin_name=` basename $pubkey_file .pub` admin_name=` basename $pubkey_file .pub`
echo $admin_name | grep '@' >/dev/null && die "please don't use '@' in the initial admin name"
fi fi
if [ -f $HOME/.gitolite.rc ] if [ -f $HOME/.gitolite.rc ]
@ -54,17 +55,20 @@ fi
# setup ssh stuff. We break our normal rule that we will not fiddle with # setup ssh stuff. We break our normal rule that we will not fiddle with
# authkeys etc., because in this case it seems appropriate # authkeys etc., because in this case it seems appropriate
cd (
cd $HOME
mkdir -p .ssh mkdir -p .ssh
chmod go-rwx .ssh
touch .ssh/authorized_keys touch .ssh/authorized_keys
chmod go-w . .ssh .ssh/authorized_keys chmod go-w . .ssh .ssh/authorized_keys
)
# now we get to gitolite itself # now we get to gitolite itself
gl-install -q gl-install -q
GL_ADMINDIR=` cd;perl -e 'do ".gitolite.rc"; print $GL_ADMINDIR'` GL_ADMINDIR=` cd $HOME;perl -e 'do ".gitolite.rc"; print $GL_ADMINDIR'`
REPO_BASE=` cd;perl -e 'do ".gitolite.rc"; print $REPO_BASE' ` REPO_BASE=` cd $HOME;perl -e 'do ".gitolite.rc"; print $REPO_BASE' `
[ -f $GL_ADMINDIR/conf/gitolite.conf ] || { [ -f $GL_ADMINDIR/conf/gitolite.conf ] || {
cat <<EOF > $GL_ADMINDIR/conf/gitolite.conf cat <<EOF > $GL_ADMINDIR/conf/gitolite.conf