-
Notifications
You must be signed in to change notification settings - Fork 1
/
secondStage.sh
executable file
·81 lines (65 loc) · 2.6 KB
/
secondStage.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
set -e
sources_dir=/etc/apt/sources.list
user=$1
home_user=$(grep "$user" /etc/passwd|cut -d: -f 6)
local_bin_dir=$home_user/.local/bin
backuper_dir=$(pwd)
apt update && apt -y install git firefox-esr calibre emacs keepassxc thunderbird tilix virt-manager \
ranger taskwarrior rsync cmake iptables iptables-persistent grep less nano \
vim neovim zsh mercurial podman systemd-resolved zip dconf-editor r-base r-base-dev maxima wxmaxima thermald
cat <<END
+----------------------------------------------------------------+
Basic programs installed.
+----------------------------------------------------------------+
END
groupadd no-internet
usermod -aG no-internet $user
mkdir -p $local_bin_dir
cp $backuper_dir/config_files/no-internet $local_bin_dir
chown $user:$user $local_bin_dir/no-internet
chmod 755 $local_bin_dir/no-internet
iptables -I OUTPUT 1 -m owner --gid-owner no-internet -j DROP
iptables-save > /etc/iptables/rules.v4
ip6tables-save > /etc/iptables/rules.v6
cat <<END
+----------------------------------------------------------------+
no-internet command ready to use.
+----------------------------------------------------------------+
END
cat $backuper_dir/config_files/resolved.conf >> /etc/systemd/resolved.conf
systemctl enable systemd-resolved
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
systemctl restart systemd-resolved
systemctl restart NetworkManager
cat <<END
+----------------------------------------------------------------+
DNS over TLS with Mullvad ready.
+----------------------------------------------------------------+
END
mkdir -p /etc/docker/
cp $backuper_dir/config_files/daemon.json /etc/docker/daemon.json
chown root:root /etc/docker/daemon.json
cat <<END
+----------------------------------------------------------------+
DNS added to docker daemon.
+----------------------------------------------------------------+
END
$backuper_dir/programs/install_programs.sh $user $home_user
cat <<END
+----------------------------------------------------------------+
Selected additional programs successfully installed.
+----------------------------------------------------------------+
END
$backuper_dir/extensions/install_extensions.sh $user $home_user
cat <<END
+----------------------------------------------------------------+
Selected extensions successfully installed.
+----------------------------------------------------------------+
END
systemctl set-default multi-user.target
cat <<END
+----------------------------------------------------------------+
Gnome autostart disabled.
+----------------------------------------------------------------+
END