Update build.func
This commit is contained in:
parent
7c0e975eca
commit
3133f47d6e
@ -1795,7 +1795,16 @@ install_script() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
|
|
||||||
|
# Get timezone using timedatectl (Debian 13+ compatible)
|
||||||
|
# Fallback to /etc/timezone for older systems
|
||||||
|
if command -v timedatectl >/dev/null 2>&1; then
|
||||||
|
timezone=$(timedatectl show --value --property=Timezone 2>/dev/null || echo "UTC")
|
||||||
|
elif [ -f /etc/timezone ]; then
|
||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
|
else
|
||||||
|
timezone="UTC"
|
||||||
|
fi
|
||||||
|
|
||||||
# Show APP Header
|
# Show APP Header
|
||||||
header_info
|
header_info
|
||||||
@ -2714,7 +2723,9 @@ EOF'
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if pct exec "$CTID" -- test -e "/usr/share/zoneinfo/$tz"; then
|
if pct exec "$CTID" -- test -e "/usr/share/zoneinfo/$tz"; then
|
||||||
pct exec "$CTID" -- bash -c "tz='$tz'; echo \"\$tz\" >/etc/timezone && ln -sf \"/usr/share/zoneinfo/\$tz\" /etc/localtime"
|
# Set timezone using symlink (Debian 13+ compatible)
|
||||||
|
# Create /etc/timezone for backwards compatibility with older scripts
|
||||||
|
pct exec "$CTID" -- bash -c "tz='$tz'; ln -sf \"/usr/share/zoneinfo/\$tz\" /etc/localtime && echo \"\$tz\" >/etc/timezone || true"
|
||||||
else
|
else
|
||||||
msg_warn "Skipping timezone setup – zone '$tz' not found in container"
|
msg_warn "Skipping timezone setup – zone '$tz' not found in container"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user