Debian Codegraph @

debian/python3-notebook.postinst

raw
1 #!/bin/sh
2 # postinst script for python3-notebook
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 # * <postinst> `configure' <most-recently-configured-version>
10 # * <old-postinst> `abort-upgrade' <new version>
11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 # <new-version>
13 # * <postinst> `abort-remove'
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 # <failed-install-package> <version> `removing'
16 # <conflicting-package> <version>
17 # for details, see https://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
19
20
21 case "$1" in
22 configure)
23 # as of ipywidgets 6.0.0-6 and notebook 6.0.0-2, we stop using a merged
24 # config file and each nbextension is responsible for dropping a separate config
25 # this is meant to be equivalent to rm_conffile for a non-conffile; we delete
26 # the files if they hash to the equivalent of empty-json-object or the json
27 # object created by jupyter-nbextension-jupyter-js-widgets, with the extension
28 # either enabled or disabled
29 if dpkg --compare-versions "$2" le "6.0.0-1"; then
30 for x in common edit notebook terminal tree; do
31 fname="/etc/jupyter/nbconfig/$x.json"
32 if [ -e "$fname" ]; then
33 fmd5="$(md5sum "$fname" | sed -e 's/ .*//')"
34 if [ "$fmd5" = "8f9c6830aaca10fd53c2490388a41489" ] || [ "$fmd5" = "8a80554c91d9fca8acb82f023de02f11" ] || [ "$fmd5" = "2f2015c4f3567af9d0410ec550dde91e" ]; then
35 echo "python3-notebook: removing obsolete jupyter config $fname"
36 rm -f "$fname"
37 else
38 echo "python3-notebook: jupyter config $fname was externally modified, not deleting"
39 fi
40 fi
41 done
42 fi
43 ;;
44
45 abort-upgrade|abort-remove|abort-deconfigure)
46 ;;
47
48 *)
49 echo "postinst called with unknown argument \`$1'" >&2
50 exit 1
51 ;;
52 esac
53
54 # dh_installdeb will replace this with shell code automatically
55 # generated by other debhelper scripts.
56
57 #DEBHELPER#
58
59 exit 0