remove a few needless bashisms...

Note: "able" still needs bash but it's an easy fix if you need to use it
on a bash-challenged machine and care enough
This commit is contained in:
Sitaram Chamarty 2010-06-01 16:27:33 +05:30
parent faf1629fd8
commit 805050a129
7 changed files with 18 additions and 18 deletions

View file

@ -1,17 +1,17 @@
#!/bin/bash
# WARNING: USES BASH FEATURES...
# WARNING: USES BASH FEATURES TO AVOID A TEMP FILE; CAN BE FIXED IF NEEDED
. $(dirname $0)/adc.common-functions
get_rights_and_owner gitolite-admin
[[ -z $perm_write ]] && die "just *what* are you trying to pull, young man?"
[ -z "$perm_write" ] && die "just *what* are you trying to pull, young man?"
op=$1
shift
locs=
while [[ -n $1 ]]
while [ -n "$1" ]
do
case $1 in
'@all' )
@ -33,7 +33,7 @@ case $op in
done
;;
dis|disable )
[[ -t 0 ]] && printf message:
# bashism
read msg <<<$(cat)
for l in $locs
do

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# please make sure this file is NOT chmod +x
@ -11,7 +11,7 @@ get_rights_and_owner() {
# set shell variables as needed
owner=${ans#* }
rights=${ans% *}
[[ $rights =~ C ]] && perm_create=yes || perm_create=
[[ $rights =~ R ]] && perm_read=yes || perm_read=
[[ $rights =~ W ]] && perm_write=yes || perm_write=
echo $rights | grep C >/dev/null 2>&1 && perm_create=yes || perm_create=
echo $rights | grep R >/dev/null 2>&1 && perm_read=yes || perm_read=
echo $rights | grep W >/dev/null 2>&1 && perm_write=yes || perm_write=
}

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
from=$1
to=$2
@ -10,10 +10,10 @@ to=$2
# have a new "git-init" command!
get_rights_and_owner $from
[[ -z $perm_read ]] && die "no read permissions on $from"
[ -z "$perm_read" ] && die "no read permissions on $from"
get_rights_and_owner $to
[[ -z $perm_create ]] && die "no create permissions on $to"
[ -z "$perm_create" ] && die "no create permissions on $to"
# let gitolite create the repo first
SSH_ORIGINAL_COMMAND="git-init '$to'" $GL_BINDIR/gl-auth-command $GL_USER

View file

@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh
. $(dirname $0)/adc.common-functions
get_rights_and_owner gitolite-admin
[[ -z $perm_write ]] && die "just *what* are you trying to pull, young man?"
[ -z "$perm_write" ] && die "just *what* are you trying to pull, young man?"
# and here you let them do the dangerous stuff
echo "+rm -rf $GL_REPO_BASE_ABS"

View file

@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/sh
. $(dirname $0)/adc.common-functions
delete=$1
get_rights_and_owner $delete
[[ $owner == $GL_USER ]] || die "$delete is not yours to delete!"
[ "$owner" = "$GL_USER" ] || die "$delete is not yours to delete!"
cd $GL_REPO_BASE_ABS
rm -rf $delete.git

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# what/why: re-establish gitolite admin access when admin key(s) lost
# where: on server (NOT client!)
@ -20,7 +20,7 @@
# ENDHELP
[[ -z $1 ]] && { perl -pe "s(\\\$0)($0); last if /ENDHELP/" < $0; exit 1; }
[ -z "$1" ] && { perl -pe "s(\\\$0)($0); last if /ENDHELP/" < $0; exit 1; }
set -e

View file

@ -39,7 +39,7 @@ if git rev-parse --is-inside-work-tree >/dev/null 2>&1
then
git describe --tags --long HEAD 2>/dev/null > conf/VERSION || die "git describe failed -- this should not happen!"
else
[[ -f conf/VERSION ]] || echo '(unknown)' > conf/VERSION
[ -f conf/VERSION ] || echo '(unknown)' > conf/VERSION
fi
cp -R conf/* $gl_conf_dir || die "cp conf/* to $gl_conf_dir failed"