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 74 75 76 77 78 79 80 81 82 83 84 85 86
|
#! /bin/sh
set -e
usage()
{
printf "\n$(basename $0) usage:\n\n"
printf "Takes one optional switch: -y | --yes to skip dry-run confirmations.\n"
printf "Takes the name of the library: '--libcore' or '--libgui'\n"
printf "\nAttention:\n"
printf "Note that a VPN connection to UPSAY must be opened (use open-upsay.sh)\n\n"
}
if [ "$#" = "0" ] || [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ]; then
usage
exit 0
fi
always_yes="false"
if [ "x$1" = "x-y" ] || [ "x$1" = "x--yes" ]; then
always_yes="true"
shift
fi
echo "always_yes: ${always_yes}"
libcore="false"
libgui="false"
if [ "x$1" = "x--libcore" ]; then
libcore="true"
shift
fi
if [ "x$1" = "x--libgui" ]; then
libgui="true"
shift
fi
echo "libcore: ${libcore}"
echo "libgui: ${libgui}"
if [ "${libcore}" = "false" ] && [ "${libgui}" = "false" ]; then
usage
exit 0
fi
# Go to the top source directory of the website:
build_dir="$HOME/devel/xpertmass/build-area/unix"
cd ${build_dir}
# First open a virtual private network with
# open-upsay.sh
if [ "${libcore}" = "true" ]; then
if [ ! -d code_coverage ];then
printf "\nError: directory core_coverage does not exist.\n"
exit 1
fi
#This is the dry-run command:
dry_run_command="rsync -avpnP --no-o --no-g --delete code_coverage/ $(cat $HOME/devel/varia/upsay-credentials)/code_coverage/libXpertMassCore"
# This is the effective command:
real_command="rsync -avpP --no-o --no-g --delete code_coverage/ $(cat $HOME/devel/varia/upsay-credentials)/code_coverage/libXpertMassCore"
if [ "${always_yes}" != "true" ]; then
printf "\nGoing to run dry-run command:\n\n${dry_run_command}\n\nContinue? <ENTER> | Ctrl-C\n"
read answer
eval ${dry_run_command}
printf "\nShould now run the REAL command:\n\n${real_command}\n\nContinue? <ENTER> | Ctrl-C\n"
read answer
fi
eval ${real_command}
exit $?
fi
|