summaryrefslogtreecommitdiff
path: root/librerelease
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-05-16 00:44:39 -0500
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-05-16 00:44:39 -0500
commit7f118f53283d7e228c40a40076815ce94ebb94a7 (patch)
treee7b70c0f9f297edc42a1333b38e6e06357edcdd8 /librerelease
parent0fa9894cbc10f0742c3076666524956f7279e8af (diff)
Cleaned up some things, added option parse to some scripts.
Diffstat (limited to 'librerelease')
-rwxr-xr-xlibrerelease56
1 files changed, 43 insertions, 13 deletions
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