-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall
executable file
·120 lines (104 loc) · 3.14 KB
/
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
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
#!/bin/bash
# SPDX-FileCopyrightText: 2016 - 2024 sudorook <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
set -euo pipefail
DIR="$(dirname "$0")"
#
# Source the functions
#
. "${DIR}"/functions/00-check
. "${DIR}"/functions/00-install
#
# Define main select wrapper
#
function main {
ask_device
ask_partition_scheme
case "${SCHEME}" in
"LVM on LUKS")
ask_physical_volume_name
ask_volume_group_name
;;
"LVM")
SCHEME="LVM"
ask_volume_group_name
;;
*) ;;
esac
ask_bootmode
ask_partition_sizes
ask_timezone
ask_locale
ask_hostname
ask_username
ask_password
if [[ "${SCHEME}" = "LVM on LUKS" ]]; then
ask_lukspass
fi
set_partitions
format_partitions
mount_install
pacstrap /mnt base
genfstab -U /mnt >> /mnt/etc/fstab
if [[ "${BOOTMODE}" = "systemd-boot" ]]; then
sed -i "/\(.*\)\s\+\/efi\s\+vfat/s/0022/0077/g" /mnt/etc/fstab
fi
TIMEZONE="${TIMEZONE}" arch-chroot /mnt /bin/bash -c "set_timezone"
LOCALE="${LOCALE}" CHARSET="${CHARSET}" \
arch-chroot /mnt /bin/bash -c "set_locale"
arch-chroot /mnt /bin/bash -c "update_mirrorlist"
arch-chroot /mnt /bin/bash -c "install_packages"
arch-chroot /mnt /bin/bash -c "install_ucode"
HOST_NAME="${HOST_NAME}" arch-chroot /mnt /bin/bash -c "set_hostname"
USER_NAME="${USER_NAME}" USER_PASSWORD="${USER_PASSWORD}" arch-chroot /mnt /bin/bash -c "add_user"
arch-chroot /mnt /bin/bash -c "disable_root"
arch-chroot /mnt /bin/bash -c "set_mkinitcpio"
if [[ "${BOOTMODE}" = "GRUB" ]]; then
SCHEME="${SCHEME}" DEVICE="${DEVICE}" \
arch-chroot /mnt /bin/bash -c "install_grub"
if [[ "${SCHEME}" = "LVM on LUKS" ]]; then
CRYPT_PASSWORD="${CRYPT_PASSWORD}" CRYPT_PARTITION="${CRYPT_PARTITION}" \
arch-chroot /mnt /bin/bash -c "make_luks_key"
fi
elif [[ "${BOOTMODE}" = "systemd-boot" ]]; then
cp -f \
"${DIR}/hooks/[email protected]" \
"${DIR}/hooks/[email protected]" \
/mnt/etc/systemd/system/
cp -f "${DIR}/utils/sdboot-mkconfig" /mnt/usr/local/sbin/
chmod +x /mnt/usr/local/sbin/sdboot-mkconfig
SCHEME="${SCHEME}" DEVICE="${DEVICE}" \
arch-chroot /mnt /bin/bash -c "install_gummiboot"
elif [[ "${BOOTMODE}" = "EFISTUB" ]]; then
show_warning "Not supported yet..."
fi
unmount_install
show_success "Done! Reboot now."
}
#
# Check if dependencies are installed and if network is working
#
check_root
check_network
if ! check_install_commands; then
check_sync_repos
install_dependencies
fi
#
# GO!!!
#
main