File: sssd.preinst

package info (click to toggle)
sssd 1.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 13,628 kB
  • sloc: ansic: 99,910; xml: 21,353; sh: 12,272; python: 3,465; makefile: 1,492; sed: 16
file content (57 lines) | stat: -rw-r--r-- 1,778 bytes parent folder | download
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
#!/bin/sh

set -e

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

    [ -e "$CONFFILE" ] || return 0

    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
    local 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 ..."
        mv -f "$CONFFILE" "$CONFFILE".dpkg-del
    fi
}

disable_profile() {
    APP_CONFFILE="/etc/apparmor.d/usr.sbin.sssd"
    APP_DISABLE="/etc/apparmor.d/disable/usr.sbin.sssd"
    # Create a symlink to the yet-to-be-unpacked profile
    if [ ! -e "$APP_CONFFILE" ]; then
        mkdir -p `dirname $APP_DISABLE` 2>/dev/null || true
        ln -sf $APP_CONFFILE $APP_DISABLE
    fi
}

case "$1" in
install)
    # Disable AppArmor profile on install
    disable_profile
    ;;
upgrade)
    if dpkg --compare-versions "$2" le "1.0.5-1"; then
        rm_conffile sssd "/etc/sssd/sssd.api.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-proxy.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-simple.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-ipa.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-local.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-krb5.conf"
        rm_conffile sssd "/etc/sssd/sssd.api.d/sssd-ldap.conf"
    fi
    if dpkg --compare-versions "$2" lt "1.8.4-1"; then
        disable_profile
    fi
    ;;
esac

#DEBHELPER#