aptly_publish_update: unhardcode aptly URL
Change-Id: I1ddd62b8cb68b2909841de970fd7d90c2ab00ae8
diff --git a/aptly/files/aptly_publish_update.sh b/aptly/files/aptly_publish_update.sh
index cbc8ca5..5e2c341 100644
--- a/aptly/files/aptly_publish_update.sh
+++ b/aptly/files/aptly_publish_update.sh
@@ -21,8 +21,7 @@
}
trap at_exit EXIT
-while getopts "a?c?f?r?v?" option
-do
+while getopts "a?c?f?r?v?:u:" option;do
case "${option}"
in
a|\?) START_API=1;;
@@ -30,6 +29,7 @@
f|\?) FORCE_OVERWRITE=1;;
r|\?) RECREATE=1;;
v|\?) VERBOSE=1;;
+ u|\?) URL=$OPTARG;;
esac
done
@@ -43,7 +43,8 @@
PUBLISHER_OPTIONS+=" --force-overwrite"
fi
-aptly-publisher --timeout=1200 publish -v -c /etc/aptly-publisher.yaml --url http://127.0.0.1:8080 --architectures amd64 $PUBLISHER_OPTIONS
+URL=${URL:-"http://127.0.0.1:8080"}
+aptly-publisher --timeout=1200 publish -v -c /etc/aptly-publisher.yaml --url ${URL} --architectures amd64 $PUBLISHER_OPTIONS
if [[ $? -ne 0 ]]; then
echo "Aptly Publisher failed."
@@ -59,4 +60,4 @@
log_info "Cleaning Aptly DB"
aptly db cleanup
fi
-exit 0
\ No newline at end of file
+exit 0