File vicibox-timezone of Package vicibox-install
#!/bin/bash
# Call yast to do the system config
yast timezone
# Get the correct timezone string
TIMEZONE=$(timedatectl | grep 'Time zone' | xargs | cut -d ' ' -f3)
# And make changes to php and /etc/sysconfig/clock
echo -n "Setting PHP date.timezone to $TIMEZONE... "
if [ -f "/etc/php7/cli/php.ini" ]; then
sed -i "/date.timezone = /c\date.timezone = '$TIMEZONE'" /etc/php7/cli/php.ini
fi
if [ -f "/etc/php7/apache2/php.ini" ]; then
sed -i "/date.timezone = /c\date.timezone = '$TIMEZONE'" /etc/php7/apache2/php.ini
fi
if [ -f "/etc/php8/cli/php.ini" ]; then
sed -i "/date.timezone = /c\date.timezone = '$TIMEZONE'" /etc/php8/cli/php.ini
fi
if [ -f "/etc/php8/apache2/php.ini" ]; then
sed -i "/date.timezone = /c\date.timezone = '$TIMEZONE'" /etc/php8/apache2/php.ini
fi
echo "DEFAULT_TIMEZONE=\"$TIMEZONE\"" > /etc/sysconfig/clock
echo "done."
echo "A reboot might be required for changes to take effect."