mirror of https://github.com/lukechilds/umbrel.git
Aaron Dewes
4 years ago
committed by
GitHub
4 changed files with 45 additions and 0 deletions
@ -0,0 +1,5 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)" |
|||
|
|||
"${UMBREL_ROOT}/scripts/umbrel-os/change-password" |
@ -0,0 +1,35 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
set -euo pipefail |
|||
|
|||
UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)" |
|||
PASSWORD_FILE="${UMBREL_ROOT}/statuses/password" |
|||
|
|||
check_root () { |
|||
if [[ $UID != 0 ]]; then |
|||
echo "This script must be run as root" |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
check_umbrel_os () { |
|||
[[ -f "/etc/default/umbrel" ]] && source "/etc/default/umbrel" |
|||
if [[ -z "${UMBREL_OS:-}" ]]; then |
|||
echo "This script must only be run on Umbrel OS" |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
password="$(cat ${PASSWORD_FILE})" |
|||
echo "false" > "${PASSWORD_FILE}" |
|||
|
|||
check_root |
|||
check_umbrel_os |
|||
|
|||
if [[ "${password}" == "" ]] || [[ "${password}" == "false" ]] || [[ "${password}" == "true" ]]; then |
|||
echo "Password not set in status file: \"${PASSWORD_FILE}\"" |
|||
exit 1 |
|||
fi |
|||
|
|||
echo -e "${password}\n${password}" | passwd umbrel |
|||
echo "true" > "${PASSWORD_FILE}" |
@ -0,0 +1 @@ |
|||
false |
Loading…
Reference in new issue