mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-18 10:42:22 +00:00
Update auto_post_install.sh
This commit is contained in:
parent
370f4694d1
commit
4d7564094e
@ -165,13 +165,16 @@ remove_subscription_banner() {
|
|||||||
|
|
||||||
|
|
||||||
configure_time_sync() {
|
configure_time_sync() {
|
||||||
msg_info "$(translate "Configuring system time settings...")"
|
msg_info2 "$(translate "Configuring system time settings...")"
|
||||||
|
|
||||||
|
|
||||||
|
# Get public IP address
|
||||||
this_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
this_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||||
if [ -z "$this_ip" ]; then
|
if [ -z "$this_ip" ]; then
|
||||||
msg_warn "$(translate "Failed to obtain public IP address")"
|
msg_warn "$(translate "Failed to obtain public IP address")"
|
||||||
timezone="UTC"
|
timezone="UTC"
|
||||||
else
|
else
|
||||||
|
# Get timezone based on IP
|
||||||
timezone=$(curl -s "https://ipapi.co/${this_ip}/timezone")
|
timezone=$(curl -s "https://ipapi.co/${this_ip}/timezone")
|
||||||
if [ -z "$timezone" ]; then
|
if [ -z "$timezone" ]; then
|
||||||
msg_warn "$(translate "Failed to determine timezone from IP address")"
|
msg_warn "$(translate "Failed to determine timezone from IP address")"
|
||||||
@ -181,17 +184,25 @@ configure_time_sync() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
timedatectl set-timezone "$timezone"
|
# Set the timezone
|
||||||
|
if timedatectl set-timezone "$timezone"; then
|
||||||
|
msg_ok "$(translate "Timezone set to $timezone")"
|
||||||
|
else
|
||||||
|
msg_error "$(translate "Failed to set timezone to $timezone")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure time synchronization
|
||||||
msg_info "$(translate "Enabling automatic time synchronization...")"
|
msg_info "$(translate "Enabling automatic time synchronization...")"
|
||||||
if timedatectl set-ntp true; then
|
if timedatectl set-ntp true; then
|
||||||
msg_ok "$(translate "Time settings configured - Timezone:") $timezone"
|
|
||||||
register_tool "time_sync" true
|
|
||||||
|
|
||||||
systemctl restart postfix 2>/dev/null || true
|
systemctl restart postfix 2>/dev/null || true
|
||||||
|
msg_ok "$(translate "Automatic time synchronization enabled")"
|
||||||
|
register_tool "time_sync" true
|
||||||
|
msg_success "$(translate "Time settings configuration completed")"
|
||||||
else
|
else
|
||||||
msg_error "$(translate "Failed to enable automatic time synchronization")"
|
msg_error "$(translate "Failed to enable automatic time synchronization")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user