Fix lintian warnings.
[carnet-upgrade.git] / src / scripts / debconf_priority
1 #!/bin/bash
2
3 STORE=/var/lib/carnet-upgrade/debconf-priority
4
5 # setiraj debconf na high i spremi stari
6 debconf_priority_preupgrade () {
7   local old_debconf
8
9   old_debconf=$(debconf-show debconf | sed -n '/debconf\/priority: /s///p')
10
11   if [ -n "$old_debconf" ]; then
12     echo "$old_debconf" > $STORE
13   fi
14
15   echo set debconf/priority high | debconf-communicate
16 }
17
18
19 # vrati debconf na staru vrijednost
20 debconf_priority_postupgrade () {
21   local new_debconf
22
23   new_debconf=$(test -f $STORE && cat $STORE)
24
25   if [ -n "$new_debconf" ]; then
26     echo set debconf/priority "$new_debconf" | debconf-communicate
27     rm -f $STORE
28   fi
29 }
30
31 # checkiraj
32 debconf_priority_check () {
33   debconf=$(test -f $STORE && cat $STORE)
34
35   if [ -n "$debconf" ]; then
36     exit 0
37   else
38     exit 1
39   fi
40 }
41
42 case "$1" in
43 set)    debconf_priority_preupgrade
44         ;;
45 reset)  debconf_priority_postupgrade
46         ;;
47 check)  debconf_priority_check
48         ;;
49 *)      echo "Usage: $0 (set|reset|check)"
50         exit 1 
51         ;;
52 esac
53 exit 0
54