This file is indexed.

postrm is in nvidia-prime 0.6.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
 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
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
# postrm script for nvidia-prime
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <overwriter>
#          <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

xorg_conf="/etc/X11/xorg.conf"
now=$(date +"%m%d%Y")
lightdm_orig_conf=/etc/lightdm/lightdm.conf
host_arch_main=x86_64-linux-gnu
host_arch_other=i386-linux-gnu

remove_hybrid_script () {
    # Precise only!
    if [ -s "$lightdm_orig_conf" ]; then
        # Get the file
        lightdm_orig="$(cat $lightdm_orig_conf)"
        echo "$lightdm_orig" | \
        sed "/.*display-setup-script.*/d" \
        > "$lightdm_orig_conf"

        lightdm_orig="$(cat $lightdm_orig_conf)"
        echo "$lightdm_orig" | \
        sed "/.*display-stopped-script.*/d" \
        > "$lightdm_orig_conf"
    fi
}

get_current_alternative() {
    master_link="$1"
    value=""
    alternatives="$(update-alternatives --query "$master_link" 2>/dev/null || true)"
    if [ -n "$alternatives" ]; then
        #status=$(echo "$alternatives" | grep "Status:" | sed "s/Status: //g")
        value="$(echo "$alternatives" | grep "Value:" | sed "s/Value: //g")"
    fi
    echo "$value"
}

set_alternative() {
    master_link="$1"
    path="$2"
    update-alternatives --set "$master_link" "$path" || true
}


case "$1" in
    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
        # Remove the xorg.conf
        if [ -f $xorg_conf ]; then
            mv $xorg_conf $xorg_conf.$now
        fi

        if [ ! "$1" = "upgrade" ]; then
            if [ "$os_release" = "precise" ]; then
                # Remove the display-setup-script line
                remove_hybrid_script
            fi

            # Remove the settings
            rm -f /etc/prime-discrete

            # Restore the alternatives to a non prime
            # configuration, if possible
            os_release="$(lsb_release -cs)"
            main_arch=""$host_arch_main"_gl_conf"
            other_arch=""$host_arch_other"_gl_conf"
            main_alternative="$(get_current_alternative "$main_arch")"
            other_alternative="$(get_current_alternative "$other_arch")"

            if echo "$main_alternative" | grep "prime"; then
                if [ "$os_release" = "precise" ]; then
                    # In Precise multiple drivers can be installed at the
                    # same time, so we simply switch back to the non-prime
                    # alternative provided by the same driver package
                    fallback="$(echo "$main_alternative" | sed "s/-prime//g")"
                    set_alternative "$main_arch" "$fallback"
                else
                    # Drivers cannot be installed all at the
                    # same time, therefore it is recommended
                    # that we set the alternative back to
                    # automatic mode.
                    update-alternatives --auto "$main_arch" || true
                fi
            fi
            if echo "$other_alternative" | grep "prime"; then
                if [ "$os_release" = "precise" ]; then
                    # In Precise multiple drivers can be installed at the
                    # same time, so we simply switch back to the non-prime
                    # alternative provided by the same driver package
                    fallback="$(echo "$other_alternative" | sed "s/-prime//g")"
                    set_alternative "$other_arch" "$fallback"
                else
                    # Drivers cannot be installed all at the
                    # same time, therefore it is recommended
                    # that we set the alternative back to
                    # automatic mode.
                    update-alternatives --auto "$other_arch" || true
                fi
            fi
            LDCONFIG_NOTRIGGER=y ldconfig
        fi
    ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0