/
display-manager-dpkg-post-invoke
executable file
·67 lines (55 loc) · 2.34 KB
/
display-manager-dpkg-post-invoke
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
#!/bin/bash
## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
#echo "$BASH_SOURCE INFO: Begin..."
## Technical comment:
## rads has a feature, which determines whether the display manager (dm)
## gets autostarted based on available RAM and other configuration options.
##
## This is required, because when a display manager gets upgraded by
## apt-get/dpkg, its postinst script by default runs
## "update-rc.d $dm defaults", unless $dm which /etc/init.d/$dm is not
## executable, which clashes with this feature. Making /etc/init.d/$dm not
## executable with a chroot-scripts-post.d script is no option either,
## because this would break "sudo service $dm restart" for the user.
##
## - hook to call this file: /etc/apt/apt.conf.d/90rads
## - configuration file: /etc/rads.d/30_default.conf
if [ "$(id -u)" != "0" ]; then
echo "$BASH_SOURCE ERROR: This must be run as root (sudo)!"
exit 1
else
true "$BASH_SOURCE INFO: Script running as root."
fi
shopt -s nullglob
for i in /etc/rads.d/*.conf /rw/config/rads.d/*.conf; do
bash_n_exit_code="0"
bash -n "$i" || { bash_n_exit_code="$?" ; true; };
if [ ! "$bash_n_exit_code" = "0" ]; then
echo "$BASH_SOURCE ERROR: invalid rads config file $i." >&2
exit 1
fi
source "$i"
done
[ -n "$rads_autostart_decision_feature" ] || rads_autostart_decision_feature="1"
if [ ! "$rads_autostart_decision_feature" = "1" ]; then
true "$BASH_SOURCE INFO: rads_autostart_decision_feature is not set to 1, doing nothing."
exit 0
fi
if [ "$rads_disable_rc_d_remove" = "1" ]; then
true "$BASH_SOURCE INFO: rads_disable_rc_d_remove is set to 1. Do nothing. Exit."
exit 0
fi
#echo "$BASH_SOURCE INFO: Deactivating display manager (kdm, gdm, gdm3, lightdm, slim, wdm, xdm, nodm, sddm) /etc/init.d/ autostart mechanism, since this is handled by rads..."
update-rc.d kdm remove >/dev/null 2>/dev/null
update-rc.d gdm remove >/dev/null 2>/dev/null
update-rc.d gdm3 remove >/dev/null 2>/dev/null
update-rc.d lightdm remove >/dev/null 2>/dev/null
update-rc.d slim remove >/dev/null 2>/dev/null
update-rc.d wdm remove >/dev/null 2>/dev/null
update-rc.d xdm remove >/dev/null 2>/dev/null
update-rc.d nodm remove >/dev/null 2>/dev/null
update-rc.d sddm remove >/dev/null 2>/dev/null
#echo "$BASH_SOURCE INFO: Done."
exit 0