#! /bin/sh set -e # Source debconf library. . /usr/share/debconf/confmodule # old scripts oldfile=/etc/adjtimex.conf olderfile=/etc/rc.boot/adjtimex # new starting script startfile=/etc/init.d/adjtimex # new configuration file conffile=/etc/default/adjtimex migrate_old_adjtimex_conf() { TICK=10000 FREQ=0 if [ -f $oldfile ]; then TICK=`awk ' BEGIN{tick=10000;} /[ \t]*TICK[ \t]*=[ \t]*"?[0-9]+"?/ { sub(/[ \t]*TICK[ \t]*=[ \t]*"?/,""); tick=$0+0; } END {print tick;} ' $oldfile` FREQ=`awk ' BEGIN{freq=0;} /[ \t]*FREQ[ \t]*=[ \t]*"?[0-9]+"?/ { sub(/[ \t]*FREQ[ \t]*=[ \t]*"?/,""); freq=$0+0; } END {print freq;} ' $oldfile` # echo "parameters from $oldfile: TICK=$TICK FREQ=$FREQ"; elif [ -f $olderfile ]; then TICK=`awk ' BEGIN{tick=10000;} /[ \t]*TICK[ \t]*=[ \t]*"?[0-9]+"?/ { sub(/[ \t]*TICK[ \t]*=[ \t]*"?/,""); tick=$0+0; } END {print tick;} ' $olderfile` FREQ=`awk ' BEGIN{freq=0;} /[ \t]*FREQ[ \t]*=[ \t]*"?[0-9]+"?/ { sub(/[ \t]*FREQ[ \t]*=[ \t]*"?/,""); freq=$0+0; } END {print freq;} ' $olderfile` # echo "parameters from $olderfile: TICK=$TICK FREQ=$FREQ"; fi if [ -f $conffile ]; then # echo "using existing $conffile"; true; elif [ -f $oldfile ] || [ -f $olderfile ]; then [ ! -d /etc/default ] && mkdir /etc/default cat >$conffile < /dev/null db_get adjtimex/compare_rtc if [ "$RET" = "true" ]; then adjtimexconfig fi ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # Automatically added by dh_systemd_enable/13.24.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'adjtimex.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'adjtimex.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'adjtimex.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'adjtimex.service' >/dev/null || true fi fi # End automatically added section