mirror of
https://github.com/cupcakearmy/coolify.git
synced 2024-10-22 16:14:22 +02:00
support all coolify supported os and improve symbolic link creation
This commit is contained in:
parent
1376846077
commit
a51b306c08
@ -260,15 +260,32 @@ private function updateServerTimezone($desired_timezone)
|
|||||||
ray('updateServerTimezone called with value:', $desired_timezone);
|
ray('updateServerTimezone called with value:', $desired_timezone);
|
||||||
try {
|
try {
|
||||||
$commands = [
|
$commands = [
|
||||||
"if [ -f /etc/timezone ]; then",
|
"if command -v timedatectl > /dev/null 2>&1 && pidof systemd > /dev/null; then",
|
||||||
|
" timedatectl set-timezone " . escapeshellarg($desired_timezone),
|
||||||
|
"elif [ -f /etc/timezone ]; then",
|
||||||
" echo " . escapeshellarg($desired_timezone) . " > /etc/timezone",
|
" echo " . escapeshellarg($desired_timezone) . " > /etc/timezone",
|
||||||
|
" rm -f /etc/localtime",
|
||||||
" ln -sf /usr/share/zoneinfo/" . escapeshellarg($desired_timezone) . " /etc/localtime",
|
" ln -sf /usr/share/zoneinfo/" . escapeshellarg($desired_timezone) . " /etc/localtime",
|
||||||
"elif [ -f /etc/localtime ]; then",
|
"elif [ -f /etc/localtime ]; then",
|
||||||
|
" rm -f /etc/localtime",
|
||||||
" ln -sf /usr/share/zoneinfo/" . escapeshellarg($desired_timezone) . " /etc/localtime",
|
" ln -sf /usr/share/zoneinfo/" . escapeshellarg($desired_timezone) . " /etc/localtime",
|
||||||
"else",
|
"else",
|
||||||
" echo 'Unable to set timezone'",
|
" echo 'Unable to set timezone'",
|
||||||
" exit 1",
|
" exit 1",
|
||||||
"fi",
|
"fi",
|
||||||
|
"if command -v dpkg-reconfigure > /dev/null 2>&1; then",
|
||||||
|
" dpkg-reconfigure -f noninteractive tzdata",
|
||||||
|
"elif command -v tzdata-update > /dev/null 2>&1; then",
|
||||||
|
" tzdata-update",
|
||||||
|
"elif [ -f /etc/sysconfig/clock ]; then",
|
||||||
|
" sed -i 's/^ZONE=.*/ZONE=\"" . $desired_timezone . "\"/' /etc/sysconfig/clock",
|
||||||
|
" source /etc/sysconfig/clock",
|
||||||
|
"fi",
|
||||||
|
"if command -v systemctl > /dev/null 2>&1 && pidof systemd > /dev/null; then",
|
||||||
|
" systemctl try-restart systemd-timesyncd.service || true",
|
||||||
|
"elif command -v service > /dev/null 2>&1; then",
|
||||||
|
" service ntpd restart || service ntp restart || true",
|
||||||
|
"fi",
|
||||||
"echo \"Timezone updated to: $desired_timezone\"",
|
"echo \"Timezone updated to: $desired_timezone\"",
|
||||||
"date"
|
"date"
|
||||||
];
|
];
|
||||||
@ -279,7 +296,7 @@ private function updateServerTimezone($desired_timezone)
|
|||||||
ray('Result of instant_remote_process:', $result);
|
ray('Result of instant_remote_process:', $result);
|
||||||
|
|
||||||
// Check if the timezone was actually changed
|
// Check if the timezone was actually changed
|
||||||
$newTimezone = trim(instant_remote_process(["cat /etc/timezone 2>/dev/null || readlink /etc/localtime | sed 's#/usr/share/zoneinfo/##'"], $this->server, false));
|
$newTimezone = trim(instant_remote_process(["date +%Z"], $this->server, false));
|
||||||
ray('New timezone after update:', $newTimezone);
|
ray('New timezone after update:', $newTimezone);
|
||||||
|
|
||||||
if ($newTimezone !== $desired_timezone) {
|
if ($newTimezone !== $desired_timezone) {
|
||||||
|
Loading…
Reference in New Issue
Block a user