File: python3-notebook.postinst

package info (click to toggle)
jupyter-notebook 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,444 kB
  • sloc: javascript: 23,377; python: 15,064; makefile: 252; sh: 66
file content (59 lines) | stat: -rw-r--r-- 2,223 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
#!/bin/sh
# postinst script for python3-notebook
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
        # as of ipywidgets 6.0.0-6 and notebook 6.0.0-2, we stop using a merged
        # config file and each nbextension is responsible for dropping a separate config
        # this is meant to be equivalent to rm_conffile for a non-conffile; we delete
        # the files if they hash to the equivalent of empty-json-object or the json
        # object created by jupyter-nbextension-jupyter-js-widgets, with the extension
        # either enabled or disabled
        if dpkg --compare-versions "$2" le "6.0.0-1"; then
            for x in common edit notebook terminal tree; do
                fname="/etc/jupyter/nbconfig/$x.json"
                if [ -e "$fname" ]; then
                    fmd5="$(md5sum "$fname" | sed -e 's/ .*//')"
                    if [ "$fmd5" = "8f9c6830aaca10fd53c2490388a41489" ] || [ "$fmd5" = "8a80554c91d9fca8acb82f023de02f11" ] || [ "$fmd5" = "2f2015c4f3567af9d0410ec550dde91e" ]; then
                        echo "python3-notebook: removing obsolete jupyter config $fname"
                        rm -f "$fname"
                    else
                        echo "python3-notebook: jupyter config $fname was externally modified, not deleting"
                    fi
                fi
            done
        fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

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

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

#DEBHELPER#

exit 0