-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzfs-install.bash
2492 lines (2147 loc) · 91 KB
/
zfs-install.bash
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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# offline-arch-install-unsquashfs
main() {
# if [ "$1" = yes ]; then
# do_task_this
# else
# do_task_that
# fi
# temporary git clone ssl problem fix
# git config --global http.sslVerify false
# git config http.sslVerify false # for one repository
if [[ -f .env ]]; then
# export "$(cat .env | xargs)"
set -o allexport; source .env; set +o allexport
fi
passphrase=${passphrase:-mypassphrase}
ssid=${ssid:-myssid}
connectToWIFI "$ssid" "$passphrase";
initPacmanMirrorList;
# if [[ -z "${TMUX}" ]]; then
# echo "Installng from tmux!";
# pacman -S --noconfirm tmux
# # tmux attach -t base || tmux new -s base
# current_filename_withpath="$0"
# current_filename_withextension="$(basename "$0")"
# current_filename="${current_filename_withextension%.*}"
# tmux_filename="${current_filename}_tmux.sh"
# # send to tmux
# cp "$current_filename_withpath" "$tmux_filename"
# # execute tmux
# # tmux new-session -d "source $tmux_filename ; rm $tmux_filename"
# tmux new-session -d -s tempSession "$tmux_filename";
# tmux attach-session -t tempSession
# rm "$tmux_filename"
# fi
read -r -p "Create Only ArchZfsISO (default: n, [select y or n]):" onlyCreateArchZfsISO
onlyCreateArchZfsISO=${onlyCreateArchZfsISO:-n}
if [[ $onlyCreateArchZfsISO == "y" ]]; then
createArchZfsISO;
exit
fi
default_Output_Device=${default_Output_Device:-/dev/sda}
default_root_password=${default_root_password:-root}
default_user_name=${default_user_name:-user}
default_user_password=${default_user_password:-user}
default_filesystem=${default_filesystem:-zfs}
default_offlineInstallUnsquashfs=${default_offlineInstallUnsquashfs:-n}
default_bootsystem=${default_bootsystem:-systemd}
default_install_tools=${default_install_tools:-n}
read -r -p "Accept Defaults default: y, [select y or n](Output Device: $default_Output_Device, root_password: $default_root_password, user_name: $default_user_name, user_password: $default_user_password, filesystem: $default_filesystem, offlineInstallUnsquashfs: $default_offlineInstallUnsquashfs, bootsystem: $default_bootsystem, install_tools: $default_install_tools):" defaults_accepted
defaults_accepted=${defaults_accepted:-y}
echo "$defaults_accepted"
Output_Device="$default_Output_Device"
root_password="$default_root_password"
user_name="$default_user_name"
user_password="$default_user_password"
filesystem="$default_filesystem"
offlineInstallUnsquashfs="$default_offlineInstallUnsquashfs"
bootsystem="$default_bootsystem"
install_tools="$default_install_tools"
if [[ $defaults_accepted == "n" ]]; then
# IFS=":" read -r Output_Device root_password user_name user_password filesystem offlineInstallUnsquashfs install_tools < <(initDefaultOptions)
# eval "$(initDefaultOptions)"
initDefaultOptions;
fi
read -r -p "Do install with rescue system (default: n, [select y or n]):" doInstallWithRescueSystem
doInstallWithRescueSystem=${doInstallWithRescueSystem:-n}
if [[ $doInstallWithRescueSystem == "y" ]]; then
installWithRescueSystem "$Output_Device" "$root_password" "$user_name" "$user_password" "$filesystem" "$offlineInstallUnsquashfs" "$bootsystem" "$install_tools";
exit
fi
install "$Output_Device" "$root_password" "$user_name" "$user_password" "$filesystem" "$offlineInstallUnsquashfs" "$bootsystem" "$install_tools";
#reboot
}
connectToWIFI() {
ssid="$1"
passphrase="$2"
if which iwctl >/dev/null; then
iwctl --passphrase "$passphrase" station wlan0 connect-hidden "$ssid"
else
wifi_interface=$(ls /sys/class/net | grep wl)
mkdir /etc/wpa_supplicant
touch "/etc/wpa_supplicant/wpa_supplicant-${wifi_interface}.conf"
tee "/etc/wpa_supplicant/wpa_supplicant-${wifi_interface}.conf" <<- EOF
ctrl_interface=/var/run/wpa_supplicant
update_config=1
EOF
wpa_passphrase "$ssid" "$passphrase" >> "/etc/wpa_supplicant/wpa_supplicant-${wifi_interface}.conf"
sed -i "s|network={|network={\n\tmode=0\n\tscan_ssid=1|g" "/etc/wpa_supplicant/wpa_supplicant-${wifi_interface}.conf";
wpa_supplicant -B -i "$wifi_interface" -c "/etc/wpa_supplicant/wpa_supplicant-${wifi_interface}.conf"
fi
}
install() {
Output_Device="$1"
root_password="$2"
user_name="$3"
user_password="$4"
filesystem="$5"
offlineInstallUnsquashfs="$6"
bootsystem="$7"
install_tools="$8"
has_rescue_system=${9:-n}
pacman -Syy
# recoverPartitionTableFromMemory $Output_Device;
if [[ $filesystem == "zfs" ]]; then
initZFSrequirements;
# initZFSrequirements2;
createAndMountPartitionsZFS "$Output_Device" "$has_rescue_system";
elif [[ $filesystem == "ext4" ]]; then
createAndMountPartitions "$Output_Device";
elif [[ $filesystem == "btrfs" ]]; then
createAndMountPartitionsBTRFS "$Output_Device";
fi
# AREA section OLD5
if [[ $offlineInstallUnsquashfs == "y" ]]; then
installArchLinuxWithUnsquashfs;
else
installArchLinuxWithPacstrap "$filesystem";
fi
arch-chroot /mnt <<- EOF
echo "Entering chroot"
EOF
arch-chroot /mnt <<- EOF
pacman -Sy
initPacmanEntropy;
# AREA section OLD2
pacman --noconfirm --needed -S sudo
search="# %wheel ALL=(ALL) ALL"
replace=" %wheel ALL=(ALL) ALL"
sed -i "s|\$search|\$replace|g" /etc/sudoers;
configureUsers $root_password $user_name $user_password;
initMkinitcpioPreset;
# mkinitcpio -P
# curl https://raw.githubusercontent.com/archlinux/mkinitcpio/master/mkinitcpio.conf | tr -d '\r' > /etc/mkinitcpio.conf
if [[ $install_tools == "y" ]]; then
installTools $user_name $user_password && # fix without subsequent && script exists after installDesktopEnvironment
fi
# AREA section OLD5
if [[ $filesystem == "zfs" ]]; then
initZFSBootTimeUnlockService;
search="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)"
replace="HOOKS=(base udev autodetect modconf keyboard keymap consolefont block zfs filesystems)"
sed -i "s|\$search|\$replace|g" /etc/mkinitcpio.conf;
elif [[ $filesystem == "btrfs" ]]; then
sed -i 's/MODULES=()/MODULES=(btrfs)/g' /etc/mkinitcpio.conf;
search="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)"
#replace="HOOKS=(base udev block automount modconf filesystems keyboard fsck)"
replace="HOOKS=(base udev block autodetect modconf filesystems keyboard fsck)"
sed -i "s|\$search|\$replace|g" /etc/mkinitcpio.conf;
fi
if [[ $offlineInstallUnsquashfs == "y" ]]; then
mkinitcpio -g /boot/initramfs-linux.img
else
mkinitcpio -p linux
fi
if [[ $bootsystem == "systemd" ]]; then
installUEFISystemdBoot $filesystem;
elif [[ $bootsystem == "grub" ]]; then
installUEFIGrub $offlineInstallUnsquashfs $filesystem;
fi
#writeArchIsoToSeperatePartition;
# AREA section OLD4
# copyWallpapers;
if [[ $filesystem == "zfs" ]]; then
# configureZectlSystemdBoot $user_name $user_password;
umount -l /home
fi
exit
EOF
if [[ $filesystem == "zfs" ]]; then
cp /etc/zfs/zpool.cache /mnt/etc/zfs
umount /mnt/boot
zpool export zroot
fi
# cp -av .config/. "/mnt/home/$user_name/.config"
# createArchISO $user_name $user_password;
if [[ $filesystem == "ext4" || $filesystem == "btrfs" ]]; then
umount /mnt/boot
umount /mnt/home
umount /mnt -l
umount -l -R /mnt
umount -l -R /mnt
fi
}
initMkinitcpioPreset() {
mkdir -p "/etc/mkinitcpio.d"
tee /etc/mkinitcpio.d/linux.preset <<- EOF
# mkinitcpio preset file for the 'linux' package
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img"
fallback_options="-S autodetect"
EOF
}
installWithRescueSystem() {
default_Output_Device="$1"
default_root_password="$2"
default_user_name="$3"
default_user_password="$4"
default_filesystem="$5"
default_offlineInstallUnsquashfs="$6"
default_bootsystem="$7"
default_install_tools="$8"
has_rescue_system=${9:-n}
default_filesystem="ext4"
default_offlineInstallUnsquashfs="y"
default_bootsystem="systemd"
# read -r -p "Accept Defaults default for rescue system: y, [select y or n](Output Device: $default_Output_Device, root_password: $default_root_password, user_name: $default_user_name, user_password: $default_user_password, filesystem: $default_filesystem, offlineInstallUnsquashfs: $default_offlineInstallUnsquashfs, bootsystem: $default_bootsystem, install_tools: $default_install_tools):" defaults_accepted
# defaults_accepted=${defaults_accepted:-y}
# echo "$defaults_accepted"
Output_Device="$default_Output_Device"
root_password="$default_root_password"
user_name="$default_user_name"
user_password="$default_user_password"
filesystem="$default_filesystem"
offlineInstallUnsquashfs="$default_offlineInstallUnsquashfs"
bootsystem="$default_bootsystem"
install_tools="$default_install_tools"
if [[ $defaults_accepted == "n" ]]; then
# IFS=":" Output_Device root_password user_name user_password filesystem offlineInstallUnsquashfs install_tools < <(initDefaultOptions)
# eval "$(initDefaultOptions)"
initDefaultOptions;
fi
install "$default_Output_Device" "$default_root_password" "$default_user_name" "$default_user_password" "$default_filesystem" "$default_offlineInstallUnsquashfs" "$default_bootsystem" "$default_install_tools" "$has_rescue_system";
has_rescue_system="y";
default_filesystem="zfs"
default_offlineInstallUnsquashfs="n"
default_bootsystem="systemd"
install "$default_Output_Device" "$default_root_password" "$default_user_name" "$default_user_password" "$default_filesystem" "$default_offlineInstallUnsquashfs" "$default_bootsystem" "$default_install_tools" "$has_rescue_system";
#reboot
}
initDefaultOptions() {
read -r -p "Output Device (default: /dev/sda):" Output_Device
Output_Device=${Output_Device:-/dev/sda}
echo "$Output_Device"
read -r -p "Root Password (default: root):" root_password;
root_password=${root_password:-root}
echo "$root_password"
read -r -p "User Name (default: user):" user_name;
user_name=${user_name:-user}
echo "$user_name"
read -r -p "User Password (default: user):" user_password;
user_password=${user_password:-user}
echo "$user_password"
filesystem="ext4"
PS3="Choose root file system: "
options=(btrfs zfs ext4)
select menu in "${options[@]}";
do
filesystem="$menu"
break;
done
offlineInstallUnsquashfs="n"
PS3="Offline Unsquashfs install: "
options=(y n)
select menu in "${options[@]}";
do
offlineInstallUnsquashfs="$menu"
break;
done
if [[ $filesystem == "btrfs" ]]; then
bootsystem="grub"
else
PS3="Choose boot system system: "
options=(systemd grub)
select menu in "${options[@]}";
do
bootsystem="$menu"
break;
done
fi
install_tools="n"
PS3="Choose to install tools or not: "
options=(y n)
select menu in "${options[@]}";
do
install_tools="$menu"
break;
done
# Output_Device=$(sed 's:/:\\/:g' <<<"$Output_Device")
# Output_Device=${Output_Device//\//\\\/}
# Output_Device=\'$Output_Device\'
# root_password=\'$root_password\'
# user_name=\'$user_name\'
# user_password=\'$user_password\'
# filesystem=\'$filesystem\'
# offlineInstallUnsquashfs=\'$offlineInstallUnsquashfs\'
# bootsystem=\'$bootsystem\'
# install_tools=\'$install_tools\'
# echo "$Output_Device:$root_password:$user_name:$user_password:$filesystem:$offlineInstallUnsquashfs:$install_tools"
# echo "Output_Device='$Output_Device'; root_password='$root_password'; user_name='$user_name'; user_password='$user_password'; filesystem='$filesystem'; offlineInstallUnsquashfs='$offlineInstallUnsquashfs'; bootsystem='$bootsystem'; install_tools='$install_tools'"
# echo "Output_Device='$(echo $Output_Device)'; root_password='$(echo $root_password)'; user_name='$(echo $user_name)'; user_password='$(echo $user_password)'; filesystem='$(echo $filesystem)'; offlineInstallUnsquashfs='$(echo $offlineInstallUnsquashfs)'; bootsystem='$(echo $bootsystem)'; install_tools='$(echo $install_tools)'"
# echo 'Output_Device='"$Output_Device"'; root_password='"$root_password"'; user_name='"$user_name"'; user_password='"$user_password"'; filesystem='"$filesystem"'; offlineInstallUnsquashfs='"$offlineInstallUnsquashfs"'; bootsystem='"$bootsystem"'; install_tools='"$install_tools"
}
genfstabNormal() {
genfstab -U -p /mnt >> /mnt/etc/fstab
}
genfstabZfs() {
genfstab -U -p /mnt | grep boot >> /mnt/etc/fstab
echo "/dev/zvol/zroot/encr/swap none swap discard 0 0" >> /mnt/etc/fstab
echo "zroot/encr/data/home /home zfs rw,xattr,posixacl 0 0" >> /mnt/etc/fstab
}
installLtsKernelZFS() {
initZFSrequirements;
# pacman -S --noconfirm --needed kexec-tools
# kexec -l /boot/vmlinuz-linux-lts --initrd=/boot/initramfs-linux-lts.img --reuse-cmdline
# kexec -e
# systemctl kexec
}
initZFSrequirements2() {
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Arch%20Linux/1-zfs-linux.html?highlight=zfs%20linux#
pacman -S --needed --noconfirm curl
curl -L https://archzfs.com/archzfs.gpg | pacman-key -a -
curl -L https://git.io/JsfVS | xargs -i{} pacman-key --lsign-key {}
curl -L https://git.io/Jsfw2 > /etc/pacman.d/mirrorlist-archzfs
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
mount /home
echo "initZFSrequirements inside chroot started!"
else
mount -o remount,size=2G /run/archiso/cowspace
fi
declare file="/etc/pacman.conf"
declare regex="zfs"
declare file_content=$( cat "${file}" )
if [[ " $file_content " =~ $regex ]] # please note the space before and after the file content
then
echo "archzfs found in pacman.conf"
else
tee -a /etc/pacman.conf <<- EOF
#[archzfs-testing]
#Include = /etc/pacman.d/mirrorlist-archzfs
[archzfs]
Include = /etc/pacman.d/mirrorlist-archzfs
EOF
pacman -Sy
# INST_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | sed 's|.img||g' | awk '{ print $1 }')
# INST_LINVER=$(pacman -Si zfs-${INST_LINVAR} | grep 'Depends On' | sed "s|.*${INST_LINVAR}=||" | awk '{ print $1 }')
# if [ ${INST_LINVER} = \
# $(pacman -Si ${INST_LINVAR} | grep Version | awk '{ print $3 }') ]; then
# pacman -S --noconfirm --needed ${INST_LINVAR}
# else
# pacman -U --noconfirm --needed \
# https://archive.archlinux.org/packages/l/${INST_LINVAR}/${INST_LINVAR}-${INST_LINVER}-x86_64.pkg.tar.zst
# fi
# pacman -Sy zfs-${INST_LINVAR}
# sed -i 's/#IgnorePkg/IgnorePkg/' /etc/pacman.conf
# sed -i "/^IgnorePkg/ s/$/ ${INST_LINVAR} ${INST_LINVAR}-headers zfs-${INST_LINVAR} zfs-utils/" /etc/pacman.conf
fi
modprobe zfs
# INST_LINVAR=$(sed 's|.*linux|linux|' /proc/cmdline | sed 's|.img||g' | awk '{ print $1 }')
# pacman -Sy --needed --noconfirm ${INST_LINVAR} ${INST_LINVAR}-headers zfs-${INST_LINVAR} zfs-utils
}
initZFSrequirements() {
# 5.13.6.arch1.1-1
# http://archzfs.com/archive_archzfs/zfs-linux-2.1.0_5.13.6.arch1.1-1-x86_64.pkg.tar.zst
# http://archzfs.com/archive_archzfs/zfs-linux-2.1.0_5.13.6.arch1.1-1-x86_64.pkg.tar.zst.sig
# http://archzfs.com/archive_archzfs/zfs-linux-2.1.0_5.13.6.arch1.1-1.src.tar.gz
# http://archzfs.com/archive_archzfs/zfs-utils-2.0.5-1-x86_64.pkg.tar.zst
# http://archzfs.com/archive_archzfs/zfs-utils-2.0.5-1-x86_64.pkg.tar.zst.sig
# http://archzfs.com/archive_archzfs/zfs-utils-2.0.5-1.src.tar.gz
# archzfsiso_version=$(uname -r)
# zfslinux_packagename="http://archzfs.com/archive_archzfs/zfs-linux-2.1.0_${archzfsiso_version}-x86_64.pkg.tar.zst"
# wget "$zfslinux_packagename"
# version_date=$(stat "$zfslinux_packagename" | grep Modify | awk -F : '{print $2}' | awk '{print $1}')
# read -r Year Month Day <<< "$(echo "$version_date" | awk '{print $1" "$2" "$3}')"
# echo "Server=https://archive.archlinux.org/repos/$Year/$Month/$Day/\$repo/os/\$arch" > archlive/releng/airootfs/etc/pacman.d/
# zfs_utils_version=$(bsdtar -qxO -f "$zfslinux_packagename" .PKGINFO | grep -Po 'depend = zfs-utils=\K.*')
# curl "https://archlinux.org/mirrorlist/all/https/" > /etc/pacman.d/mirrorlist;
# echo "Server=https://archive.archlinux.org/repos/2021/07/30/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
# sudo pacman --needed -Sw $(pacman -Qqn)
# pacman -Syy
# wget http://archzfs.com/archive_archzfs/zfs-linux-2.1.0_5.13.6.arch1.1-1-x86_64.pkg.tar.zst
# wget http://archzfs.com/archive_archzfs/zfs-utils-2.0.5-1-x86_64.pkg.tar.zst
curl -s https://eoli3n.github.io/archzfs/init | bash
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
mount /home
declare file="/etc/pacman.conf"
declare regex="zfs"
declare file_content=$( cat "${file}" )
if [[ " $file_content " =~ $regex ]] # please note the space before and after the file content
then
echo "archzfs found in pacman.conf"
else
cat > temp <<- EOF
[archzfs]
Server = http://archzfs.com/\$repo/x86_64
SigLevel = Optional TrustAll
EOF
cat temp >> /etc/pacman.conf
# echo user | sudo -S cat temp | sudo tee -a /etc/pacman.conf
rm temp
fi
echo "initZFSrequirements inside chroot finished!"
else
mount -o remount,size=2G /run/archiso/cowspace
modprobe zfs
fi
}
initZFSBootTimeUnlockService() {
cat > temp <<- EOF
[Unit]
Description=Load encryption keys
DefaultDependencies=no
After=zfs-import.target
Before=zfs-mount.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/zfs load-key -a
StandardInput=tty-force
[Install]
WantedBy=zfs-mount.service
EOF
cat temp >> /etc/systemd/system/zfs-load-key.service
rm temp
systemctl enable --now zfs-load-key.service
}
configureZectlSystemdBoot() {
user_name="$1"
user_password="$2"
installAURpackageTrizen "$user_name" "$user_password" zectl
installAURpackageTrizen "$user_name" "$user_password" zectl-pacman-hook
echo "root ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
#configuring zectl-pacman-hook
boot_size=$(du /boot | grep -o '[0-9]*' | sort -nr | head -1)
efi_size=$(df /boot/efi --output=avail | sed '1d')
# echo "$efi_size / $boot_size" | bc
size=$((efi_size / boot_size))
zectl set pacmanhook-prunecount="$size"
#configuring zectl systemdboot plugin refactoring esp partition
zectl set bootloader=systemdboot
# efipart=$(eval $(lsblk -oMOUNTPOINT,PATH -P -M | grep 'MOUNTPOINT="/boot"'); echo $PATH | sed 's/[0-9]*$//')
efipart=$(eval "$(lsblk -oMOUNTPOINT,PATH -P -M | grep 'MOUNTPOINT="/boot"')"; echo "$PATH" )
efipartUUID=$( findmnt /boot -o UUID -n )
umount /boot
mkdir /efi
mount "$efipart" /efi
zectl set systemdboot:efi=/efi
# echo "UUID=$efipartUUID /efi vfat rw,defaults,errors=remount-ro 0 2" >> /etc/fstab
sed -i "s|/boot|/efi|g" /etc/fstab;
mkdir -p /efi/{loader/entries,env/org.zectl-default}
cp /efi/initramfs-linux.img /efi/env/org.zectl-default
# cp /efi/initramfs-linux-fallback.img /efi/env/org.zectl-default
cp /efi/vmlinuz-linux /efi/env/org.zectl-default
cat > temp <<- EOF
title Arch Linux
linux /env/org.zectl-default/vmlinuz-linux
initrd /env/org.zectl-default/initramfs-linux.img
options zfs=bootfs rw
EOF
# initrd /env/org.zectl-default/intel-ucode.img
# options zfs=zpool/ROOT/default rw
sudo cat temp | sudo tee -a /efi/loader/entries/org.zectl-default.conf
rm temp
zectl set systemdboot:boot=/boot
echo "/efi/env/org.zectl-default /boot none rw,defaults,errors=remount-ro,bind 0 0" >> /etc/fstab
current_boot_env=$(cat /proc/cmdline | awk -F\\ '{print $(NF-1)}' | sed 's/org.zectl-//g')
zectl activate "$(zectl list | grep "$current_boot_env" | awk '{print $1}')"
head -n -1 /etc/sudoers > temp.txt ; mv temp.txt /etc/sudoers # delete NOPASSWD line
}
installUEFISystemdBoot() {
filesystem="$1"
bootctl --path=/boot install
cat > temp <<- EOF
default arch
timeout 4
editor 0
EOF
cat temp >> /boot/loader/loader.conf
rm temp
cat > temp <<- EOF
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
EOF
cat temp >> /boot/loader/entries/arch.conf
rm temp
cat > temp <<- EOF
title Arch Linux Fallback
linux /vmlinuz-linux
initrd /initramfs-linux-fallback.img
EOF
cat temp >> /boot/loader/entries/arch-fallback.conf
rm temp
if [[ $filesystem == "zfs" ]]; then
tee -a /boot/loader/entries/arch.conf <<- EOF
options zfs=bootfs rw
EOF
tee -a /boot/loader/entries/arch-fallback.conf <<- EOF
options zfs=bootfs rw
EOF
elif [[ $filesystem == "ext4" ]]; then
# partuuid=$(blkid -s PARTUUID -o value "$efipart")
partuuid=$( findmnt / -o PARTUUID -n )
tee -a /boot/loader/entries/arch.conf <<- EOF
options root=PARTUUID=$partuuid rw
EOF
tee -a /boot/loader/entries/arch-fallback.conf <<- EOF
options root=PARTUUID=$partuuid rw
EOF
fi
bootctl --path=/boot update
}
installUEFIGrub() {
offlineInstallUnsquashfs="$1"
filesystem="$2"
pacman --noconfirm -S grub efibootmgr
#yes | pacman -S grub efibootmgr os-prober intel-ucode amd-ucode
if [[ $offlineInstallUnsquashfs == "y" ]]; then
mkinitcpio -g /boot/initramfs-linux.img # when unsquashfs used
else
mkinitcpio -p linux # when pacstrap used
fi
if [[ $filesystem == "zfs" ]]; then
ZPOOL_VDEV_NAME_PATH=1 grub-install --target=x86_64-efi --efi-directory=/boot
#grub-install --target=x86_64-efi --efi-directory=/efi --boot-directory=/boot
ZPOOL_VDEV_NAME_PATH=1 grub-mkconfig -o /boot/grub/grub.cfg
search="linux\\t/vmlinuz-linux root=ZFS=/encr/ROOT/default rw loglevel=3 quiet"
replace="linux\\t/vmlinuz-linux zfs=bootfs root=ZFS=/encr/ROOT/default rw loglevel=3 quiet"
sed -i "s|\$search|\$replace|g" /boot/grub/grub.cfg;
else
grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg;
fi
# AREA section OLD3
}
createAndMountPartitions() {
Output_Device="$1"
ISO_URL="http://mirrors.evowise.com/archlinux/iso/2021.01.01/archlinux-2021.01.01-x86_64.iso"
ISO_MB=$( curl -sI $ISO_URL | grep -i Content-Length | grep -o '[0-9]\+' )
# ISO_MB=$( curl -sI $ISO_URL | grep -i Content-Length | awk '{print $2}' | awk '{print $1/1024/1024 + 1}' )
ISO_MB=$((ISO_MB/1024/1024 + 10 ))
#boot arhiso
#create gpt table
#create boot swap root partitions
sfdisk --delete "$Output_Device";
#wipefs --all "$Output_Device";
#dd if=/dev/zero of="$Output_Device" bs=512 count=1
partprobe;
starting_part_number=$(partx -g /dev/sda | wc -l)
efipart_num=$((starting_part_number + 1))
rootpart_num=$((starting_part_number + 2))
efipart="${Output_Device}${efipart_num}";
rootpart="${Output_Device}${rootpart_num}";
#region old without zfs
# (echo g; echo n; echo p; echo 1; echo ""; echo +$(echo $ISO_MB)M; echo t; echo 0c; echo n; echo p; echo 2; echo ""; echo +1024M; echo t; echo 2; echo 19; echo n; echo p; echo 3; echo ""; echo +512M; echo t; echo 3; echo 1; echo n; echo p; echo 4; echo ""; echo ""; echo w; echo q) | fdisk $(echo $Output_Device);
# # (echo g; echo n; echo p; echo 1; echo ""; echo +$(echo $ISO_MB)M; echo t; echo 0c; echo n; echo p; echo 2; echo ""; echo +512M; echo t; echo 2; echo 1; echo n; echo p; echo 3; echo ""; echo ""; echo w; echo q) | fdisk $(echo $Output_Device);
# # (echo g; echo n; echo p; echo 1; echo ""; echo +1000M; echo t; echo 0c; echo n; echo p; echo 2; echo ""; echo +512M; echo t; echo 2; echo 1; echo n; echo p; echo 3; echo ""; echo ""; echo w; echo q) | fdisk $(echo $Output_Device);
# isopart=$(echo $Output_Device)1;
# swappart=$(echo $Output_Device)2;
(echo g; echo n; echo p; echo 1; echo ""; echo +512M; echo t; echo 1; echo n; echo p; echo 2; echo ""; echo +3072M; echo w; echo q) | fdisk $(echo $Output_Device); # before without isopart
#(echo g; echo n; echo p; echo 1; echo ""; echo +512M; echo t; echo 1; echo n; echo p; echo 2; echo ""; echo +512M; echo t; echo 2; echo 38; echo n; echo p; echo 3; echo ""; echo ""; echo w; echo q) | fdisk $(echo $Output_Device);
# efipart=$(echo $Output_Device)1;
#extbootpart=$(echo $Output_Device)2;
# rootpart=$(echo $Output_Device)2;
# after ls -l /dev/disk/by-label found ARCH_202011 (before was user -n EFI) on mount of /dev/sr0 at /run/archiso/bootmnt/arch/boot/syslinux/archiso_sys-linux.cfg
labelname=$(cat /run/archiso/bootmnt/arch/version | awk -F. '{print "ARCH_"$1""$2}')
mkfs.fat -F32 -n "$labelname" "$efipart";
#mksfs.ext4 "$extbootpart";
mkfs.ext4 -L root "$rootpart";
mount "$rootpart" /mnt
mkdir -p /mnt/boot
#mkdir -p /mnt/efi
#mount "$efipart" /mnt/efi
mount "$efipart" /mnt/boot
#mount "$extbootpart" /mnt/boot
#get file name from disk and partitions
# mkfs.fat -F32 -n ISO "$isopart";
# mkdir -p /mnt/iso
# mount "$isopart" /mnt/iso
# mkswap "$swappart"
# swapon "$swappart"
# endregion
}
createAndMountPartitionsBTRFS() {
Output_Device="$1"
sfdisk --delete "$Output_Device";
partprobe;
starting_part_number=$(partx -g /dev/sda | wc -l)
efipart_num=$((starting_part_number + 1))
rootpart_num=$((starting_part_number + 2))
efipart="${Output_Device}${efipart_num}";
rootpart="${Output_Device}${rootpart_num}";
(echo o; echo n; echo p; echo 1; echo ""; echo +512M; echo n; echo p; echo 2; echo ""; echo ""; echo w; echo q) | fdisk "$(echo "$Output_Device")";
partprobe;
# efipart=$(echo $Output_Device)1;
# rootpart=$(echo $Output_Device)2;
labelname=$(cat /run/archiso/bootmnt/arch/version | awk -F. '{print "ARCH_"$1""$2}')
mkfs.fat -F32 -n EFI "$efipart";
mkfs.btrfs -f -m single -L arch "$rootpart";
mount -o compress=lzo "$rootpart" /mnt;
cd /mnt || exit;
btrfs su cr @;
#btrfs su cr @boot;
btrfs su cr @home;
cd /;
umount /mnt;
mount -o noauto,compress=lzo,subvol=@ "$rootpart" /mnt;
cd /mnt || exit;
mkdir -p {boot,home};
#mount -o noauto,compress=lzo,subvol=@boot "$rootpart" boot;
#mkdir boot/EFI;
#mount "$efipart" /mnt/boot/EFI;
mount "$efipart" /mnt/boot;
mount -o noauto,compress=lzo,subvol=@home "$rootpart" home;
}
createAndMountPartitionsZFS() {
Output_Device="$1"
has_rescue_system="$2"
ISO_URL="http://mirrors.evowise.com/archlinux/iso/2021.01.01/archlinux-2021.01.01-x86_64.iso"
ISO_MB=$( curl -sI $ISO_URL | grep -i Content-Length | grep -o '[0-9]\+' )
# ISO_MB=$( curl -sI $ISO_URL | grep -i Content-Length | awk '{print $2}' | awk '{print $1/1024/1024 + 1}' )
ISO_MB=$((ISO_MB/1024/1024 + 10 ))
#boot arhiso
#create gpt table
#create boot swap root partitions
if [[ $has_rescue_system != "y" ]]; then
sfdisk --delete "$Output_Device";
#wipefs --all "$Output_Device";
#dd if=/dev/zero of="$Output_Device" bs=512 count=1
fi
partprobe;
starting_part_number=$(partx -g /dev/sda | wc -l)
efipart_num=$((starting_part_number + 1))
rootpart_num=$((starting_part_number + 2))
efipart="${Output_Device}${efipart_num}";
rootpart="${Output_Device}${rootpart_num}";
if [[ $has_rescue_system != "y" ]]; then
parted --script $(echo $Output_Device) \
mklabel gpt \
mkpart ESP fat32 1 513 \
set "$efipart_num" boot on \
name "$efipart_num" boot \
mkpart primary 513 100% \
name "$rootpart_num" rootfs \
quit
# efipart=$(echo $Output_Device)1;
# rootpart=$(echo $Output_Device)2;
else
(echo n; echo p; echo ""; echo ""; echo +512M; echo t; echo "";echo 1; echo n; echo p; echo ""; echo ""; echo +20480M; echo w; echo q) | fdisk $(echo $Output_Device);
fi
zpool create -o ashift=12 \
-O acltype=posixacl \
-O compression=lz4 \
-O relatime=on \
-O xattr=sa \
zroot "$rootpart"
zfs create -o encryption=on -o keyformat=passphrase -o mountpoint=none zroot/encr
zfs create -o mountpoint=none zroot/encr/data
zfs create -o mountpoint=none zroot/encr/ROOT
zfs create -o mountpoint=/ zroot/encr/ROOT/default
zfs create -o mountpoint=legacy zroot/encr/data/home
zfs umount -a
zpool set bootfs=zroot/encr/ROOT/default zroot
zfs create -V 2G -b 2048 -o logbias=throughput -o sync=always -o primarycache=metadata -o com.sun:auto-snapshot=false zroot/encr/swap
mkswap -f "/dev/zvol/zroot/encr/swap"
zpool export zroot
zpool import -R /mnt -l zroot
zpool set cachefile=/etc/zfs/zpool.cache zroot
mkdir -p /mnt/etc/zfs
cp /etc/zfs/zpool.cache /mnt/etc/zfs/
mkdir /mnt/boot
mkfs.fat -F32 "$efipart"
mount "$efipart" /mnt/boot
#region TODO continue zfs
# 1) zedenv, zectl dataset structure, create boot environment for legacy /home dataset
# 2) pacman -U /var/cache/pacman/pkg/zfs-linux-*.pkg.tar.xz after zectl pacman hook or zectl-systemd-boot configure
#endregion
}
createArchZfsISO() {
mount -o remount,size=2G /run/archiso/cowspace
# pacman -Syyu
initPacmanEntropy;
pacman -Syy
pacman -S --noconfirm archiso wget curl
mkdir archlive
cp -pr /usr/share/archiso/configs/releng archlive/
wget https://archzfs.com/archzfs.gpg
pacman-key -a archzfs.gpg
pacman-key --lsign-key DDF7DB817396A49B2A2723F7403BD972F75D9D76
tee -a /etc/pacman.conf <<- EOF
[archzfs]
Server = https://archzfs.com/$repo/$arch
SigLevel = Optional TrustAll
EOF
# pacman -Syu
pacman -Syy
tee -a archlive/releng/pacman.conf <<- EOF
[archzfs]
Server = https://archzfs.com/$repo/$arch
SigLevel = Optional TrustAll
EOF
tee -a archlive/releng/packages.x86_64 <<- EOF
linux-headers
archzfs-linux-lts
EOF
zfs_version=$(pacman -Si zfs-linux-lts | grep Version | awk '{print $3}')
zfs_version_date=$(pacman -Si zfs-linux-lts | grep Date | awk '{$1=$2=$3="";print $0}' | sed -i 's/+.*//g')
read -r Year Month Day <<< "$(echo $zfs_version_date | date '+%Y %m %d' -f -)"
# sed -i "s|\[core\]\\nInclude = /etc/pacman\.d/mirrorlist|SigLevel = PackageRequired\nServer=https://archive\.archlinux\.org/repos/$Year/$Month/$Day/\$repo/os/\$arch|g" archlive/releng/pacman.conf
# sed -i "s|\[extra\]\\nInclude = /etc/pacman\.d/mirrorlist|SigLevel = PackageRequired\nServer=https://archive\.archlinux\.org/repos/$Year/$Month/$Day/\$repo/os/\$arch|g" archlive/releng/pacman.conf
# sed -i "s|\[community\]\\nInclude = /etc/pacman\.d/mirrorlist|SigLevel = PackageRequired\nServer=https://archive\.archlinux\.org/repos/$Year/$Month/$Day/\$repo/os/\$arch|g" archlive/releng/pacman.conf
echo "Server=https://archive.archlinux.org/repos/$Year/$Month/$Day/\$repo/os/\$arch" > archlive/releng/airootfs/etc/pacman.d/mirrorlist
# pacman -Syyuu
# initPacmanMirrorList;
mkdir -p archlive/releng/{out,work}
mkarchiso -v -w archlive/releng/work -o archlive/releng/out/archzfs.iso archlive/releng
curl --progress-bar -T archlive/releng/out/archzfs.iso https://transfer.sh/archzfs.iso | tee /dev/null
}
writeArchIsoToSeperatePartition() {
# test
cd /iso || exit
wget http://mirrors.evowise.com/archlinux/iso/2021.01.01/archlinux-2021.01.01-x86_64.iso
# dd if=/dev/sdaX of=/dev/sdbY bs=64K conv=noerror,sync
# dd if=/archlinux-2021.01.01-x86_64.iso of=/sda1 bs=1M conv=noerror,sync
cat > temp <<- EOF
menuentry "Archc Linux OS Live ISO" --class arch {
set root='(hd0,1)'
set isofile="/archlinux-2021.01.01-x86_64.iso"
set dri="free"
search --no-floppy -f --set=root \$isofile
probe -u \$root --set=abc
set pqr="/dev/disk/by-uuid/\$abc"
loopback loop (hd0,1)\$isofile
linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=\$pqr img_loop=\$isofile driver=\$dri quiet splash vt.global_cursor_default=0 loglevel=2 rd.systemd.show_status=false rd.udev.log-priority=3 sysrq_always_enabled=1 cow_spacesize=2G
initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/amd-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}
EOF
# these 2 below are first lines in 40_custom file
# #!/bin/sh
# exec tail -n +3 $0
cat temp >> /etc/grub.d/40_custom
rm temp
grub-mkconfig -o /boot/grub/grub.cfg
}
createArchISO() {
# TODO
# slow boottime
# boot time reflector message bug, dont wait for network initializng
# configurations dirs wrong
# cow_device for persistence
# end TODO
user_name="$1"
user_password="$2"
sudo pacman --needed -Sw $(pacman -Qqn) # redownload native arch packages for caching
sudo pacman --noconfirm -S archiso
mkdir -p archlive
cp -av /usr/share/archiso/configs/releng/. archlive
# region copy users passwords
mkdir -p archlive/airootfs/etc/skel/
cp /etc/passwd archlive/airootfs/etc/passwd;
cp /etc/shadow archlive/airootfs/etc/shadow;
cp /etc/group archlive/airootfs/etc/group;
cp /etc/gshadow archlive/airootfs/etc/gshadow;
# end region copy users passwords
mkdir -p archlive/airootfs/etc/skel/.config
cp -av i3-seperate-install-skel/. archlive/airootfs/etc/skel
cp -av /home/user/{.bashrc,.zshrc,.vimrc} archlive/airootfs/etc/skel
ln -s /usr/lib/systemd/system/ly.service archlive/airootfs/etc/systemd/system/display-manager.service
ln -s /usr/lib/systemd/system/connman.service archlive/airootfs/etc/systemd/system/multi-user.target.wants/connman.service
ln -s /usr/lib/systemd/system/cornie.service archlive/airootfs/etc/systemd/system/multi-user.target.wants/cornie.service
mkdir -p archlive/airootfs/usr/bin
cp -r /usr/bin/morc_menu archlive/airootfs/usr/bin
mkdir -p archlive/airootfs/usr/share/lite-xl/plugins
cp -r /usr/share/lite-xl/plugins archlive/airootfs/usr/share/lite-xl/plugins
cp /etc/systemd/system/paccache.timer archlive/airootfs/etc/systemd/system/paccache.timer
cp /etc/systemd/journald.conf archlive/airootfs/etc/systemd/journald.conf
# mkdir -p archlive/airootfs/usr/share/morc_menu
mkdir -p archlive/airootfs/usr/bin
cp -r /usr/share/morc_menu archlive/airootfs/usr/share
cp /usr/bin/morc_menu archlive/airootfs/usr/bin/morc_menu
cp -r /usr/bin/rofi-power-menu archlive/airootfs/usr/bin/rofi-power-menu
rm archlive/packages.x86_64
git clone https://github.com/fuad-ibrahimzade/arch-scripts-data
mkdir archiso-files
cp -av arch-scripts-data/archiso-files/. archiso-files
rm -rf arch-scripts-data
cp archiso-files/packages.x86_64 archlive/packages.x86_64
repo-add archiso-files/customrepo/x86_64/custom.db.tar.gz archiso-files/customrepo/x86_64/*
sudo mkdir -p /archiso-files/customrepo
sudo mv archiso-files/customrepo/x86_64 /archiso-files/customrepo/x86_64
# repo-add archiso-files/customrepo/customrepo.db.tar.gz archiso-files/customrepo/x86_64/*.pkg.tar*
localIP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
cat > temp <<- EOF
[custom]
SigLevel = Optional TrustAll
Server = file:///archiso-files/customrepo/x86_64
EOF
cat temp >> archlive/pacman.conf
mkdir -p ./{out,work}
mkarchiso -v -w ./work -o ./out archlive
# region virtualbox share
pacman --noconfirm --needed -S linux-headers
pacman --noconfirm --needed -S virtualbox-guest-utils
systemctl enable --now vboxservice.service
usermod -a -G vboxsf "$user_name"
echo "root ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
sudo chown -R "$user_name":users /media/sf_Public/ #create shared Public folder inside virtualbox
sudo cp /usr/bin/VBoxClient-all sudo cp /usr/local/bin/VBoxClient-all #needed for sharing clipboard inside virtualbox
sudo chown -R "$user_name":users /usr/local/bin/VBoxClient-all
head -n -1 /etc/sudoers > temp.txt ; mv temp.txt /etc/sudoers # delete NOPASSWD line
# end region virtualbox share
}
installArchLinuxWithUnsquashfs() {
unsquashfs -force -dest /mnt /run/archiso/bootmnt/arch/x86_64/airootfs.sfs
lynx --source https://raw.githubusercontent.com/archlinux/mkinitcpio/master/mkinitcpio.conf | tr -d '\r' > /mnt/etc/mkinitcpio.conf
lynx --source larbs.xyz/larbs.sh | tr -d '\r' > /mnt/larbs.sh
# AREA section OLD1
cp -L /etc/resolv.conf /mnt/etc ## this is needed to use networking within the chroot
#reflector --latest 5 --protocol http --protocol https --sort rate --save /mnt/etc/pacman.d/mirrorlist
#end new
#cp /run/archiso/bootmnt/arch/x86_64/vmlinuz /mnt/boot/vmlinuz-linux
cp /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz-linux /mnt/boot/vmlinuz-linux
}
installArchLinuxWithPacstrap() {
filesystem="$1"
if [[ $filesystem == "zfs" ]]; then
yes '' | pacstrap -i /mnt base linux archzfs-linux
genfstabZfs;
elif [[ $filesystem == "ext4" ]]; then
yes '' | pacstrap -i /mnt base linux
genfstabNormal;
elif [[ $filesystem == "btrfs" ]]; then
#pacstrap -i /mnt base base-devel linux linux-firmware efibootmgr grub amd-ucode intel-ucode os-prober snapper vim nano lynx iwd;
yes '' | pacstrap -i /mnt base base-devel btrfs-progs linux linux-firmware
yes | pacstrap -i /mnt efibootmgr grub amd-ucode intel-ucode os-prober snapper vim nano lynx iwd;
yes '' | pacstrap -i /mnt base linux
genfstabNormal;
fi
arch-chroot /mnt <<- EOF
#!/usr/bin/bash