16 lines
504 B
Bash
Executable File
16 lines
504 B
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
|
|
TOKEN="${wizard_postgres_enrollment_token:-}"
|
|
unset wizard_postgres_enrollment_token
|
|
if [ -n "$TOKEN" ]; then
|
|
[ "${#TOKEN}" -ge 20 ] || { printf '%s\n' "PostgreSQL 应用接入令牌至少需要 20 个字符。" >&2; exit 1; }
|
|
case "$TOKEN" in
|
|
*$'\n'*|*$'\r'*) printf '%s\n' "PostgreSQL 应用接入令牌不能包含换行符。" >&2; exit 1 ;;
|
|
esac
|
|
umask 077
|
|
printf '%s\n' "$TOKEN" >"${TRIM_PKGVAR}/postgres-enrollment-token.seed"
|
|
fi
|
|
unset TOKEN
|
|
exit 0
|