[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r1345 - glibc-package/trunk/debian/debhelper.in



Author: aurel32
Date: 2006-04-08 13:18:05 +0000 (Sat, 08 Apr 2006)
New Revision: 1345

Added:
   glibc-package/trunk/debian/debhelper.in/tzdata.install
   glibc-package/trunk/debian/debhelper.in/tzdata.links
   glibc-package/trunk/debian/debhelper.in/tzdata.postinst
   glibc-package/trunk/debian/debhelper.in/tzdata.preinst
Log:
Add missing tzdata debhelper files



Added: glibc-package/trunk/debian/debhelper.in/tzdata.install
===================================================================
--- glibc-package/trunk/debian/debhelper.in/tzdata.install	2006-04-08 12:07:41 UTC (rev 1344)
+++ glibc-package/trunk/debian/debhelper.in/tzdata.install	2006-04-08 13:18:05 UTC (rev 1345)
@@ -0,0 +1 @@
+debian/tmp-libc/usr/share/zoneinfo/* usr/share/zoneinfo

Added: glibc-package/trunk/debian/debhelper.in/tzdata.links
===================================================================
--- glibc-package/trunk/debian/debhelper.in/tzdata.links	2006-04-08 12:07:41 UTC (rev 1344)
+++ glibc-package/trunk/debian/debhelper.in/tzdata.links	2006-04-08 13:18:05 UTC (rev 1345)
@@ -0,0 +1 @@
+etc/localtime usr/share/zoneinfo/localtime 

Added: glibc-package/trunk/debian/debhelper.in/tzdata.postinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/tzdata.postinst	2006-04-08 12:07:41 UTC (rev 1344)
+++ glibc-package/trunk/debian/debhelper.in/tzdata.postinst	2006-04-08 13:18:05 UTC (rev 1345)
@@ -0,0 +1,93 @@
+#!/bin/bash
+set -e
+export LC_ALL=C
+
+type=$1
+preversion=$2
+
+zone_banner() {
+    TZBase=$(LC_ALL=C TZ=UTC0 date)
+    UTdate=$(TZ=UTC0 date -d "$TZBase")
+    TZdate=$(TZ="$timezone" date -d "$TZBase")
+    extra_info="
+Local time is now:      $TZdate.
+Universal Time is now:  $UTdate."
+    echo "Current default timezone: '$timezone'.$extra_info"
+    echo "Run 'tzconfig' if you wish to change it."
+}
+
+set_timezone() {
+    frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
+    if [ "$frontend" = noninteractive ]; then
+        echo "Non-interactive mode, setting timezone to UTC.  Run tzconfig to change."
+        echo "UTC" >/etc/timezone
+        ln -sf /usr/share/zoneinfo/UTC /etc/localtime
+    else
+        echo "Running 'tzconfig' to set this system's timezone."
+        /usr/sbin/tzconfig
+    fi
+}
+
+realpath()
+{
+    fname=${1%/} # strips trailing '/'
+    while [ -L "$fname" ]; do
+	oldfname="$fname"
+	fname="$(command ls -l $fname)"
+	fname="${fname#*\> }"
+	if [ "$fname" = . ] ; then
+	    fname="$(dirname $oldfname)"
+	elif echo $fname | grep -vq '^/' - ; then
+	    fname="$(dirname $oldfname)/$fname"
+	fi
+    done
+    pushd $(dirname $fname) > /dev/null
+    fname=$(pwd -P)/$(basename $fname)
+    popd > /dev/null
+    echo $fname
+}
+
+if [ "$type" = "configure" ]
+then
+    if [ -f /etc/timezone ]; then
+	timezone=$(cat /etc/timezone)
+    else
+	timezone=Factory
+    fi
+    if [ "$timezone" = Factory ]; then
+	if [ -L /etc/localtime ]; then
+	    localtime_link=$(realpath /etc/localtime)
+	    if [ -f "$localtime_link" ]; then
+		link_not_dangling=true
+	    fi
+	    if [ "$link_not_dangling" = true ]; then
+		timezone=$(echo $localtime_link | sed 's%^/usr/share/zoneinfo/%%')
+	    fi
+	fi
+    fi
+    if [ -f /usr/share/zoneinfo/$timezone ] && [ "$timezone" != Factory ]
+    then
+#	zic -l $timezone
+	rm -f /etc/localtime && \
+	ln -sf /usr/share/zoneinfo/$timezone /etc/localtime
+	zone_banner
+    # Handle problem caused by lame old tzconfig.
+    elif [ "$timezone" = "US/Pacific-New" ]
+    then
+	echo "US/Pacific" > /etc/timezone
+#	zic -l US/Pacific
+	rm -f /etc/localtime && \
+	ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime
+	zone_banner
+    else
+	set_timezone
+    fi
+    if [ "$(date +%Z)" = "/etc/localtime" ]; then
+	set_timezone
+    fi
+fi
+
+
+#DEBHELPER#
+
+exit 0

Added: glibc-package/trunk/debian/debhelper.in/tzdata.preinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/tzdata.preinst	2006-04-08 12:07:41 UTC (rev 1344)
+++ glibc-package/trunk/debian/debhelper.in/tzdata.preinst	2006-04-08 13:18:05 UTC (rev 1345)
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e
+export LC_ALL=C
+
+if [ "$1" = upgrade ]
+then
+    if [ -f /var/lib/dpkg/info/timezone.postrm ]; then
+	rm -f /var/lib/dpkg/info/timezone.postrm
+    fi
+    if [ -f /var/lib/dpkg/info/timezones.postrm ]; then
+	rm -f /var/lib/dpkg/info/timezones.postrm
+    fi
+    if dpkg --compare-versions "$2" lt 2.1.3-8; then
+	if [ -s /etc/timezone ]; then
+	    cp -a /etc/timezone /etc/timezone.save
+	fi
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0



Reply to: