forked from mahalia-dependencies/mahalia-dependencies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmahalia-dependencies.postinst
executable file
·249 lines (236 loc) · 9.58 KB
/
mahalia-dependencies.postinst
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#!/bin/sh
set -e
if [ "$1" = 'configure' ]; then
# create user
USERNAME="mha"
ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 "mahalia"`
adduser --gecos $USERNAME --add_extra_groups --disabled-password $USERNAME
usermod -aG audio $USERNAME
usermod -aG sudo $USERNAME
usermod -p "${ENCRYPTED_PASSWORD}" $USERNAME
# configure mahalia system files
rm -f /etc/motd
# setup permissions
chown -R mha:mha /etc/mahalia_generic-hearing-aid
chown -R mha:mha /etc/mahalia_calibration
chown -R mha:mha /etc/mahalia_save-lsl-streams
chown -R mha:mha /home/mha
# setup dnsmasq & hostapd
echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" > /etc/default/hostapd
deb-systemd-invoke enable dnsmasq
#deb-systemd-invoke start dnsmasq
# hostapd is masked by default
systemctl unmask hostapd
deb-systemd-invoke enable hostapd
#deb-systemd-invoke start hostapd
# Install and start daemon
deb-systemd-invoke enable mahalia
deb-systemd-invoke enable mahalia-setup
#deb-systemd-invoke enable mahalia-flasher
deb-systemd-invoke enable mahalia-batcat
deb-systemd-invoke enable mahalia-nodered
# The node-red package installs a "socket" that we need to disable
rm -f /etc/systemd/system/sockets.target.wants/nodered.socket
exit 0
fi
# Automatically added by dh_systemd_enable/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'mahalia.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'mahalia.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'mahalia.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'mahalia.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'mahalia-setup.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'mahalia-setup.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'mahalia-setup.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'mahalia-setup.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'mahalia-flasher.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'mahalia-flasher.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'mahalia-flasher.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'mahalia-flasher.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'mahalia-batcat.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'mahalia-batcat.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'mahalia-batcat.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'mahalia-batcat.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'mahalia.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'mahalia-setup.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'mahalia-flasher.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'mahalia-batcat.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'mahalia-batcat.service' 'mahalia-flasher.service' 'mahalia-setup.service' 'mahalia-wifidisable.service' 'mahalia.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installmodules/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -e /boot/System.map-4.14.94-rt50-02913-g8383e797681a-dirty ]; then
depmod -a -F /boot/System.map-4.14.94-rt50-02913-g8383e797681a-dirty 4.14.94-rt50-02913-g8383e797681a-dirty || true
fi
fi
# End automatically added section
# Automatically added by dh_installinit/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/mahalia" ]; then
update-rc.d mahalia defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d mahalia $_dh_action || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installinit/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/mahalia-setup" ]; then
update-rc.d mahalia-setup defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d mahalia-setup $_dh_action || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installinit/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/mahalia-flasher" ]; then
update-rc.d mahalia-flasher defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d mahalia-flasher $_dh_action || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installinit/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/mahalia-wifidisable" ]; then
update-rc.d mahalia-wifidisable defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d mahalia-wifidisable $_dh_action || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installinit/12ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/mahalia-batcat" ]; then
update-rc.d mahalia-batcat defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d mahalia-batcat $_dh_action || exit 1
fi
fi
# End automatically added section