(minor) bashism fixes, usability fix, for "able" adc

This commit is contained in:
Sitaram Chamarty 2011-02-04 21:28:23 +05:30
parent 9a49487d0a
commit bdef55eee9
2 changed files with 19 additions and 12 deletions

View file

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/sh
# WARNING: USES BASH FEATURES TO AVOID A TEMP FILE; CAN BE FIXED IF NEEDED
. $(dirname $0)/adc.common-functions . $(dirname $0)/adc.common-functions
@ -26,7 +24,7 @@ do
shift shift
done done
[[ -z "$locs" ]] && die "give me '@all' or some reponame" [ -z "$locs" ] && die "give me '@all' or some reponame"
case $op in case $op in
en|enable ) en|enable )
@ -36,14 +34,20 @@ case $op in
done done
;; ;;
dis|disable ) dis|disable )
# bashism
read msg <<<$(cat) TEMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX)
export TEMPDIR
trap "/bin/rm -rf $TEMPDIR" 0
echo 'type the message to be shown to users when they try to push; end with Ctrl-D:'
echo > $TEMPDIR/msg
cat >> $TEMPDIR/msg
echo disabling following locations with message: echo disabling following locations with message:
echo $msg cat $TEMPDIR/msg
echo echo
for l in $locs for l in $locs
do do
echo $msg > $l/.gitolite.down cat $TEMPDIR/msg > $l/.gitolite.down
echo $l echo $l
done done
;; ;;

View file

@ -57,7 +57,8 @@ do
expect "give me '@all' or some reponame" expect "give me '@all' or some reponame"
(echo first line; echo second line) | runlocal ssh gitolite able dis @all (echo first line; echo second line) | runlocal ssh gitolite able dis @all
expect "disabling following locations with message:" expect "disabling following locations with message:"
expect "first line second line" expect "first line"
expect "^second line"
expect "/home/gitolite-test" expect "/home/gitolite-test"
runremote ls -al .gitolite.down runremote ls -al .gitolite.down
expect "^.rw------- 1 gitolite-test gitolite-test .. ... .. ..:.. .gitolite.down" expect "^.rw------- 1 gitolite-test gitolite-test .. ... .. ..:.. .gitolite.down"
@ -67,7 +68,8 @@ do
mdc; mdc mdc; mdc
runlocal git push origin master runlocal git push origin master
expect ABORTING expect ABORTING
expect "first line second line" expect "first line"
expect "^second line"
expect "fatal: The remote end hung up unexpectedly" expect "fatal: The remote end hung up unexpectedly"
name "u2 create and push bar/u2/r1 fail" name "u2 create and push bar/u2/r1 fail"
@ -75,7 +77,8 @@ do
mdc; mdc mdc; mdc
runlocal git push origin master runlocal git push origin master
expect ABORTING expect ABORTING
expect "first line second line" expect "first line"
expect "^second line"
expect "fatal: The remote end hung up unexpectedly" expect "fatal: The remote end hung up unexpectedly"
name "enable entire site" name "enable entire site"
@ -106,7 +109,7 @@ do
expect "foo down" expect "foo down"
expect "/home/gitolite-test/repositories/foo.git" expect "/home/gitolite-test/repositories/foo.git"
runremote ls -al /home/gitolite-test/repositories/foo.git/.gitolite.down runremote ls -al /home/gitolite-test/repositories/foo.git/.gitolite.down
expect ".rw------- 1 gitolite-test gitolite-test . ... .. ..:.. /home/gitolite-test/repositories/foo.git/.gitolite.down" expect ".rw------- 1 gitolite-test gitolite-test .* ..:.. /home/gitolite-test/repositories/foo.git/.gitolite.down"
name "u1 push foo fail" name "u1 push foo fail"
cd ~/td/foo cd ~/td/foo