mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix setup script
This commit is contained in:
parent
97fa648b2f
commit
7b86bb262c
1 changed files with 17 additions and 1 deletions
|
@ -150,6 +150,22 @@ ask_while_empty() {
|
|||
eval "$var_name=\"$value\""
|
||||
}
|
||||
|
||||
get_timezone() {
|
||||
if [ -f /etc/timezone ]; then
|
||||
TIMEZONE=$(cat /etc/timezone)
|
||||
if [ -n "$TIMEZONE" ]; then
|
||||
echo "$TIMEZONE"
|
||||
fi
|
||||
elif command -v timedatectl >/dev/null 2>&1; then
|
||||
TIMEZONE=$(timedatectl status | grep "Time zone" | awk '{print $3}')
|
||||
if [ -n "$TIMEZONE" ]; then
|
||||
echo "$TIMEZONE"
|
||||
fi
|
||||
else
|
||||
echo "Warning: could not detect timezone, please set it manually"
|
||||
fi
|
||||
}
|
||||
|
||||
check_pkg "openssl" "openssl"
|
||||
check_pkg "docker" "docker-ce"
|
||||
|
||||
|
@ -165,7 +181,7 @@ JWT_SECRET=$(openssl rand -base64 32)
|
|||
sed -i "s|GODOXY_API_JWT_SECRET=.*|GODOXY_API_JWT_SECRET=${JWT_SECRET}|" "$DOT_ENV_PATH"
|
||||
|
||||
# set timezone
|
||||
TIMEZONE=$(cat /etc/timezone)
|
||||
get_timezone
|
||||
if [ -n "$TIMEZONE" ]; then
|
||||
sed -i "s|TZ=.*|TZ=${TIMEZONE}|" "$DOT_ENV_PATH"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue