From 7f118f53283d7e228c40a40076815ce94ebb94a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 00:44:39 -0500 Subject: Cleaned up some things, added option parse to some scripts. --- librerelease | 56 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 13 deletions(-) (limited to 'librerelease') diff --git a/librerelease b/librerelease index 39d3e2d..2359de8 100755 --- a/librerelease +++ b/librerelease @@ -24,29 +24,59 @@ source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -usage () { - printf "$(gettext "Usage: %s")" "$0" +function usage { + echo "$(gettext "Usage: $0")" echo - printf "$(gettext "This script")" + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean $WORKDIR/staging.")" +} + +function list_packages { + find $WORKDIR/staging/ -type f -print0 +} + +function clean_non_packages { + find $WORKDIR/staging/ -type -f \! -iname "*.pkg.tar.*" -delete } +function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +} + +while getopts 'hl' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean_packages; exit $? ;; + esac +done + [[ -e $custom_config ]] && source $custom_config [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" +clean_non_packages msg "Uploading packages..." rsync --recursive \ - --copy-links \ - --hard-links \ - --partial \ - --prune-empty-dirs \ - --human-readable \ - --progress \ - -e "ssh " \ - ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1 + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 +} msg "Removing packages from local [staging]" -find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +clean_packages exit 0 -- cgit v1.2.3-2-g168b