diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index d7d6061..1afcb7e 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -5482,10 +5482,22 @@ if [ $_QUICK_SYNC -eq 2 ]; then HARD_MAX_EXEC_TIME=0 fi + if [ $(IsInteger $MAX_EXEC_TIME_PER_CMD_BEFORE) -ne 1 ]; then + MAX_EXEC_TIME_PER_CMD_BEFORE=0 + fi + + if [ $(IsInteger $MAX_EXEC_TIME_PER_CMD_AFTER) -ne 1 ]; then + MAX_EXEC_TIME_PER_CMD_AFTER=0 + fi + if [ "$PATH_SEPARATOR_CHAR" == "" ]; then PATH_SEPARATOR_CHAR=";" fi + + if [ $(IsInteger $MIN_WAIT) -ne 1 ]; then MIN_WAIT=30 + + fi else ConfigFile="${1}" LoadConfigFile "$ConfigFile" diff --git a/dev/n_osync.sh b/dev/n_osync.sh index efb1c44..1bf273c 100755 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -2738,10 +2738,21 @@ if [ $_QUICK_SYNC -eq 2 ]; then HARD_MAX_EXEC_TIME=0 fi + if [ $(IsInteger $MAX_EXEC_TIME_PER_CMD_BEFORE) -ne 1 ]; then + MAX_EXEC_TIME_PER_CMD_BEFORE=0 + fi + + if [ $(IsInteger $MAX_EXEC_TIME_PER_CMD_AFTER) -ne 1 ]; then + MAX_EXEC_TIME_PER_CMD_AFTER=0 + fi + if [ "$PATH_SEPARATOR_CHAR" == "" ]; then PATH_SEPARATOR_CHAR=";" fi + + if [ $(IsInteger $MIN_WAIT) -ne 1 ]; then MIN_WAIT=30 + fi else ConfigFile="${1}" LoadConfigFile "$ConfigFile" diff --git a/packaging/ARCH/update-osync-pkg.sh b/packaging/ARCH/update-osync-pkg.sh index 959f207..d312459 100755 --- a/packaging/ARCH/update-osync-pkg.sh +++ b/packaging/ARCH/update-osync-pkg.sh @@ -1,25 +1,113 @@ #!/bin/bash -git clone git+ssh://aur@aur.archlinux.org/osync.git osync.aur && -cd "osync.aur" && -srcdir="." && -source "PKGBUILD" && +HELPTEXT=\ +"Usage: $0 [OPTIONS]\n"\ +"Automatically updates the osync version in the AUR.\n"\ +"\n"\ +"-y, --yes Do not prompt before committing\n"\ +"-n, --name=USERNAME Username to use with git in case no global username is set\n"\ +"-e, --email=EMAIL Email address to use with git in case no global email is set" -url=$(echo -n ${source[0]} | sed 's/git+//g' | sed 's/#.*//g') && -branch=$(echo -n ${source[0]} | sed 's/.*#branch=//g') && -git clone -b $branch $url && +function cleanup { + echo "Cleanup..." + cd .. + rm -rf osync.aur +} -# Get pkgver from current osync -pkgver=$(grep PROGRAM_VERSION= ./osync/osync.sh) -pkgver=${pkgver##*=} -echo $pkgver +# Check getopt compatibility +getopt --test > /dev/null +if [[ $? -ne 4 ]]; then + echo "You don't seem to have the GNU-enhanced getopt available. That shouldn't happen on a modern system with bash installed." + exit 38 +fi -sed -i "s/pkgver=.*/pkgver=$(pkgver)/g" "PKGBUILD" && +# Parse command line arguments +OPTIONS=hyn:e: +LONGOPTIONS=help,yes,name:,email: + +PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTIONS --name "$0" -- "$@") +if [[ $? -ne 0 ]]; then + exit 22 +fi +eval set -- "$PARSED" + +while true; do + case "$1" in + -h|--help) + echo -e "$HELPTEXT" + exit 0 + ;; + -y|--yes) + yes="y" + shift + ;; + -n|--name) + name="$2" + shift 2 + ;; + -e|--email) + email="$2" + shift 2 + ;; + --) + shift + break + ;; + *) + echo "Programming error" > /dev/stderr + exit 131 + ;; + esac +done + +if [[ -z $name ]];then + name=$(git config --global user.name) + if [[ -z $name ]]; then + echo "Please specify a username for the git commit with the -n|--name option or set it globally with 'git config --global user.name USERNAME" + exit 22 + fi +fi + +if [[ -z $email ]];then + email=$(git config --global user.email) + if [[ -z $email ]]; then + echo "Please specify an e-mail for the git commit with the -e|--email option or set it globally with 'git config --global user.email EMAIL" + exit 22 + fi +fi + +### Main ### + +echo "Cloning AUR package..." +if ! git clone -q git+ssh://aur@aur.archlinux.org/osync.git osync.aur || ! cd osync.aur; then + exit 1 +fi + +git config user.name "$name" +git config user.email "$email" + +echo "Cloning most recent stable version of osync..." && +git clone -qb stable https://github.com/deajan/osync.git > /dev/null && + +echo "Fetching version..." && +cd osync && +pkgversion="$(git describe --tags --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')" && +cd .. && + +echo "Updating version..." && +sed -i "s/pkgver=.*/pkgver=${pkgversion}/g" "PKGBUILD" && ../mksrcinfo && rm -rf "osync" && -git add . && -git commit -m "Updated version" && -git push origin master && -cd .. && -rm -rf "osync.aur" && -echo "Package updated successfully" + +[[ ! -z $yes ]] || (read -p "About to commit changes to AUR. Are you sure? (y/n) " -n 1 -r && echo "" && +[[ $REPLY =~ ^[Yy]$ ]]) && + +echo "Committing changes to AUR..." && +git add PKGBUILD .SRCINFO && +git commit -qm "Updated version to ${pkgversion}" && +git push -q origin master && + +cleanup && +echo "Package updated successfully to version ${pkgversion}" || cleanup + +exit 0