-
Notifications
You must be signed in to change notification settings - Fork 25
/
system-install
executable file
·93 lines (77 loc) · 2.45 KB
/
system-install
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
#!/usr/bin/env bash
set -euo pipefail
mount=/mnt
# * Helper Functions
check_connection() {
# ping default gateway; http://stackoverflow.com/a/932187/2744245
ping -c 1 -q "$(ip r | awk '/default/ {print $3}')" &> /dev/null
}
boot_efi_home_exist() {
[[ -d "$mount"/boot ]] && [[ -d "$mount"/boot/efi ]] \
&& [[ -d "$mount"/home ]]
}
prompt_continue() {
echo "continue? [y/n]"
read -r reply
if [[ $reply != y ]]; then
exit 0
fi
}
# * Base Install
base_install() {
# removed -c (use host package cache) because not enough space on live usb
# with the base group, the first initramfs will be generated and installed
# to the new system's boot path
# use host's package cache
# include some packages from old base group including linux kernel
pacstrap -i "$mount" base base-devel \
cryptsetup diffutils e2fsprogs less linux linux-firmware \
logrotate lvm2 man-db man-pages texinfo vi which
}
# * Chroot
chroot_setup() {
arch-chroot "$mount" /bin/bash
}
# * Main
main() {
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root."
exit 1
fi
if ! boot_efi_home_exist; then
echo "Please make sure that all partitions are mounted under $mount
(including the ESP as $mount/boot/EFI)."
echo "Using 'lsblk -o name,label,size' may be useful to determine how
which partitions are which."
exit 1
fi
if ! check_connection; then
echo "Please connect to the internet before continuing."
exit 1
fi
echo "Please read notes on installation and read the wiki for any changes.
- [[file:~/ag-sys/else/arch_and_program_info.org::*Arch%20Installation][Arch
Installation]]
- https://wiki.archlinux.org/index.php/Installation_guide"
echo
echo "This script does the following setup:
- Performs base installation with pacstrap
- Chroots into $mount with arch-chroot
NOTE: This script is not sufficient for a working installation. Please run the
post-install script from inside the chroot after this script. It will set the
timezone, hostname, install the bootloader, update the initramfs, create the
main user, etc.
Please create a new user before running the post-install script:
- useradd user
- passwd user
Please also confirm and sign extra keys for pacman (see ./pacman-keys).
If installing from existing system, consider copying over /var/lib/connman.
After running the post-install script, you should do the following:
- exit the chroot with 'exit'
- umount mounted partitions with 'umount -R /mnt'
- reboot"
prompt_continue
base_install
chroot_setup
}
main