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:
parent
faf1629fd8
commit
805050a129
|
@ -1,17 +1,17 @@
|
||||||
#!/bin/bash
|
#!/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
|
. $(dirname $0)/adc.common-functions
|
||||||
|
|
||||||
get_rights_and_owner gitolite-admin
|
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
|
op=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
locs=
|
locs=
|
||||||
while [[ -n $1 ]]
|
while [ -n "$1" ]
|
||||||
do
|
do
|
||||||
case $1 in
|
case $1 in
|
||||||
'@all' )
|
'@all' )
|
||||||
|
@ -33,7 +33,7 @@ case $op in
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
dis|disable )
|
dis|disable )
|
||||||
[[ -t 0 ]] && printf message:
|
# bashism
|
||||||
read msg <<<$(cat)
|
read msg <<<$(cat)
|
||||||
for l in $locs
|
for l in $locs
|
||||||
do
|
do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# please make sure this file is NOT chmod +x
|
# please make sure this file is NOT chmod +x
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ get_rights_and_owner() {
|
||||||
# set shell variables as needed
|
# set shell variables as needed
|
||||||
owner=${ans#* }
|
owner=${ans#* }
|
||||||
rights=${ans% *}
|
rights=${ans% *}
|
||||||
[[ $rights =~ C ]] && perm_create=yes || perm_create=
|
echo $rights | grep C >/dev/null 2>&1 && perm_create=yes || perm_create=
|
||||||
[[ $rights =~ R ]] && perm_read=yes || perm_read=
|
echo $rights | grep R >/dev/null 2>&1 && perm_read=yes || perm_read=
|
||||||
[[ $rights =~ W ]] && perm_write=yes || perm_write=
|
echo $rights | grep W >/dev/null 2>&1 && perm_write=yes || perm_write=
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
from=$1
|
from=$1
|
||||||
to=$2
|
to=$2
|
||||||
|
@ -10,10 +10,10 @@ to=$2
|
||||||
# have a new "git-init" command!
|
# have a new "git-init" command!
|
||||||
|
|
||||||
get_rights_and_owner $from
|
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
|
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
|
# let gitolite create the repo first
|
||||||
SSH_ORIGINAL_COMMAND="git-init '$to'" $GL_BINDIR/gl-auth-command $GL_USER
|
SSH_ORIGINAL_COMMAND="git-init '$to'" $GL_BINDIR/gl-auth-command $GL_USER
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/adc.common-functions
|
. $(dirname $0)/adc.common-functions
|
||||||
|
|
||||||
get_rights_and_owner gitolite-admin
|
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
|
# and here you let them do the dangerous stuff
|
||||||
echo "+rm -rf $GL_REPO_BASE_ABS"
|
echo "+rm -rf $GL_REPO_BASE_ABS"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/adc.common-functions
|
. $(dirname $0)/adc.common-functions
|
||||||
|
|
||||||
delete=$1
|
delete=$1
|
||||||
|
|
||||||
get_rights_and_owner $delete
|
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
|
cd $GL_REPO_BASE_ABS
|
||||||
rm -rf $delete.git
|
rm -rf $delete.git
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# what/why: re-establish gitolite admin access when admin key(s) lost
|
# what/why: re-establish gitolite admin access when admin key(s) lost
|
||||||
# where: on server (NOT client!)
|
# where: on server (NOT client!)
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
# ENDHELP
|
# 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
|
set -e
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ if git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
git describe --tags --long HEAD 2>/dev/null > conf/VERSION || die "git describe failed -- this should not happen!"
|
git describe --tags --long HEAD 2>/dev/null > conf/VERSION || die "git describe failed -- this should not happen!"
|
||||||
else
|
else
|
||||||
[[ -f conf/VERSION ]] || echo '(unknown)' > conf/VERSION
|
[ -f conf/VERSION ] || echo '(unknown)' > conf/VERSION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -R conf/* $gl_conf_dir || die "cp conf/* to $gl_conf_dir failed"
|
cp -R conf/* $gl_conf_dir || die "cp conf/* to $gl_conf_dir failed"
|
||||||
|
|
Loading…
Reference in a new issue