Follow the house shell conventions
Constants UPPER_SNAKE, mutable locals PascalCase, braced expansions throughout, per Development/Coding conventions in the vault.
This commit is contained in:
@@ -13,11 +13,11 @@ readonly STATE_DIR="${XDG_STATE_HOME:-${HOME}/.local/state}/cd-webhook"
|
||||
readonly SYSTEMD_DIR="${HOME}/.config/systemd/user"
|
||||
readonly UNIT_NAME="cd-webhook.service"
|
||||
|
||||
PURGE=0
|
||||
[[ "${1:-}" == "--purge" ]] && PURGE=1
|
||||
Purge=0
|
||||
[[ "${1:-}" == "--purge" ]] && Purge=1
|
||||
|
||||
echo "Stopping ${UNIT_NAME} ..."
|
||||
systemctl --user disable --now "$UNIT_NAME" 2>/dev/null || true
|
||||
systemctl --user disable --now "${UNIT_NAME}" 2>/dev/null || true
|
||||
rm -f "${SYSTEMD_DIR}/${UNIT_NAME}"
|
||||
systemctl --user daemon-reload
|
||||
|
||||
@@ -25,9 +25,9 @@ systemctl --user daemon-reload
|
||||
# is regenerated from targets.json plus secrets.env on the next install.
|
||||
rm -f "${CONFIG_DIR}/hooks.json"
|
||||
|
||||
if [[ $PURGE -eq 1 ]]; then
|
||||
if [[ ${Purge} -eq 1 ]]; then
|
||||
echo "Purging secrets and deploy logs ..."
|
||||
rm -rf "$CONFIG_DIR" "$STATE_DIR"
|
||||
rm -rf "${CONFIG_DIR}" "${STATE_DIR}"
|
||||
else
|
||||
echo "Kept ${CONFIG_DIR}/secrets.env and deploy logs in ${STATE_DIR}"
|
||||
echo " (re-run with --purge to remove them too)"
|
||||
|
||||
Reference in New Issue
Block a user