Call unconfigure_environment a bit earlier during postrm
Same comment as in previous commit: this does not really matter, as
kali-defaults is not supposed to be removed anyway. This change is
mainly to ease side by side comparison with the postinst script:
we add a function (as it is in postinst), and we make sure to do
things in reverse order, compared to what was done in postinst.
Arnaud Rebillout
3 years ago
35 | 35 | --remove $file |
36 | 36 | } |
37 | 37 | |
38 | unconfigure_environment() { | |
39 | # Cleanup change to /etc/environment | |
40 | if grep -q ^PATH= /etc/environment; then | |
41 | echo "Dropping PATH override from /etc/environment" | |
42 | sed -i -e '/^PATH=/d' /etc/environment | |
43 | fi | |
44 | } | |
45 | ||
38 | 46 | case "$1" in |
39 | 47 | remove) |
40 | 48 | echo "Unconfiguring root account" |
45 | 53 | rm -v /root/.zshrc |
46 | 54 | fi |
47 | 55 | |
56 | unconfigure_environment | |
57 | ||
48 | 58 | for file in $FILES_TO_DIVERT; do |
49 | 59 | rm -f $file |
50 | 60 | drop_diversion $file $file.original |
51 | 61 | done |
52 | # Cleanup change to /etc/environment | |
53 | if grep -q ^PATH= /etc/environment; then | |
54 | echo "Drop PATH override from /etc/environment" | |
55 | sed -i -e '/^PATH=/d' /etc/environment | |
56 | fi | |
57 | 62 | ;; |
58 | 63 | |
59 | 64 | purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |