aboutsummaryrefslogtreecommitdiffstats
path: root/debian/postinst
blob: 1ba89101e1afe1ba87847caa537b5ac8192ebeb6 (plain) (blame)
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
37
38
#!/bin/sh -e
# 

case "$1" in
  configure)
        update-alternatives --quiet --install /usr/bin/pager pager \
            /usr/bin/w3m 25 \
	    --slave /usr/share/man/man1/pager.1.gz pager.1.gz \
	    /usr/share/man/man1/w3m.1.gz
       update-alternatives --quiet --install /usr/bin/www-browser www-browser \
           /usr/bin/w3m 25 \
	   --slave /usr/share/man/man1/www-browser.1.gz www-browser.1.gz \
	   /usr/share/man/man1/w3m.1.gz
       # upgrade old config file to new config file
       if test -e /etc/w3m/w3mconfig; then
	   mv -f /etc/w3m/w3mconfig /etc/w3m/w3mconfig.dpkg-tmp
	   tmp=$(tempfile -p w3m.subst.)
	   trap "rm -f $tmp" 0 1 2 15
	   while read opt val
	   do
	      val0=$(sed -ne 's/^'$opt'[[:space:]]*//p' /etc/w3m/w3mconfig.dpkg-tmp)
	      if [ "$val0" != "" ] && [ "$val" != "$val0" ]; then
		  echo 's/^'$opt'[[:space:]]*.*/'$opt' '$val0'/' >> $tmp
	      fi
	   done < /etc/w3m/config
	   if test -s $tmp; then
	       mv -f /etc/w3m/config /etc/w3m/config.dpkg-tmp
	       sed -f $tmp /etc/w3m/config.dpkg-tmp > /etc/w3m/config
	       rm -f $tmp
	       rm -f /etc/w3m/config.dpkg-tmp
	   fi
	   rm -f /etc/w3m/w3mconfig /etc/w3m/w3mconfig.dpkg-tmp
       fi
       ;;
  *)
esac

#DEBHELPER#