File: postinst

package info (click to toggle)
xwhois 0.4.2-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 416 kB
  • ctags: 124
  • sloc: sh: 1,913; ansic: 1,646; makefile: 104
file content (36 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/bash

set -e

test -x /usr/bin/update-menus && /usr/bin/update-menus || /bin/true

conf=/etc/X11/xwhois/servers
if [ "$1" = "configure" -a -n "$2" ] && dpkg --compare-versions $2 lt 0.2.9-1 \
    && grep -q '^# International NIC' $conf
then
    echo -n "Converting $conf to new format... "
    echo -n > $conf.new
    while read line
    do
	case $line in
	\#*)
	    if [ -n "$comment" ]
	    then
		echo $comment >> $conf.new
	    fi
	    comment="$line"
	    ;;
	*)
	    if [ -n "$comment" ]
	    then
		echo "$line $comment" >> $conf.new
	    else
		echo "$line" >> $conf.new
	    fi
	    comment=''
	    ;;
	esac
    done < $conf
    mv -f $conf.new $conf
    echo "done"
fi