Compare commits

..

1 Commits

Author SHA1 Message Date
7433c31699 fixed home expansion in bash quotes
fuck you bash!
2022-09-18 18:12:06 +02:00

View File

@ -1,41 +1,29 @@
#/usr/bin/env bash #/usr/bin/env bash
set -e set -e
# Check if the source server variable has already been set externally # Check for the source server (with default)
if [ -z "${DEPLOY_SOURCE}" ]; then DEPLOY_SOURCE_FILE="${HOME}/.deploy_source"
# Check for the source server (with default) DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
DEPLOY_SOURCE_FILE="${HOME}/.deploy_source" if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
. "${DEPLOY_SOURCE_FILE}" . "${DEPLOY_SOURCE_FILE}"
fi
fi fi
# Check if the deploy position variable has already been set externally # Check for the deploy position (with default)
if [ -z "${DEPLOY_DESTINATION}" ]; then DEPLOY_DESTINATION_FILE="${HOME}/.deploy_destination"
# Check for the deploy position (with default) DEPLOY_DESTINATION="/opt"
DEPLOY_DESTINATION_FILE="${HOME}/.deploy_destination" if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then
DEPLOY_DESTINATION="/opt"
if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then
. "${DEPLOY_DESTINATION_FILE}" . "${DEPLOY_DESTINATION_FILE}"
fi
fi fi
# Check if the correct usage is respected # Check if the correct usage is respected
if [ $# -lt 2 ]; then if [ $# -ne 2 ]; then
echo "Usage: $0 <service> <service name> [branch/tag]" echo "Usage: $0 <service> <service name>"
echo echo
echo "Current settings:" echo "Current settings:"
echo "- \$DEPLOY_SOURCE · ${DEPLOY_SOURCE}" echo "- Source · ${DEPLOY_SOURCE}"
echo "- \$DEPLOY_DESTINATION · ${DEPLOY_DESTINATION}" echo "- Destination · ${DEPLOY_DESTINATION}"
exit exit
fi fi
echo "deploying ..." echo "deploying ..."
git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/${2}" git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/$2"
if [ $# -eq 3 ]; then
pushd "${DEPLOY_DESTINATION}/${2}"
git checkout "${3}"
popd
fi