fixes button

This commit is contained in:
2026-06-26 14:45:42 +03:00
parent 84a007f9d0
commit cdb731d837
33 changed files with 594 additions and 99 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# bt-set-master - set the deploy-time emergency master password.
#
# Usage (once at first install):
# sudo /opt/buttontask/scripts/bt-set-master 'your-secret'
#
# Writes $BUTTONTASK_ROOT/config/.master (mode 600, buttontask-owned).
# Used by web login and Qt settings password check as a fallback.
set -euo pipefail
ROOT="${BUTTONTASK_ROOT:-/opt/buttontask}"
FILE="$ROOT/config/.master"
[ "$#" -eq 1 ] || { echo "usage: bt-set-master <password>" >&2; exit 2; }
[ -n "$1" ] || { echo "password must not be empty" >&2; exit 1; }
install -d -m 0750 "$ROOT/config"
umask 077
printf '%s' "$1" > "$FILE"
chmod 600 "$FILE"
chown buttontask:buttontask "$FILE" 2>/dev/null || true
echo "master password set: $FILE"