install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / toolbox / update-all-projects.sh
bloba0df417abf1a6297c6ad4d416b106d0b15837b90
1 #!/bin/sh
3 # Update all current projects hooks and config
5 # If one or more project names are given, just update those instead
7 # update-all-projects [--dry-run] [projname]...
9 set -e
11 . @basedir@/shlib.sh
13 force=
14 dryrun=
15 [ "$1" != "--force" ] && [ "$1" != "-f" ] || { force=1; shift; }
16 [ "$1" != "--dry-run" ] && [ "$1" != "-n" ] || { dryrun=1; shift; }
17 case "$1" in -*) echo "Invalid options: $1" >&2; exit 1;; esac
19 umask 002
21 if [ -z "$cfg_owning_group" ]; then
22 if [ -z "$force" ]; then
23 echo "No owning_group set, refusing to run without --force" >&2
24 exit 1
28 mydir="$(cd "$(dirname "$0")" && pwd -P)"
29 required='update-all-hooks.sh update-all-config.pl'
30 bad=
31 for r in $required; do
32 if ! [ -x "$mydir/$r" ]; then
33 echo "missing required script: $mydir/$r" >&2
34 bad=1
36 done
37 [ -z "$bad" ] || exit 1
38 echo "Running update-all-hooks..."
39 "$mydir/update-all-hooks.pl" ${force:+--force} ${dryrun:+--dry-run} "$@"
40 echo "Running update-all-config..."
41 "$mydir/update-all-config.pl" ${force:+--force} ${dryrun:+--dry-run} "$@"