3 # set some variables to make the thing a bit more readable...
8 temp_file
=$1.wmaker-tmp
11 if [ -e ${real_file} ] ; then
12 mv ${real_file} ${temp_file}
14 dpkg-divert
--remove --rename --quiet --package wmaker \
15 --divert ${diversion} ${real_file}
16 if [ -e ${temp_file} ] ; then
17 mv ${temp_file} ${real_file}
21 # asclock's location and its diversion
23 asclock
=/usr
/X11R
6/bin
/asclock
24 asclock_divert_to
=/usr
/X11R
6/bin
/asclock.afterstep
26 # asclock's manpage and its diversions
28 asclock_man
=/usr
/X11R
6/man
/man
1/asclock
.1x.gz
29 asclock_man_divert_to
=/usr
/X11R
6/man
/man
1/asclock.afterstep
.1x.gz
30 old_asclock_man_divert_to
=/usr
/X11R
6/man
/man
1/asclock
.1x.afterstep.gz
32 # are the diversions present?
34 asclock_diversion
=$
(dpkg-divert
--list |
grep 'asclock .*by wmaker')
35 asclock_man_diversion
=$
(dpkg-divert
--list |
grep 'asclock\.afterstep\.1x.*by wmaker')
36 old_man_diversion
=$
(dpkg-divert
--list |
grep 'asclock\.1x\.afterstep.*by wmaker')
38 # ... and set a safety net in case something goes really wrong
44 if [ "$old_man_diversion" ] ; then
45 echo "Removing really old diversion of asclock manpage by wmaker..."
46 remove_diversion
${asclock_man} ${old_asclock_man_divert_to}
49 if [ "$asclock_diversion" ] ; then
50 echo "Removing diversion of asclock to asclock.afterstep..."
51 remove_diversion
${asclock} ${asclock_divert_to}
54 if [ "$asclock_man_diversion" ] ; then
55 echo "Removing diversion of asclock.1x to asclock.afterstep.1x..."
56 remove_diversion
${asclock_man} ${asclock_man_divert_to}
62 # the postrm has failed; preinst is only called like this after
63 # a failed upgrade and the current postrm also fails. Now,
64 # in what situation does this happen? Force non-zero exit code.