postplug/postplug.d/15localtime

40 lines
864 B
Plaintext
Raw Normal View History

2011-04-27 19:57:03 +02:00
#!/bin/bash
# localtime - localtime plugin for postplug
# Copyright (c) 2004-2013 by Silvan Calarco <silvan.calarco@qilinux.it>
2011-04-27 19:57:03 +02:00
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
if [ $UID != 0 ]; then
echo "$0: must be superuser." >&2
exit 1
fi
[ -e /etc/localtime ] && exit 0
2011-04-27 19:57:03 +02:00
me="localtime"
. /etc/postplug/postplug.defs
LOCALTIMEFILE=/etc/localtime
ZONEINFODIR=/usr/share/zoneinfo
logmsg "$me" $"creating /etc/timezone and /etc/localtime files..."
# FIXME
case "$LANG" in
es_*)
echo "Europe/Madrid" > /etc/timezone
ln -sf $ZONEINFODIR/Europe/Madrid /etc/localtime
;;
2011-04-27 19:57:03 +02:00
it_*)
echo "Europe/Rome" > /etc/timezone
ln -sf $ZONEINFODIR/Europe/Rome /etc/localtime
2011-04-27 19:57:03 +02:00
;;
*) echo "GMT" > /etc/timezone
ln -sf $ZONEINFODIR/GMT /etc/localtime
2011-04-27 19:57:03 +02:00
;;
esac
[ -x /etc/init.d/setclock ] && service setclock start &>/dev/null
exit 0