-
Notifications
You must be signed in to change notification settings - Fork 1
/
dru-nas.txt
352 lines (281 loc) · 9.18 KB
/
dru-nas.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#!/bin/sh
#aptRecommends=--no-install-recommends
aptRecommends=
versDeb=`cat /etc/os-release | grep -E '^VERSION_ID=' | cut -d '=' -f 2- | tr -d '"'`
if [ -e /etc/debian-build.conf ]; then
. /etc/debian-build.conf
fi
[ "x$installRecommends" = "x0" ] && aptRecommends=--no-install-recommends
sed -i s/'UID_MIN.*1000'/'UID_MIN 502'/g /etc/login.defs
sed -i s/'GID_MIN.*1000'/'GID_MIN 500'/g /etc/login.defs
echo " *** upgrade packages ..."
apt-get update || apt-get update
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 upgrade -y
apt-get dist-upgrade -y
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
echo " *** essential and interactive packages ..."
apt-get install -y binutils debconf-i18n debconf-utils whiptail
if [ -e /root/board-debs/debconf-selections.txt ]; then
debconf-set-selections < /root/board-debs/debconf-selections.txt
fi
apt-get install -y xkb-data liblocale-gettext-perl libuuid-perl
DEBIAN_FRONTEND=noninteractive apt-get install -y kbd
DEBIAN_FRONTEND=noninteractive apt-get install -y console-setup keyboard-configuration
debconf-set-selections < /root/board-debs/debconf-selections-nbd.txt
DEBIAN_FRONTEND=noninteractive apt-get ${aptRecommends} install -y kmod nbd-client
debconf-set-selections < /root/board-debs/debconf-selections-dash.txt
dpkg-reconfigure -f noninteractive dash
apt-get install -y perl-modules
# disabled
false && apt-get install -y ${aptRecommends} xserver-xorg-input-evdev xserver-xorg-video-fbdev
echo " *** 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
#postfix postfix/bad_recipient_delimiter error
#postfix postfix/not_configured error
cat <<\EOFDRUDCP | debconf-set-selections
postfix postfix/protocols select
postfix postfix/rfc1035_violation boolean false
postfix postfix/destinations string
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
postfix postfix/tlsmgr_upgrade_warning boolean
postfix postfix/relay_restrictions_warning boolean
postfix postfix/relayhost string
postfix postfix/mailbox_limit string 0
postfix postfix/recipient_delim string +
postfix postfix/mydomain_warning boolean
postfix postfix/kernel_version_warning boolean
postfix postfix/sqlite_warning boolean
postfix postfix/procmail boolean
postfix postfix/retry_upgrade_warning boolean
postfix postfix/chattr boolean false
postfix postfix/main_mailer_type select No configuration
postfix postfix/mailname string /etc/mailname
postfix postfix/root_address string
proftpd-basic shared/proftpd/inetd_or_standalone select standalone
EOFDRUDCP
if [ "x$installMailServer" != "x0" ]; then
DEBIAN_FRONTEND=noninteractive apt-get install -y bsd-mailx postfix
fi
aptDebs="anacron at cron logrotate mdadm"
[ "x$installSmartctl" != "x0" ] && aptDebs="${aptDebs} smartmontools"
[ "x$installNFSServer" != "x0" ] && aptDebs="${aptDebs} nfs-kernel-server"
[ "x$installSMBServer" != "x0" ] && aptDebs="${aptDebs} samba winbind"
apt-get install -y ${aptRecommends} ${aptDebs}
aptDebs="attr irqbalance openssh-server"
[ "x$installNTPServer" != "x0" ] && aptDebs="${aptDebs} ntp"
[ "x$installSMBServer" != "x0" ] && aptDebs="${aptDebs} samba-common-bin"
[ "x$installMiscServer" != "x0" ] && aptDebs="${aptDebs} avahi-daemon snmpd proftpd-basic tftpd-hpa"
apt-get install -y ${aptDebs}
# not in wheezy
#apt-get install -y samba-vfs-modules
# disabled
false && apt-get install -y dbus triggerhappy
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
echo " *** NAS packages ..."
apt-get ${aptRecommends} install -y \
adduser \
apt \
apt-utils \
base-files \
bash \
bash-completion \
bc \
binutils \
busybox-static \
bzip2 \
ca-certificates \
cifs-utils \
cpio \
curl \
dc \
device-tree-compiler \
dnsmasq-base \
dnsutils \
dosfstools \
ed \
eject \
ethtool \
file \
findutils \
ftp \
gdbserver \
gettext-base \
gnupg \
gpgv \
hdparm \
ifupdown \
info \
initramfs-tools \
inputattach \
iptables \
iputils-arping \
iputils-ping \
iputils-tracepath \
isc-dhcp-client \
kbd \
kmod \
less \
linux-base \
lockfile-progs \
lsb-release \
lshw \
lsof \
lua5.1 \
man-db \
mime-support \
nano \
net-tools \
netbase \
netcat-openbsd \
nfs-common \
openssh-client \
p7zip-full \
parted \
patch \
pciutils \
procps \
psmisc \
rdate \
rsync \
screen \
sdparm \
shared-mime-info \
smbclient \
squashfs-tools \
ssh \
ssl-cert \
strace \
sudo \
sysv-rc \
tcpdump \
telnet \
tftp-hpa \
time \
traceroute \
u-boot-tools \
udev \
udhcpc \
unzip \
usb-modeswitch \
usbutils \
vim \
vim-tiny \
wget \
whiptail \
xz-utils \
zip
if [ $versDeb -lt 12 ]; then
apt-get ${aptRecommends} install -y fuse resolvconf
else
apt-get ${aptRecommends} install -y fuse3 systemd-resolved
fi
apt-get ${aptRecommends} install -y iproute || apt-get ${aptRecommends} install -y iproute2
# not in wheezy
#apt-get ${aptRecommends} install -y dmidecode iproute2 kernel-common rename smemcap
# disabled
false && apt-get ${aptRecommends} install -y \
dialog \
dns-root-data \
firmware-linux-free \
geoip-database \
krb5-locales \
powermgmt-base \
# disabled
false && apt-get ${aptRecommends} install -y \
crda \
iw \
wireless-regdb \
wpasupplicant \
# disabled
false && apt-get ${aptRecommends} install -y \
alsa-base \
alsa-utils \
mesa-vdpau-drivers \
vdpau-va-driver \
x11-common \
x11-xkb-utils \
xdg-user-dirs \
xfonts-base \
xfonts-encodings \
xfonts-utils \
xserver-common \
xserver-xorg \
xserver-xorg-core
echo "CONF_SWAPSIZE=100" | tee /etc/dphys-swapfile
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y dphys-swapfile
swapoff /var/swap || true
rm -f /var/swap
#touch /tmp/dru-swap.done
apt-get install -y fake-hwclock i2c-tools mtd-utils uuid-runtime
apt-get install -y watchdog
[ ! -e /bin/nice ] && ln -s `which nice` /bin/nice
[ ! -e /sbin/watchdog ] && ln -s `which busybox` /sbin/watchdog
[ ! -e /sbin/flashcp ] && ln -s `which flashcp` /sbin/flashcp
[ ! -e /sbin/flash_erase ] && ln -s `which flash_erase` /sbin/flash_erase
[ ! -e /sbin/flash_eraseall ] && ln -s `which flash_eraseall` /sbin/flash_eraseall
[ ! -e /sbin/nanddump ] && ln -s `which nanddump` /sbin/nanddump
[ ! -e /sbin/nandwrite ] && ln -s `which nandwrite` /sbin/nandwrite
[ ! -e /sbin/i2cget ] && ln -s `which i2cget` /sbin/i2cget
[ ! -e /sbin/i2cset ] && ln -s `which i2cset` /sbin/i2cset
if [ "x$installISCSITarget" != "x0" ]; then
dit=/var/lib/dkms/iscsitarget/1.4.20.3+svn502
if [ ! -e ${dit} ]; then
apt-get install -y iscsitarget-dkms
if [ -e ${dit} ]; then
cat ${dit}/source/patches/compat-3.12.patch | tee -a ${dit}/source/patches/compat-3.2-3.4.patch >/dev/null
cat ${dit}/source/patches/compat-3.13.patch | grep -A99 'diff --git b/kernel/block-io' | tee -a ${dit}/source/patches/compat-3.2-3.4.patch >/dev/null
#dpkg-reconfigure iscsitarget-dkms
fi
fi
fi
apt-get clean
echo " *** user prepare ..."
userGroup=`cat /etc/group |grep ':500:' | cut -d ':' -f 1 2>/dev/null`
[ x$userGroup != xeveryone ] && groupadd -g 500 everyone
adminUser=`cat /etc/passwd |grep '501:500' | cut -d ':' -f 1 2>/dev/null`
[ x$adminUser != xadmin ] && useradd -g everyone -s /bin/bash -u 501 admin
mkdir -p /home/admin
chown admin:everyone /home/admin
#echo "admin ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers
guestUser=`cat /etc/passwd |grep '502:500' | cut -d ':' -f 1 2>/dev/null`
[ x$guestUser != xpc-guest ] && useradd -g everyone -s /usr/sbin/nologin -u 502 pc-guest
ftpUser=`cat /etc/passwd |grep '503:500' | cut -d ':' -f 1 2>/dev/null`
[ x$ftpUser != xanonymous-ftp ] && useradd -g everyone -s /usr/sbin/nologin -u 503 anonymous-ftp
#apt-get install aptitude
#aptitude install locales
#aptitude reinstall locales
touch /tmp/`basename $0`.done
echo "OK"