1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/bin/bash
beta=
dryrun=
usage() {
echo "Usage: $0 [--dry-run|-n] [--beta|-b] NEW-VERSION" >&2
exit 1;
}
for arg in "$@"; do
case $arg in
--beta|-b)
beta=1 ;;
--dry-run|-n)
dryrun=1 ;;
-*)
usage ;;
*)
test -n "$NEWVERSION" && usage
NEWVERSION="$arg"
;;
esac
done
test -z "$NEWVERSION" && usage
# Run this as 'locker-update NEW-VERSION' to upgrade the barnowl.real
# symlink in all arch/ directories to point to the new version.
E=
test -n "$dryrun" && E=echo
B=
test -n "$beta" && B=-beta
cd /afs/.sipb/project/barnowl/arch/
update_symlink() {
local dir="$1"
local target="$2"
local link="$3"
if [ -e "$dir/$target" ]; then
# update the symlink
$E ln -sf "$target" "$dir/$link"
else
# delete the symlink
$E rm -f "$dir/$link"
fi
}
for i in *; do
if [ -L "$i" ]; then
echo "# Skipping $i as a symbolic link..."
elif [ "$i" = "common" ]; then
echo "# Skipping 'common'..."
elif ! [ -e "$i/bin/$NEWVERSION" ] && \
! [ "$(shopt -s nullglob; echo $i/bin/$NEWVERSION.zephyr?)" ] ; then
echo "# New version $NEWVERSION not built for arch $i...";
else
echo "# $i"
# Sanity -- make sure the 'barnowl' symlink is correct.
$E ln -sf "../../common/bin/barnowl$B" "$i/bin/barnowl$B"
update_symlink "$i/bin" "$NEWVERSION" "barnowl.real$B"
update_symlink "$i/bin" "$NEWVERSION.zephyr3" "barnowl.real$B.zephyr3"
update_symlink "$i/bin" "$NEWVERSION.zephyr4" "barnowl.real$B.zephyr4"
$E ln -sf "../../common/bin/zcrypt" "$i/bin/zcrypt"
update_symlink "$i/bin" "zcrypt${NEWVERSION#barnowl}" "zcrypt.real"
update_symlink "$i/bin" "zcrypt${NEWVERSION#barnowl}.zephyr3" "zcrypt.real.zephyr3"
update_symlink "$i/bin" "zcrypt${NEWVERSION#barnowl}.zephyr4" "zcrypt.real.zephyr4"
fi
done;
|