Implement noautomount feature as an XDG autostart script.
Raphaël Hertzog
6 years ago
0 | |
# This file implements the "noautomount" boot option used by Kali's
|
1 | |
# forensic mode to avoid auto-mounting disks which are detected
|
2 | |
# dynamically by udisks
|
3 | |
|
4 | |
# The downside of this approach is that the setting is overwritten every
|
5 | |
# time that you login in the graphical interface. If you're fed up by this
|
6 | |
# and want to keep automount always disabled, just edit this file and
|
7 | |
# comment everything.
|
8 | |
|
9 | |
if [ -r /proc/cmdline ] && [ -x "$(which gsettings)" ]; then
|
10 | |
if grep -q -E "\bnoautomount\b" /proc/cmdline 2>/dev/null; then
|
11 | |
gsettings set org.gnome.desktop.media-handling automount false
|
12 | |
else
|
13 | |
gsettings set org.gnome.desktop.media-handling automount true
|
14 | |
fi
|
15 | |
fi
|
0 | 0 |
kali-defaults (2017.2.1) UNRELEASED; urgency=medium
|
1 | 1 |
|
2 | 2 |
* Drop no longer needed work-around (/etc/X11/Xsession.d/52kali_fix_lang).
|
|
3 |
* Implement noautomount feature as an XDG autostart script.
|
3 | 4 |
|
4 | 5 |
-- Raphaël Hertzog <[email protected]> Tue, 29 Aug 2017 10:48:22 +0200
|
5 | 6 |
|
0 | |
52kali_noautomount etc/X11/Xsession.d/
|
1 | 0 |
.bashrc usr/share/kali-defaults/
|
2 | 1 |
browser/kali.js etc/firefox-esr/
|
3 | 2 |
browser/distribution.ini usr/share/firefox-esr/distribution/
|
|
8 | 7 |
dconf/kali-tweaks etc/dconf/db/local.d/
|
9 | 8 |
postgresql/kali_postgresql.conf lib/systemd/system/[email protected]/
|
10 | 9 |
postgresql/postgresql_reduce_shared_buffers usr/share/kali-defaults/
|
|
10 |
noautomount/setup-noautomount usr/share/kali-defaults/
|
|
11 |
noautomount/kali-noautomount.desktop etc/xdg/autostart/
|
23 | 23 |
done
|
24 | 24 |
fi
|
25 | 25 |
|
|
26 |
if dpkg --compare-versions "$2" lt-nl 2017.2.1; then
|
|
27 |
rm -f /etc/X11/Xsession.d/52kali_fix_lang
|
|
28 |
rm -f /etc/X11/Xsession.d/52kali_noautomount
|
|
29 |
fi
|
|
30 |
|
26 | 31 |
for file in /etc/skel/.bashrc /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
|
27 | 32 |
do
|
28 | 33 |
orig_file="/usr/share/kali-defaults/$(basename $file)"
|
|
0 |
[Desktop Entry]
|
|
1 |
Type=Application
|
|
2 |
Name=Kali script to disable automount
|
|
3 |
Exec=/usr/share/kali-defaults/setup-noautomount
|
|
4 |
NoDisplay=true
|
|
5 |
X-GNOME-Autostart-Phase=Initialization
|
|
6 |
X-KDE-autostart-phase=1
|
|
0 |
#!/bin/sh
|
|
1 |
|
|
2 |
# This file implements the "noautomount" boot option used by Kali's
|
|
3 |
# forensic mode to avoid auto-mounting disks which are detected
|
|
4 |
# dynamically by udisks
|
|
5 |
|
|
6 |
# It is executed through /etc/xdg/autostart/kali-noautomount.desktop
|
|
7 |
|
|
8 |
# The downside of this approach is that the setting is overwritten every
|
|
9 |
# time that you login in the graphical interface. If you're fed up by this
|
|
10 |
# and want to keep automount always disabled, just edit this file and
|
|
11 |
# comment everything.
|
|
12 |
|
|
13 |
if [ ! -r /proc/cmdline ]; then
|
|
14 |
echo "WARNING: unable to read /proc/cmdline and detect noautomount option" >&2
|
|
15 |
exit 0
|
|
16 |
fi
|
|
17 |
|
|
18 |
if [ ! -x "$(which gsettings 2>/dev/null)" ]; then
|
|
19 |
echo "WARNING: unable to find gsettings needed to disable automount" >&2
|
|
20 |
exit 0
|
|
21 |
fi
|
|
22 |
|
|
23 |
if grep -q -E "\bnoautomount\b" /proc/cmdline; then
|
|
24 |
echo "INFO: disabling automount as requested by kernel command line" >&2
|
|
25 |
gsettings set org.gnome.desktop.media-handling automount false
|
|
26 |
else
|
|
27 |
gsettings set org.gnome.desktop.media-handling automount true
|
|
28 |
fi
|