summaryrefslogtreecommitdiff
path: root/src/abslibre-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools')
-rwxr-xr-xsrc/abslibre-tools/librerelease106
1 files changed, 55 insertions, 51 deletions
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease
index 09f2119..38fa0ac 100755
--- a/src/abslibre-tools/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -97,57 +97,61 @@ function clean {
rm -f $@
}
-if [ -w / ]; then
- error "Run $0 as normal user"
- exit 1
-fi
-
-while getopts 'hlcn' arg; do
- case $arg in
- h) usage; exit 0 ;;
- l) list_packages; exit 0 ;;
- c) clean; exit $? ;;
- n) dryrun="--dry-run" ;;
- esac
-done
-
-[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}"
-
-clean_non_packages
-sign_packages
-
-# Make the permissions of the packages 644 otherwise the user will get access
-# denied error when they try to download (rsync --no-perms doesn't seem to
-# work).
-find ${WORKDIR}/staging -type f -exec chmod 644 {} \;
-find ${WORKDIR}/staging -type d -exec chmod 755 {} \;
-
-# Get the synced files
-SYNCED_FILES=($(find ${WORKDIR}/staging -type f))
-
-msg "%s to upload" $(du -h -d 0 ${WORKDIR}/staging | tr "\t" " " | cut -d" " -f1)
-msg "Uploading packages..."
-rsync --recursive \
- ${dryrun} \
- --no-group \
- --no-perms \
- --copy-links \
- --hard-links \
- --partial \
- --prune-empty-dirs \
- --human-readable \
- --progress \
- -e "ssh " \
- ${WORKDIR}/staging \
- ${PARABOLAHOST}:${LIBREDESTDIR}/ || {
- error "Sync failed, try again"
- exit 1
-}
+function main {
+ if [ -w / ]; then
+ error "Run $0 as normal user"
+ exit 1
+ fi
-msg "Removing ${#SYNCED_FILES[@]} files from local [staging]"
-clean ${SYNCED_FILES[@]}
+ while getopts 'hlcn' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ l) list_packages; exit 0 ;;
+ c) clean; exit $? ;;
+ n) dryrun="--dry-run" ;;
+ esac
+ done
-msg "Running db-update on repos"
-ssh ${PARABOLAHOST} dbscripts/db-update
+ [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}"
+
+ clean_non_packages
+ sign_packages
+
+ # Make the permissions of the packages 644 otherwise the user will get access
+ # denied error when they try to download (rsync --no-perms doesn't seem to
+ # work).
+ find ${WORKDIR}/staging -type f -exec chmod 644 {} \;
+ find ${WORKDIR}/staging -type d -exec chmod 755 {} \;
+
+ # Get the synced files
+ SYNCED_FILES=($(find ${WORKDIR}/staging -type f))
+
+ msg "%s to upload" $(du -h -d 0 ${WORKDIR}/staging | tr "\t" " " | cut -d" " -f1)
+ msg "Uploading packages..."
+ rsync --recursive \
+ ${dryrun} \
+ --no-group \
+ --no-perms \
+ --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 ${#SYNCED_FILES[@]} files from local [staging]"
+ clean ${SYNCED_FILES[@]}
+
+ msg "Running db-update on repos"
+ ssh ${PARABOLAHOST} dbscripts/db-update
+
+ exit 0
+}
-exit 0
+main "$@"