#!/sbin/sh # # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. # . /lib/svc/share/smf_include.sh # Read timezone from SMF service instance timezone=$(/usr/bin/svcprop -p timezone/localtime $SMF_FMRI) if [ -z "$timezone" -o "$timezone" = '""' ]; then echo "ERROR: timezone/localtime missing or not set" exit $SMF_EXIT_ERR_CONFIG fi # Set Timezone set_timezone() { # Avoid localtime symlink cycle if [ "$1" = "localtime" ]; then echo "ERROR: timezone/localtime should not be set to 'localtime'" exit $SMF_EXIT_ERR_CONFIG fi # zic repoints the localtime symlink. /usr/sbin/zic -l $1 if [ $? -ne 0 ]; then exit $SMF_EXIT_ERR_FATAL fi } case $1 in start) set_timezone $timezone # Initial timezone cache file at boot time. /usr/sbin/tzreload -I ;; refresh) set_timezone $timezone # Reload Timezone Cache /usr/sbin/tzreload ;; unconfigure) set_timezone UTC # Reset timezone property to its default value /usr/sbin/svccfg -s $SMF_FMRI delcust if [ $? -ne 0 ]; then echo "Failed to unroll administrative customizations for $SMF_FMRI" exit $SMF_EXIT_ERR_FATAL fi /usr/sbin/svcadm refresh $SMF_FMRI # Reload Timezone Cache /usr/sbin/tzreload ;; *) echo "Usage: $0 { start | refresh }" ;; esac exit $SMF_EXIT_OK