-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacnasinstaller
executable file
·600 lines (503 loc) · 17.6 KB
/
pacnasinstaller
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
#!/usr/bin/bash
## Check if running as sudo/root ##
if [ $EUID != 0 ] ; then
echo "Must sudo or be root. Terminating..." >&2
exit 1
fi
INSTALLER_VERSION=0.8
PACNAS_VERSION=0.1
TEXTDOMAIN=pacnas_installer
TEXTDOMAINDIR=.
ANSWER="/tmp/.setup"
TITLE=$"pacNAS Installation - v$PACNAS_VERSION"
# use the first VT not dedicated to a running console
#LOG="/dev/tty6"
LOG="/tmp/install.log"
touch $LOG
DESTDIR="/mnt/pacnas_active"
EDITOR="vi"
_BLKID="blkid -c /dev/null"
# abstract the common pacman args
PACMAN="pacstrap ${DESTDIR}"
PACMAN_SYNC_LOG="/tmp/pacman-sync.log"
# downloader
DLPROG="wget"
PACKAGES=""
dialog --backtitle "${TITLE}" --aspect 15 --infobox $"Checking your Internet connection..." 4 35
NETWORK_ALIVE=`ping -c1 8.8.8.8 2>&1 | grep unknown`
# destination of blockdevices in /sys
block="/sys/block"
# partitions
PART_ROOT=""
ROOTFS=""
# Localization parameters
LOCALE="en_US"
KEYMAP="us"
KBLAYOUT="us"
# menu item tracker- autoselect the next item
NEXTITEM=""
# DIALOG()
# an el-cheapo dialog wrapper
#
# parameters: see dialog(1)
# returns: whatever dialog did
DIALOG() {
dialog --backtitle "${TITLE}" --aspect 15 "$@"
return $?
}
# DIALOG() taken from aif installer
# an el-cheapo dialog wrapper
#
# parameters: see dialog(1)
# returns: whatever dialog did
_checklist_dialog()
{
dialog --backtitle "$TITLE" --aspect 15 "$@" 3>&1 1>&2 2>&3 3>&-
}
# Stolen from netctl, otherwise it does not work ;-(
sd_escape() {
local IFS=''
# Prevent a recursion loop on backspaces
set -- "${@//\\/\\x5c}"
while [[ "$*" =~ [^[:alnum:].:_/\\] ]]; do
set -- "${@//$BASH_REMATCH/$(printf '\\x%x' "'$BASH_REMATCH")}"
done
printf '%s\n' "${@//\//-}"
}
set_language() {
if [[ -e scripts/lg ]]; then
scripts/lg --setup && NEXTITEM="1"
else
DIALOG --msgbox $"Error:\nlg script not found, aborting language setting" 0 0
fi
}
set_keymap() {
if [[ -e scripts/kb ]]; then
scripts/kb --setup && NEXTITEM="2"
else
DIALOG --msgbox $"Error:\nkb script not found, aborting keymaps setting" 0 0
fi
}
# chroot_mount()
# prepares target system as a chroot
#
chroot_mount()
{
[[ -e "${DESTDIR}/sys" ]] || mkdir -m 555 "${DESTDIR}/sys"
[[ -e "${DESTDIR}/proc" ]] || mkdir -m 555 "${DESTDIR}/proc"
[[ -e "${DESTDIR}/dev" ]] || mkdir "${DESTDIR}/dev"
mount -t sysfs sysfs "${DESTDIR}/sys"
mount -t proc proc "${DESTDIR}/proc"
mount -o bind /dev "${DESTDIR}/dev"
chmod 555 "${DESTDIR}/sys"
chmod 555 "${DESTDIR}/proc"
}
# chroot_umount()
# tears down chroot in target system
#
chroot_umount()
{
umount "${DESTDIR}/proc"
umount "${DESTDIR}/sys"
umount "${DESTDIR}/dev"
}
# list eth devices with mac adress
net_interfaces() {
for i in $(ls /sys/class/net); do
if [ $i != 'lo' ]; then
echo "${i}"
[[ "${1}" ]] && echo ${1}
fi
done
}
# lists default linux blockdevices
default_blockdevices() {
# ide devices
for dev in $(ls ${block} 2>/dev/null | egrep '^hd'); do
if [[ "$(cat ${block}/${dev}/device/media)" = "disk" ]]; then
if ! [[ "$(cat ${block}/${dev}/size)" = "0" ]]; then
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep "${dev}\[")" || "$(dmraid -rc | grep /dev/${dev})" ]]; then
echo "/dev/${dev}"
[[ "${1}" ]] && echo ${1}
fi
fi
fi
done
#scsi/sata devices, and virtio blockdevices (/dev/vd*)
for dev in $(ls ${block} 2>/dev/null | egrep '^[sv]d'); do
# virtio device doesn't have type file!
blktype="$(cat ${block}/${dev}/device/type 2>/dev/null)"
if ! [[ "${blktype}" = "5" ]]; then
if ! [[ "$(cat ${block}/${dev}/size)" = "0" ]]; then
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep "${dev}\[")" || "$(dmraid -rc | grep /dev/${dev})" ]]; then
echo "/dev/${dev}"
[[ "${1}" ]] && echo ${1}
fi
fi
fi
done
}
# Disable swap and all mounted partitions for the destination system. Unmount
# the destination root partition last!
_umountall()
{
DIALOG --infobox $"Disabling swapspace, unmounting already mounted disk devices..." 0 0
swapoff -a >/dev/null 2>&1
umount $(mount | grep -v "${DESTDIR} " | grep "${DESTDIR}" | sed 's|\ .*||g') >/dev/null 2>&1
umount $(mount | grep "${DESTDIR} " | sed 's|\ .*||g') >/dev/null 2>&1
}
prepare_harddrive() {
if [[ -e scripts/autoprepare_disc ]]; then
source scripts/autoprepare_disc
else
DIALOG --msgbox $"ERROR: Setup cannot find needed script /scripts/autoprepare_disc." 0 0
return 1
fi
DISCS=$(default_blockdevices)
if [[ "$(echo ${DISCS} | wc -w)" -gt 1 ]]; then
DIALOG --msgbox $"Available Disks:\n\n$(_getavaildisks)\n" 0 0
DIALOG --menu $"Select the hard drive to use" 14 55 7 $(default_blockdevices _) 2>${ANSWER} || return 1
DISC=$(cat ${ANSWER})
else
DISC=${DISCS}
fi
_umountall
# get just the disk size in 1000*1000 MB
if [[ "$(cat ${block}/$(basename ${DISC})/size 2>/dev/null)" ]]; then
DISC_SIZE="$(($(expr $(cat ${block}/$(basename ${DISC})/queue/logical_block_size) '*' $(cat ${block}/$(basename ${DISC})/size))/1000000))"
else
DIALOG --msgbox $"ERROR: Setup cannot detect size of your device, please use normal installation routine for partitioning and mounting devices." 0 0
return 1
fi
DIALOG --defaultno --yesno $"${DISC} will be COMPLETELY ERASED! Are you absolutely sure?" 0 0 \
|| return 1
DEVICE=${DISC}
# validate DEVICE
if [[ ! -b "${DEVICE}" ]]; then
DIALOG --msgbox $"Device '${DEVICE}' is not valid" 0 0
return 1
fi
PART_ROOT="${DEVICE}1"
printk off
# start at sector 1 for 4k drive compatibility and correct alignment
DIALOG --infobox $"Partitioning ${DEVICE}" 0 0
# check, that at least around 5GB are available
if [[ "${DISC_SIZE}" -lt "5000" ]]; then
DIALOG --msgbox $"ERROR: ${DISC_SIZE} is not large enough, please select a different disc to use for an installation of the pacNAS system." 0 0
return 1
fi
ROTATIONAL="$(cat ${block}/$(basename ${DEVICE})/queue/rotational)"
SSD_SIZE="0"
if [ "$ROTATIONAL" = "0" ]; then
SSD_SIZE="$((${DISC_SIZE} / 10}))"
MAX_AVAIL_SIZE="$((${DISC_SIZE}-${SSD_SIZE}))"
else
MAX_AVAIL_SIZE="${DISC_SIZE}"
fi
SWAP_SET=""
SWAP_PART_SIZE="256"
while [[ "${SWAP_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the size (MB) of your swap partition,\nMinimum value is 0 (no swap space).\n\nDisk space left: ${MAX_AVAIL_SIZE} MB" 10 65 "${SWAP_SIZE}" 2>${ANSWER} || return 1
SWAP_PART_SIZE=$(cat ${ANSWER})
if [[ "${SWAP_PART_SIZE}" = "" || "${SWAP_PART_SIZE}" = "0" ]]; then
DIALOG --msgbox $"ERROR: No swap space will be created." 0 0
SWAP_PART_SIZE=0
SWAP_SET=1
else
if [[ "${SWAP_PART_SIZE}" -ge "${MAX_AVAIL_SIZE}" ]]; then
DIALOG --msgbox $"ERROR: You have entered a too large size, please enter again." 0 0
else
SWAP_SET=1
fi
fi
done
# clean partitiontable to avoid issues!
dd if=/dev/zero of=${DEVICE} bs=512 count=2048 >>/dev/null 2>&1
wipefs -a ${DEVICE} &>/dev/null
parted -a optimal -s ${DEVICE} mktable msdos >>/dev/null 2>&1
# Boot (1)
if [ "${SWAP_PART_SIZE}" = "0" ]; then
DISC_SIZE="100%"
NO_SWAP="1"
else
DISC_SIZE=$((${MAX_AVAIL_SIZE}-${SWAP_PART_SIZE}))
fi
parted -a optimal -s ${DEVICE} mkpart primary 1 ${DISC_SIZE} >${LOG}
parted -a optimal -s ${DEVICE} set 1 boot on >${LOG}
if [ "${NO_SWAP}" != "1" ]; then
parted -a optimal -s ${DEVICE} mkpart primary linux-swap ${DISC_SIZE} $((${MAX_AVAIL_SIZE})) >${LOG}
mkswap -L pacnas_swap ${DEVICE}2
fi
if [[ $? -gt 0 ]]; then
DIALOG --msgbox $"Error partitioning ${DEVICE} (see ${LOG} for details)" 0 0
printk on
return 1
fi
autoprepare_format $PART_ROOT $ROTATIONAL $LOG
if [[ "${CANCEL}" = "1" ]]; then
NEXTITEM="2"
else
NEXTITEM="3"
fi
}
# install_packages()
# performs package installation to the target system
#
install_packages() {
if [[ -e ${PACMAN_SYNC_LOG} ]]; then
rm ${PACMAN_SYNC_LOG} -rf
fi
DIALOG --msgbox $"Package installation will begin now. You can watch the output in the progress window. Please be patient." 0 0
PACNAS_PACKAGES="sudo mkinitcpio-btrfs genesis python2-iptables python2-ntplib pacman-mirrorlist"
while [[ "${_state_sync}" != 'complete' ]];do
DIALOG --infobox $"Refreshing package database..." 6 45
${PACMAN} base grub btrfs-progs kexec-tools openssh ${PACNAS_PACKAGES} >${LOG} 2>${PACMAN_SYNC_LOG} || return 1
if [[ $? -ne 0 ]]; then
DIALOG --msgbox $"Pacman preparation failed! Check ${LOG} for errors." 6 60
return 1
fi
# cannot run with fsck hook in mkinitcpio, use our own package
# if [[ `grep error ${PACMAN_SYNC_LOG}` ]];then
# _state_sync='missing'
# else
_state_sync='complete'
# fi
done
S_INSTALL=1
NEXTITEM="4"
}
configure_system() {
# generate fstab
genfstab -L -p ${DESTDIR} > ${DESTDIR}/etc/fstab
# add btrfs root to the fstab mountpoint /mnt/btrfs
mkdir ${DESTDIR}/mnt/btrfs
fstab_line=$(cat ${DESTDIR}/etc/fstab | awk '$2 == "/" {print $1"\t/mnt/btrfs\t"$3"\t"$4",subvolid=0\t0\t0"}')
echo -e "\n" >> ${DESTDIR}/etc/fstab
echo -e "# Generated by pacnas installer" >> ${DESTDIR}/etc/fstab
echo -e "$fstab_line" >> ${DESTDIR}/etc/fstab
# generage vconsole (well, copy the already created version)
if [[ -e /tmp/vconsole.conf ]]; then
cp -vf /tmp/vconsole.conf ${DESTDIR}/etc
fi
# set hostname
HOSTNAME=""
while [[ "${HOSTNAME}" = "" ]]; do
DIALOG --inputbox $"Enter the hostname: " 10 65 "pacnas" 2>${ANSWER} || return 1
HOSTNAME="$(cat ${ANSWER})"
done
if [ "${HOSTNAME}" != "" ]; then
echo "${HOSTNAME}" > ${DESTDIR}/etc/hostname
fi
# set root password
PASSWORD_SET=""
while [[ "${PASSWORD_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the new root password: " 10 65 "" 2>${ANSWER} || return 1
PASSWORD=$(cat ${ANSWER})
PASSWORD_SET=1
done
if [ "${PASSWORD_SET}" = "1" ]; then
echo "root:${PASSWORD}" | arch-chroot ${DESTDIR} chpasswd
fi
# add additional user
ADD_USER_SET=""
while [[ "${ADD_USER_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the user name of the additional user: " 10 65 "" 2>${ANSWER} || return 1
ADD_USER_NAME=$(cat ${ANSWER})
ADD_USER_SET=1
done
if [ "${ADD_USER_SET}" = "1" ]; then
arch-chroot ${DESTDIR} useradd -m -g users -G wheel -s /bin/bash ${ADD_USER_NAME}
fi
# add additional user pwd
ADD_USER_PWD_SET=""
while [[ "${ADD_USER_PWD_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the password of the additional user: " 10 65 "" 2>${ANSWER} || return 1
ADD_USER_PWD=$(cat ${ANSWER})
ADD_USER_PWD_SET=1
done
if [ "${ADD_USER_PWD_SET}" = "1" ]; then
echo "${ADD_USER_NAME}:${ADD_USER_PWD}" | arch-chroot ${DESTDIR} chpasswd
fi
# generate mkinitcpio for system (should contain btrfs hook)
arch-chroot ${DESTDIR} mkinitcpio -p linux >> ${LOG}
NEXTITEM="5"
}
configure_network() {
# mkdir -p ${DESTDIR}/etc/udev/rules.d
# cp /etc/udev/rules.d/81-dhcpcd.rules ${DESTDIR}/etc/udev/rules.d/81-dhcpd.rules
NET_INTERFACES=
for i in $(ls /sys/class/net); do
if [ $i != 'lo' ]; then
NET_INTERFACES="${NET_INTERFACES} ${i} -"
fi
done
CANCEL=""
DIALOG --menu $"Select the interface to use" 22 60 16 ${NET_INTERFACES} 2>${ANSWER} || CANCEL="1"
if [[ "${CANCEL}" = "1" ]]; then
S_NEXTITEM="5"
return 1
fi
NET_INTERFACE=$(cat ${ANSWER})
NET_TYPES="dhcp - static -"
CANCEL=""
DIALOG --menu $"Select the network configuration type" 22 60 16 ${NET_TYPES} 2>${ANSWER} || CANCEL="1"
if [[ "${CANCEL}" = "1" ]]; then
S_NEXTITEM="5"
return 1
fi
NET_TYPE=$(cat ${ANSWER})
# type dhcp - easy one, configure
local NET_DESCRIPTION="Automatically generated by pacNAS installer"
mkdir -p ${DESTDIR}/etc/netctl
local NET_PROFILE=ethernet-${NET_TYPE}
local NET_FILE=${DESTDIR}/etc/netctl/${NET_PROFILE}
if [[ "${NET_TYPE}" = "dhcp" ]]; then
DIALOG --msgbox $"Config: ${NET_INTERFACE} with Type: ${NET_TYPE}" 0 0
# create netctl config
echo "Description='DHCP Network ${NET_DESCRIPTION}'" > ${NET_FILE}
echo "Interface=${NET_INTERFACE}" >> ${NET_FILE}
echo "Connection=ethernet" >> ${NET_FILE}
echo "IP=dhcp" >> ${NET_FILE}
else
# this should only be reached, if type == static
IP_SET=""
while [[ "${IP_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the IP for the network device ${NET_INTERFACE}" 10 65 2>${ANSWER} || return 1
IP=$(cat ${ANSWER})
IP_SET=1
done
MASK_SET=""
while [[ "${MASK_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the Netmask for the network device ${NET_INTERFACE}" 10 65 "24" 2>${ANSWER} || return 1
MASK=$(cat ${ANSWER})
MASK_SET=1
done
GW_SET=""
while [[ "${GW_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the Gateway for the network device ${NET_INTERFACE}" 10 65 2>${ANSWER} || return 1
GW=$(cat ${ANSWER})
GW_SET=1
done
DNS_SET=""
while [[ "${DNS_SET}" = "" ]]; do
DIALOG --inputbox $"Enter the DNS for the network device ${NET_INTERFACE}" 10 65 "${GW}" 2>${ANSWER} || return 1
DNS=$(cat ${ANSWER})
DNS_SET=1
done
# create netctl config
echo "Description='Static Network ${NET_DESCRIPTION}'" > ${NET_FILE}
echo "Interface=${NET_INTERFACE}" >> ${NET_FILE}
echo "Connection=ethernet" >> ${NET_FILE}
echo "IP=static" >> ${NET_FILE}
echo "Address=('${IP}/${MASK}')" >> ${NET_FILE}
echo "Gateway='${GW}'" >> ${NET_FILE}
echo "DNS=('${DNS}')" >> ${NET_FILE}
fi
# enable systemctl service in chroot
local SYS_VAR=sys-subsystem-net-devices-${NET_INTERFACE}.device
# stolen from netctl, there are some things, which needed slight adoptions
local unit="${DESTDIR}/etc/systemd/system/netctl@$(sd_escape "${NET_PROFILE}").service"
echo ".include /usr/lib/systemd/system/[email protected]" > "$unit"
echo "" >> ${unit}
echo "[Unit]" >> ${unit}
echo "Description=${NET_DESCRIPTION}" >> ${unit}
echo "BindsTo=${SYS_VAR}" >> ${unit}
echo "After=${SYS_VAR}" >> ${unit}
mkdir -p "${DESTDIR}/etc/systemd/system/multi-user.target.wants"
echo "ln -s '$unit' '${unit/system\//system/multi-user.target.wants/}'"
ln -s "$unit" "${unit/system\//system/multi-user.target.wants/}"
echo "enable openssh on target system"
arch-chroot ${DESTDIR} systemctl enable sshd --no-reload
echo "enable group 'wheel' in sudoers config"
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' ${DESTDIR}/etc/sudoers
# here we are going to create a "after-install" snapshot
MOUNT_OPTIONS=$(cat ${DESTDIR}/etc/fstab | awk '$2 == "/" {print $4",subvolid=0"}')
mount -o ${MOUNT_OPTIONS} -L pacnas_root ${DESTDIR}/mnt/btrfs >> /etc/install.log
cd ${DESTDIR}/mnt/btrfs
btrfs subvolume snapshot __active __active/.snapshots/after-install >> /etc/install.log
NEXTITEM="6"
}
install_bootloader() {
DIALOG --msgbox $"Installing bootloader (grub2)." 0 0
DISCS=$(default_blockdevices)
if [[ "$(echo ${DISCS} | wc -w)" -gt 1 ]]; then
DIALOG --msgbox $"Available Disks:\n\n$(_getavaildisks)\n" 0 0
DIALOG --menu $"Select the hard drive to use" 14 55 7 $(default_blockdevices _) 2>${ANSWER} || return 1
DISC=$(cat ${ANSWER})
else
DISC=${DISCS}
fi
arch-chroot ${DESTDIR} grub-install --target=i386-pc --recheck $DISC >>/tmp/debug.log
arch-chroot ${DESTDIR} grub-mkconfig -o /boot/grub/grub.cfg >>/tmp/debug.log
NEXTITEM="7"
}
mainmenu() {
if [[ -n "${NEXTITEM}" ]]; then
DEFAULT="--default-item ${NEXTITEM}"
else
DEFAULT=""
fi
# right now we do not offer any other language then english...
# "0" $"Set Language" \
dialog ${DEFAULT} --backtitle "${TITLE}" --title $" MAIN MENU " \
--menu $"Use the UP and DOWN arrows to navigate menus.\nUse TAB to switch between buttons and ENTER to select." 17 58 13 \
"1" $"Set Keymap" \
"2" $"Prepare Hard Drive" \
"3" $"Install System" \
"4" $"Configure System" \
"5" $"Configure Network (on new System)" \
"6" $"Install Bootloader" \
"7" $"Exit Install" 2>${ANSWER}
NEXTITEM="$(cat ${ANSWER})"
case $(cat ${ANSWER}) in
"0")
set_language ;;
"1")
set_keymap ;;
"2")
prepare_harddrive ;;
"3")
install_packages ;;
"4")
configure_system ;;
"5")
configure_network ;;
"6")
install_bootloader
DIALOG --yesno $"The installation is complete. \nDo you want to restart to your new system?" 0 0 && RESTART_CHECK='S'
if [[ "${RESTART_CHECK}" == 'S' ]];then
reboot
fi
;;
"7")
[[ -e /tmp/.setup-running ]] && rm /tmp/.setup-running
clear
echo ""
echo "If the install finished successfully, you can now type 'reboot'"
echo "to restart the system."
echo "The system will then be reachable via the configured IP on port"
echo "8000 (like: http://127.0.0.1:8000)."
echo ""
exit 0 ;;
*)
DIALOG --yesno $"Abort Installation?" 6 40 && [[ -e /tmp/.setup-running ]] && rm /tmp/.setup-running && clear && exit 0
;;
esac
}
#####################
## begin execution ##
if [[ -e /tmp/.setup-running ]]; then
DIALOG --yesno $"Wait! \n\pacNAS Installer is already running somewhere else! \n\nDo you want to start from the beginning?" 0 0 && rm /tmp/.setup-running /tmp/.km-running /tmp/setup-pacman-running /tmp/setup-mkinitcpio-running /tmp/.tz-running /tmp/.setup
if [[ -e /tmp/.setup-running ]]; then
exit 1
fi
fi
: >/tmp/.setup-running
DIALOG --msgbox $"Welcome to the pacNAS Installation program.\n\nThe install process is fairly straightforward, and you should run through the options in the order they are presented.\n\nIf you are unfamiliar with partitioning/making filesystems, you may want to consult some documentation before continuing." 18 65
sh scripts/rankmirrors-script &
while true; do
mainmenu
done
clear
exit 0
# vim: set ts=2 sw=2 et: