This file is indexed.

preinst is in freeradius 2.1.12+dfsg-1.2ubuntu8.2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
#! /bin/sh

set -e

# Remove a no-longer used conffile; taken from http://wiki.debian.org/DpkgConffileHandling
rm_conffile() {
    CONFFILE="$1"

    if [ -e "$CONFFILE" ]; then
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
        if [ "$md5sum" != "$old_md5sum" ]; then
            echo "Obsolete conffile $CONFFILE has been modified by you."
            echo "Saving as $CONFFILE.dpkg-bak ..."
            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
        else
            echo "Removing obsolete conffile $CONFFILE ..."
            rm -f "$CONFFILE"
        fi
    fi
}

case "$1" in
  upgrade)
    # Before 1.1.5, upstream shipped /etc/freeradius/otppasswd.sample
    # and we install it (I still don't know why).  In 1.1.5 they
    # got rid of it so handle removing the conffile.
    if dpkg --compare-versions "$2" lt "1.1.5"; then
        rm_conffile "/etc/freeradius/otppasswd.sample"
    fi

    # There are huge changes between 1.x and 2.x (we cleaned things up
    # a lot), so sort it out here
    if dpkg --compare-versions "$2" lt "2.0.0"; then

        rm_conffile "/etc/freeradius/certs/demoCA/cacert.pem"
        rm_conffile "/etc/freeradius/certs/demoCA/index.txt"
        rm_conffile "/etc/freeradius/certs/demoCA/index.txt.old"
        rm_conffile "/etc/freeradius/certs/demoCA/serial"
        rm_conffile "/etc/freeradius/certs/demoCA/serial.old"

        test -d /etc/freeradius/certs/demoCA && rmdir --ignore-fail-on-non-empty /etc/freeradius/certs/demoCA/

        rm_conffile "/etc/freeradius/certs/cert-clt.der"
        rm_conffile "/etc/freeradius/certs/cert-clt.p12"
        rm_conffile "/etc/freeradius/certs/cert-clt.pem"
        rm_conffile "/etc/freeradius/certs/cert-srv.der"
        rm_conffile "/etc/freeradius/certs/cert-srv.p12"
        rm_conffile "/etc/freeradius/certs/cert-srv.pem"
        rm_conffile "/etc/freeradius/certs/dh"
        rm_conffile "/etc/freeradius/certs/newcert.pem"
        rm_conffile "/etc/freeradius/certs/newreq.pem"
        rm_conffile "/etc/freeradius/certs/random"
        rm_conffile "/etc/freeradius/certs/README"
        rm_conffile "/etc/freeradius/certs/root.der"
        rm_conffile "/etc/freeradius/certs/root.p12"
        rm_conffile "/etc/freeradius/certs/root.pem"

        rm_conffile "/etc/freeradius/sqlippool.conf"
        rm_conffile "/etc/freeradius/mssql.conf"
        rm_conffile "/etc/freeradius/postgresql.conf"

        rm_conffile "/etc/freeradius/naslist"
        rm_conffile "/etc/freeradius/naspasswd"
        rm_conffile "/etc/freeradius/realms"

    fi

    # old files shipped by this package previously, but dropped upstream
    if dpkg --compare-versions "$2" lt "2.1.8"; then
        for file in \
          /etc/freeradius/otp.conf \
          /etc/freeradius/snmp.conf
        do 

          rm_conffile "$file"

          # must get rid of the overrides otherwise they corrupt the database
          if dpkg-statoverride --list $file >/dev/null; then
            dpkg-statoverride --remove $file
          fi

        done
    fi

esac



exit 0