-
Notifications
You must be signed in to change notification settings - Fork 1
/
startup.sh
executable file
·178 lines (155 loc) · 3.92 KB
/
startup.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Use the first x server
export DISPLAY=:1
# Check if secrets required for private services have been cloned
SECRETS_EXIST=$(test -d $HOME/.ssh-private; echo $?)
# Start the tmux server for daemonised services
tmux start-server
# Start the dbus message bus
export $(dbus-launch)
# Export the dbus environment to the global tmux environment
tmux set-environment -g DBUS_SESSION_BUS_ADDRESS $DBUS_SESSION_BUS_ADDRESS
tmux set-environment -g DBUS_SESSION_BUS_PID $DBUS_SESSION_BUS_PID
if [ -w /dev/tty3 ]; then
# If a physical display is attached to the container, start a hardware x server
tmux new-session \
-d \
-s x11 \
xinit -- $DISPLAY vt0$DESKTOP_ENVIRONMENT_TTY \
2>/dev/null
else
# Update i3 config to use web browser compatible keybindings
$HOME/.config/i3/set-vnc-config.sh
# If operating in a headless server environment, start a vnc x server
tmux new-session \
-d \
-s vnc-server \
vncserver $DISPLAY \
-autokill \
-fg \
-geometry 1920x1080 \
-localhost true \
-SecurityTypes none \
-xstartup /usr/bin/i3
fi
# Wait until x server is running before proceeding
until xset -q >/dev/null; do sleep 1; done
# Start autorandr
tmux new-session \
-d \
-s autorandr \
$HOME/.config/scripts/monitor-hotplug.sh \
2>/dev/null
# Start desktop environment shell
tmux new-session \
-d \
-s desktop-environment-shell \
zsh --login \
2>/dev/null
# Start dnsmasq
tmux new-session \
-d \
-s dnsmasq \
sudo dnsmasq \
--addn-hosts=/home/$USER/.config/dnsmasq/hostnames.txt \
--log-queries \
--no-daemon \
--no-resolv \
--strict-order \
--server 1.0.0.1 \
--server 1.1.1.1 \
2>/dev/null
# Start dotfiles startup update
tmux new-session \
-d \
-s dotfiles-startup-update \
zsh -c "vcsh list | xargs -I@ -P0 vcsh @ pull; $HOME/.config/scripts/startup.sh" \
2>/dev/null
# Start jobber
tmux new-session \
-d \
-s jobber \
sudo $(find /usr/lib -name jobbermaster) \
2>/dev/null
# Start mouse disabler
true || tmux new-session \
-d \
-s disable-mouse \
$HOME/.config/scripts/disable-mouse.sh \
2>/dev/null
# Start openvpn
if [ "$SECRETS_EXIST" -eq 0 ] && false; then
tmux new-session \
-d \
-s openvpn \
sudo openvpn \
--config $HOME/.config/openvpn/default.ovpn \
--auth-user-pass $HOME/.config/openvpn/credentials \
--dev-node $HOME/.config/openvpn/tun \
2>/dev/null
fi
# Start pulseaudio
tmux new-session \
-d \
-s pulseaudio \
pulseaudio -D \
2>/dev/null
# Start redshift
tmux new-session \
-d \
-s redshift \
redshift -l 33.8688:151.2093 -t 6500:3600 \
2>/dev/null
# Start rescuetime
if [ "$SECRETS_EXIST" -eq 0 ]; then
tmux new-session \
-d \
-s rescuetime \
rescuetime \
2>/dev/null
fi
# Start transmission
tmux new-session \
-d \
-s transmission \
transmission-daemon \
--bind-address-ipv4 localhost \
--config-dir $HOME/.config/transmission \
--download-dir $HOME/torrents \
--foreground \
--no-auth \
--rpc-bind-address localhost \
--watch-dir $HOME/torrents/.watch \
2>/dev/null
# Start unclutter
tmux new-session \
-d \
-s unclutter \
unclutter \
--ignore-scrolling \
--not kdenlive \
--timeout 0.15 \
2>/dev/null
# If ssh-agent isn't running but the ssh socket exists, remove it otherwise ssh-agent will fail to start
SSH_AGENT_EXISTS=$(ps aux | grep -v grep | grep -q $SSH_AUTH_SOCK; echo $?)
SSH_SOCKET_EXISTS=$(test -S $SSH_AUTH_SOCK; echo $?)
if [ "$SSH_AGENT_EXISTS" -eq 1 ] && [ "$SSH_SOCKET_EXISTS" -eq 0 ]; then
rm $SSH_AUTH_SOCK 2>/dev/null
fi
# Start the ssh-agent
tmux new-session \
-d \
-s ssh-agent \
ssh-agent -D -a $SSH_AUTH_SOCK \
2>/dev/null
# Start vnc client
tmux new-session \
-d \
-s vnc-client \
/opt/noVNC/utils/launch.sh --listen 8080 --vnc localhost:5901 \
2>/dev/null
# Take ownership of docker volumes
tmux new-session \
-d \
-s take-ownership \
/opt/desktop-environment/docker/scripts/take-ownership.sh \
2>/dev/null