File: config

package info (click to toggle)
kstars-data-extra-tycho2 1.1r1-9.1
  • links: PTS
  • area: non-free
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 75,568 kB
  • sloc: sh: 122; makefile: 5
file content (117 lines) | stat: -rw-r--r-- 3,397 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
# kstars-data-extra CONFIG
set -e



# Can we work with debconf?
if [ ! -e /usr/share/debconf/confmodule ] ; then
        # Nothing we can do
        exit 0
fi

#export DEBCONF_DEBUG=developer
. /usr/share/debconf/confmodule

db_version 2.0

log ()
{
   echo config "$1" >&2 > /dev/null
}

log_err ()
{
   echo config "$1" >&2
}

log "$@"

case $1 in
   configure|reconfigure|install) # case $1

      # Check if /etc/kde4 exists (somebody can, even if futile, install this package without kstars or any other KDE stuff)
      if [ -d /etc/kde4 ] ; then

         # Is this the first EVER kstars-data-extra package configured?
         db_get "kstars-data-extra/kstarsrc-previously-exists"
         kstarsrc_previously_exists_RET=$RET
         log "kstarsrc-previously-exists RET $RET"

         if [ "$kstarsrc_previously_exists_RET" = "unset" ] ; then
            #THIS SECTION: IF NEVER HAS BEEN PREVIOUS FILE
   
            # If script reaches this point, it is beacause there have never
            #been a kstars-data-extra package configured in this system.
   
            # Is there a preexistent global kstarsrc config file?
            db_settitle kstars-data-extra/kstarsrc-title || true
            if [ -f /etc/kde4/kstarsrc ] ; then
               log "[ -f /etc/kde4/kstarsrc ] YES"
               db_set "kstars-data-extra/kstarsrc-previously-exists" "previously exists"
               pregunta="kstars-data-extra/kstarsrc-exists"
            else
               log "[ -f /etc/kde4/kstarsrc ] NO"
               db_set "kstars-data-extra/kstarsrc-previously-exists" "does not exist"
               pregunta="kstars-data-extra/kstarsrc-does-not-exist"
            fi # if [ -f /etc/kde4/kstarsrc ]
   
            db_input high $pregunta || true
            db_go || true
            db_get $pregunta
            log "`basename $pregunta` RET $RET" 
   
            if [ "$RET" = "backup and create new" ] ; then
               # Backup now
               cp /etc/kde4/kstarsrc /etc/kde4/kstarsrc.backup.`date +%Y-%m-%dT%H:%M:%S`
            fi
   
            if [ "$RET" = "true" -o "$RET" = "backup and create new" -o "$RET" = "delete and create new" ] ; then
               # Create new kstarsrc
               db_settitle kstars-data-extra/disable-downloads-title || true
               db_input high kstars-data-extra/disable-downloads || true
               db_go || true
               db_get kstars-data-extra/disable-downloads
               log "disable-downloads RET $RET"











            fi # if [ "$RET" = "true" -o "$RET" = "backup and create new" -o "$RET" = "delete and create new" ]
   
            db_stop || true
            exit 0
   
         else # ! if [ "$kstarsrc_previously_exists_RET" = "unset" ]
            #THIS SECTION: IF THERE HAS BEEN A PREVIOUS CONFIGURATION
   
            # If script reaches this point, it is because a previous
            #kstars-data-extra package was configured. We will rely on its
            #configuration and do nothing.
   
            # TODO Add here a low-p question about if you want to reconfigure
   
            db_stop || true
            exit 0
   
         fi # if [ "$kstarsrc_previously_exists_RET" = "unset" ]
   fi #if [ -f /etc/kde4 ]
   ;; # configure|reconfigure|install)
   




   *) #case $1
      log_err "config called with unknown argument $1"
      exit 1
   ;; # *)

esac