From 51707aa3e4ed366f371fe1e4be5125dfab0791b9 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 10 Feb 2014 13:12:39 -0800 Subject: [PATCH] Do not require /bin/bash A POSIX compatible /bin/sh will do fine as we do not actually use any bashisms. set -C, set -e and trap are all POSIX. --- gitweb/genindex.sh | 2 +- jobd/gc.sh | 4 ++-- jobd/jobd.sh | 2 +- jobd/update.sh | 4 ++-- jobs/gitwebcache.sh | 2 +- jobs/updateweb.sh | 13 ++++++------- shlib.sh | 2 +- taskd/clone.sh | 6 +++--- toolbox/remove-inactive-projects.sh | 2 +- toolbox/run-jobd.sh | 2 +- toolbox/run-taskd.sh | 2 +- toolbox/updatecheck.sh | 4 ++-- 12 files changed, 22 insertions(+), 23 deletions(-) diff --git a/gitweb/genindex.sh b/gitweb/genindex.sh index 76371db..9d256d9 100755 --- a/gitweb/genindex.sh +++ b/gitweb/genindex.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # genindex - Generate gitweb project list from Girocco's diff --git a/jobd/gc.sh b/jobd/gc.sh index 7c571e8..f6bc265 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . @basedir@/shlib.sh @@ -23,7 +23,7 @@ pidactive() { createlock() { for _try in p n; do - if (set -o noclobber; > "$1.lock") 2>/dev/null; then + if (set -C; > "$1.lock") 2>/dev/null; then echo "$1.lock" return 0 fi diff --git a/jobd/jobd.sh b/jobd/jobd.sh index 326b590..1abc41a 100755 --- a/jobd/jobd.sh +++ b/jobd/jobd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # jobd - Perform Girocco maintenance jobs # The old jobd.sh has been replaced by jobd.pl; it now simply runs that. diff --git a/jobd/update.sh b/jobd/update.sh index ca3d718..897bcfa 100755 --- a/jobd/update.sh +++ b/jobd/update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . @basedir@/shlib.sh @@ -47,7 +47,7 @@ mail="$(config_get owner || :)" statusok="$(git config --bool gitweb.statusupdates 2>/dev/null || echo true)" mailaddrs='' [ "$statusok" = "false" -o -z "$mail" ] || mailaddrs="$mail" -[ -z "$cfg_admincc" -o "$cfg_admincc" = "0" -o -z "$cfg_admin" ] || +[ -z "$cfg_admincc" -o "$cfg_admincc" = "0" -o -z "$cfg_admin" ] || \ if [ -z "$mailaddrs" ]; then mailaddrs="$cfg_admin"; else mailaddrs="$mailaddrs,$cfg_admin"; fi bang_eval "git for-each-ref --format '%(refname) %(objectname)' >.refs-temp" diff --git a/jobs/gitwebcache.sh b/jobs/gitwebcache.sh index de38dc0..e3563f3 100755 --- a/jobs/gitwebcache.sh +++ b/jobs/gitwebcache.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . @basedir@/shlib.sh diff --git a/jobs/updateweb.sh b/jobs/updateweb.sh index 5d439d9..f0e830f 100755 --- a/jobs/updateweb.sh +++ b/jobs/updateweb.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . @basedir@/shlib.sh @@ -18,14 +18,13 @@ if [ -s ${LOCK_FILE} ] && kill -0 $(cat ${LOCK_FILE}); then fi echo $$ >${LOCK_FILE} -pushd ${REPO_DIR} > /dev/null +cd "${REPO_DIR}" git fetch origin -if [ "`git rev-list $BRANCH..$REMOTE/$BRANCH`" ]; then - git merge --ff-only $REMOTE/$BRANCH && - git submodule update && - "$MAKE" --quiet && +if [ -n "`git rev-list $BRANCH..$REMOTE/$BRANCH`" ]; then + git merge --ff-only $REMOTE/$BRANCH && \ + git submodule update && \ + "$MAKE" --quiet && \ "$MAKE" install fi -popd > /dev/null rm ${LOCK_FILE} diff --git a/shlib.sh b/shlib.sh index 9448806..df2dffe 100644 --- a/shlib.sh +++ b/shlib.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # This is generic shell library for all the scripts used by Girocco; # most importantly, it introduces all the $cfg_* shell variables. diff --git a/taskd/clone.sh b/taskd/clone.sh index dd3eade..4e32956 100755 --- a/taskd/clone.sh +++ b/taskd/clone.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Invoked from taskd/taskd.pl @@ -21,7 +21,7 @@ if [ "$cfg_project_owners" = "source" ]; then fi mailaddrs="$(config_get owner || :)" -[ -z "$cfg_admin" ] || +[ -z "$cfg_admin" ] || \ if [ -z "$mailaddrs" ]; then mailaddrs="$cfg_admin"; else mailaddrs="$mailaddrs,$cfg_admin"; fi # Initial mirror @@ -42,7 +42,7 @@ case "$url" in # so try again without -s if the -s version fails. # We must use GIT_DIR=. here or ever so "helpful" git-svn will # create a .git subdirectory! - GIT_DIR=. git svn init --prefix= -s "$svnurl" < /dev/null || + GIT_DIR=. git svn init --prefix= -s "$svnurl" < /dev/null || \ GIT_DIR=. git svn init --prefix= "$svnurl" < /dev/null # We need to remember this url so we can detect changes because # ever so "helpful" git-svn may shorten it! diff --git a/toolbox/remove-inactive-projects.sh b/toolbox/remove-inactive-projects.sh index eb279e2..2f15c0f 100755 --- a/toolbox/remove-inactive-projects.sh +++ b/toolbox/remove-inactive-projects.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Checking for inactive projects (empty repositories) echo "Not ready for usage yet; have to figure out locking and check conditions --jast" diff --git a/toolbox/run-jobd.sh b/toolbox/run-jobd.sh index 3b1054e..cfe4988 100755 --- a/toolbox/run-jobd.sh +++ b/toolbox/run-jobd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh cd "$HOME" diff --git a/toolbox/run-taskd.sh b/toolbox/run-taskd.sh index 8f70575..35a30a3 100755 --- a/toolbox/run-taskd.sh +++ b/toolbox/run-taskd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh cd "$HOME" diff --git a/toolbox/updatecheck.sh b/toolbox/updatecheck.sh index 97cde6a..ab4824a 100755 --- a/toolbox/updatecheck.sh +++ b/toolbox/updatecheck.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Repack in reverse order, so that forked repositories get repacked first. # That prevents objects from missing, since repack -l will automagically @@ -7,7 +7,7 @@ . @basedir@/shlib.sh cd "$cfg_reporoot" -cat "$cfg_chroot/etc/group" | cut -d : -f 1 | +cat "$cfg_chroot/etc/group" | cut -d : -f 1 | \ while read dir; do echo "* $dir" >&2 if [ -e "$dir.git"/.nofetch ]; then -- 2.11.4.GIT