-
Notifications
You must be signed in to change notification settings - Fork 1
/
dru-omv.txt
318 lines (257 loc) · 9.45 KB
/
dru-omv.txt
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#!/bin/sh
aptRecommends=--no-install-recommends
#aptRecommends=
if [ -e /etc/debian-build.conf ]; then
. /etc/debian-build.conf
fi
echo " *** omv essential packages ..."
apt-get install -y \
apt-transport-https beep gdisk ifenslave jfsutils ntfs-3g pm-utils \
quota quotatool rrdtool socat uuid wpasupplicant xfsprogs xmlstarlet
apt-get install -y btrfs-tools || apt-get install -y btrfs-progs
# not in stretch
apt-get install -y openssh-blacklist-extra || true
#apt-get install -y dialog iso-codes lksctp-tools policykit-1 x11-common
apt-get install -y \
libpam-modules libsasl2-modules libjson-perl liblocale-po-perl libjavascript-minifier-xs-perl \
python3-dbus python3 python3-apt python3-pyudev
# not in stretch
apt-get install -y php5-cgi php5-cli || apt-get install -y php-cgi php-cli
# not in wheezy
apt-get install -y python3-dialog python3-natsort python3-netifaces
if [ -e /usr/lib/python3 -a ! -e /lib/python3 ]; then
ln -s /usr/lib/python3 /lib/python3
fi
#apt-get install -y default-jre-headless
echo " *** omv daemon packages ..."
if [ ! -e /usr/sbin/invoke-rc.d.distrib ]; then
dpkg-divert --local --rename --add /usr/sbin/invoke-rc.d
ln -s /bin/true /usr/sbin/invoke-rc.d
fi
if [ ! -e /usr/sbin/postmap.distrib ]; then
dpkg-divert --local --rename --add /usr/sbin/postmap
if [ ! -e /usr/sbin/postmap ]; then
ln -s /bin/true /usr/sbin/postmap
fi
fi
#apt-get install -y --reinstall dbus
apt-get install -y acpid cpufrequtils dmeventd lvm2 rrdcached rsyslog
apt-get install -y monit || true
#libnss-mdns
#apt-get install -y sane-utils
apt-get install -y nginx
# not in stretch
apt-get install -y php5-fpm || apt-get install -y php-fpm
apt-get install -y \
libesmtp6 libmodbus5 liboping0 libprotobuf-c1 \
libyajl2
apt-get install -y libupsclient4 || apt-get install -y libupsclient6
apt-get install -y liblvm2app2.2 || true
# not in stretch
apt-get install -y librabbitmq1 || true
apt-get install -y --no-install-recommends libnotify4
apt-get install -y ${aptRecommends} collectd
#cat /etc/debian_version
distDeb=stretch
distOmv=arrakis
versOmv=4
if grep bookworm /etc/apt/sources.list > /dev/null ; then
distDeb=bookworm
distOmv=sandworm
versOmv=7
elif grep bullseye /etc/apt/sources.list > /dev/null ; then
distDeb=bullseye
distOmv=shaitan
versOmv=6
elif grep buster /etc/apt/sources.list > /dev/null ; then
distDeb=buster
distOmv=usul
versOmv=5
elif grep stretch /etc/apt/sources.list > /dev/null ; then
distDeb=stretch
distOmv=arrakis
versOmv=4
elif grep jessie /etc/apt/sources.list > /dev/null ; then
distDeb=jessie
distOmv=erasmus
versOmv=3
elif grep wheezy /etc/apt/sources.list > /dev/null ; then
distDeb=wheezy
distOmv=stoneburner
versOmv=2
fi
if [ ! -e /etc/apt/sources.list.d/openmediavault.list ]; then
echo " *** omv repo packages ..."
#if [ $distOmv = arrakis ]; then
# echo "deb [ trusted=yes allow-insecure=yes ] http://packages.openmediavault.org/public ${distOmv} main" | tee /etc/apt/sources.list.d/openmediavault.list
#else
# echo "deb http://packages.openmediavault.org/public ${distOmv} main" | tee /etc/apt/sources.list.d/openmediavault.list
#fi
echo "deb http://packages.openmediavault.org/public ${distOmv} main" | tee /etc/apt/sources.list.d/openmediavault.list
wget -O - http://packages.openmediavault.org/public/archive.key | apt-key add -
apt-key adv --keyserver keyserver.ubuntu.com --recv 7E7A6C592EF35D13 || true
apt-key adv --keyserver keyserver.ubuntu.com --recv 24863F0C716B980B || true
apt-get update --allow-unauthenticated
apt-get install --allow-unauthenticated -y openmediavault-keyring
apt-get update
fi
apt-get install -y libjs-extjs5 || apt-get install -y libjs-extjs6 || true
# not in stretch
apt-get install -y php5-pam || apt-get install -y php-pam
#apt-get install -y proftpd-mod-vroot
apt-get install -y wsdd || true
apt-get clean
echo " *** omv systemd fixes ..."
cat <<\EOFDRUSCS | tee /bin/systemctl.druic > /dev/null
#!/bin/sh
echo "$0 $*" >> /var/log/systemctl-stub.log
n=`basename $0`
if [ "x$n" = "xsystemctl" ]; then
if [ "x$1" = "xstart" -o "x$1" = "xrestart" -o "x$1" = "xstop" ]; then
d=`echo $2 | cut -d . -f1`
t=`echo $2 | cut -d . -f2`
if [ x$t = xservice ]; then
/usr/sbin/invoke-rc.d ${d} $1
elif [ -e "/etc/init.d/${d}" ]; then
/usr/sbin/invoke-rc.d ${d} $1
fi
elif [ "x$1" = "xis-active" ]; then
d=$2
/usr/sbin/invoke-rc.d ${d} status
elif [ "x$1" = "xenable" ]; then
d=$2
if [ -e "/etc/init.d/${d}" ]; then
/usr/sbin/update-rc.d ${d} defaults
fi
elif [ "x$1" = "xdisable" ]; then
d=$2
if [ -e "/etc/init.d/${d}" ]; then
/usr/sbin/update-rc.d ${d} remove
fi
elif [ "x$1" = "x--version" ]; then
$0.distrib $1
fi
elif [ "x$n" = "xrunlevel" ]; then
if [ -e /tmp/.dru-boot.done ]; then
echo "N 2"
else
echo "unknown"
exit 1
fi
elif [ "x$n" = "xshutdown" ]; then
if [ "x$*" = "x-h -P now" -o "x$*" = "x-h now" ]; then
/sbin/halt
elif [ "x$*" = "x-r now" ]; then
/sbin/reboot
fi
fi
EOFDRUSCS
chmod ugo+rx /bin/systemctl.druic
if [ $versOmv -lt 4 ]; then
apt-get install -y systemd-shim
else
apt-get install -y systemd-sysv
fi
nnp=false
for f in `grep 'NoNewPrivileges=yes' /lib/systemd/system/*.service | cut -d ':' -f 1` ; do
l=`readlink $f || true`
b=`basename $f`
e=/etc/systemd/system/${b}.d
if [ "X${l}" = "X" -a ! -e ${e}/privileges.conf ]; then
echo $e
mkdir $e
echo "[Service]" > ${e}/privileges.conf
echo "NoNewPrivileges=no" >> ${e}/privileges.conf
fi
nnp=true
done
for s in wsdd ; do
f=/lib/systemd/system/${s}.service
if [ $nnp = true -a -e $f ]; then
l=`readlink $f || true`
b=`basename $f`
e=/etc/systemd/system/${b}.d
if [ "X${l}" = "X" -a ! -e ${e}/privileges.conf ]; then
echo $e
mkdir $e
echo "[Service]" > ${e}/privileges.conf
echo "NoNewPrivileges=no" >> ${e}/privileges.conf
fi
fi
done
echo " *** omv main and interactive packages ..."
cd /
tar xzvf /root/source/openmediavault-init-scripts.tar.gz
cd -
DEBIAN_FRONTEND=noninteractive apt-get install -y openmediavault openmediavault-lvm2 || DEBIAN_FRONTEND=noninteractive apt-get install -y openmediavault
omvedeb=openmediavault-omvextrasorg_latest_all${versOmv}.deb
if [ $versOmv -lt 3 ]; then
omvedeb=openmediavault-omvextrasorg_latest_all.deb
fi
if [ ! -e /root/source/${omvedeb} ]; then
cd /root/source/
if [ ${versOmv} -lt 4 ]; then
wget -N http://omv-extras.org/${omvedeb}
else
wget -N https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/${omvedeb}
fi
dpkg -i ${omvedeb}
cd -
if grep -q dl.bintray.com /etc/apt/sources.list.d/omv-extras-org.list ; then
sed -i "s|https://dl.bintray.com/openmediavault-plugin-developers/${distOmv} ${distDeb}|https://openmediavault-plugin-developers.github.io/packages/debian ${distOmv}|g" /etc/apt/sources.list.d/omv-extras-org.list
wget -O - https://openmediavault-plugin-developers.github.io/packages/debian/omvextras2026.asc | apt-key add -
fi
apt-get update
fi
cat <<\EOFDRUOMVP | tee /usr/local/bin/dru-omv-patch > /dev/null
#!/bin/sh
sed -i 's|\[ $(cat "/sys/class/net/\${iface}/operstate") != "up" \]|false|g' /usr/share/openmediavault/mkconf/issue
mkdir -p /usr/share/openmediavault/initsystem.disabled
for s in 60rootfs 65mdadm 90sysctl 99rrd ; do
if [ -e /usr/share/openmediavault/initsystem/$s ]; then
mv /usr/share/openmediavault/initsystem/$s /usr/share/openmediavault/initsystem.disabled/
fi
done
#rm -f /usr/share/openmediavault/initsystem/60rootfs
#rm -f /usr/share/openmediavault/initsystem/65mdadm
#rm -f /usr/share/openmediavault/initsystem/90sysctl
#rm -f /usr/share/openmediavault/initsystem/99rrd
rm -f /usr/share/openmediavault/mkconf/sysctl.d/nonrot
sed -i s/'eth|wlan'/'eth|egiga|wlan'/g /usr/share/openmediavault/initsystem/40interfaces
sed -i s/'"UID_MIN", 1000'/'"UID_MIN", 502'/g /usr/share/php/openmediavault/system/user.inc
sed -i s/'"GID_MIN", 1000'/'"GID_MIN", 500'/g /usr/share/php/openmediavault/system/group.inc
sed -i s/'eth|venet'/'eth|egiga|venet'/g /usr/share/php/openmediavault/system/net/networkinterfacebackend/ethernet.inc
#sed -i s/'$this->getCanonicalDeviceFile()'/'$this->getDeviceFile()'/g /usr/share/php/openmediavault/system/filesystem/filesystem.inc
sed -i 's|OMV_MOUNT_DIR="/srv"|OMV_MOUNT_DIR="/media"|g' /etc/default/openmediavault
if grep -q '^OMV_WATCHDOG_ENABLED=' /etc/default/openmediavault ; then
sed -i 's|^OMV_WATCHDOG_ENABLED=.*|OMV_WATCHDOG_ENABLED="NO"|g' /etc/default/openmediavault
else
echo 'OMV_WATCHDOG_ENABLED="NO"' >> /etc/default/openmediavault
fi
if [ -e /etc/systemd/system.conf.d/openmediavault-watchdog.conf ]; then
if grep -q '^RuntimeWatchdogSec=' /etc/systemd/system.conf.d/openmediavault-watchdog.conf ; then
sed -i 's|^RuntimeWatchdogSec=.*|RuntimeWatchdogSec=0|g' /etc/systemd/system.conf.d/openmediavault-watchdog.conf
fi
fi
EOFDRUOMVP
chmod ugo+rx /usr/local/bin/dru-omv-patch
/usr/local/bin/dru-omv-patch
if [ -e /etc/default/chrony ]; then
sed -i s/'-F -1'/'-F 0'/g /etc/default/chrony
sed -i s/'-F 1"'/'-F 0"'/g /etc/default/chrony
fi
if [ -e /usr/sbin/invoke-rc.d.distrib ]; then
rm /usr/sbin/invoke-rc.d
dpkg-divert --local --rename --remove /usr/sbin/invoke-rc.d
fi
if [ -e /usr/sbin/postmap.distrib ]; then
rm /usr/sbin/postmap
dpkg-divert --local --rename --remove /usr/sbin/postmap
fi
apt-get clean
/etc/init.d/monit stop || true
/etc/init.d/rrdcached stop || true
/etc/init.d/collectd stop || true
/etc/init.d/php*-fpm stop || true
touch /tmp/`basename $0`.done
echo "OK"