summaryrefslogtreecommitdiff
path: root/stages
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-03-22 14:10:42 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-03-22 14:10:42 +0100
commit54861b025565f527a35ee0628365bf62769577d0 (patch)
tree595f6f717f4a30b7063c8bdca6bcadfbe5397496 /stages
parent430b6099046f6a2cfb09caf14c1e8e47ec9d0cfc (diff)
downloadarchinstall-54861b025565f527a35ee0628365bf62769577d0.tar
archinstall-54861b025565f527a35ee0628365bf62769577d0.tar.zst
archinstall-54861b025565f527a35ee0628365bf62769577d0.zip
First complete Version of Rewrite
Diffstat (limited to 'stages')
-rw-r--r--stages/first_stage.sh12
-rw-r--r--stages/second_stage.sh67
2 files changed, 65 insertions, 14 deletions
diff --git a/stages/first_stage.sh b/stages/first_stage.sh
index 85b1119..e6ddc7f 100644
--- a/stages/first_stage.sh
+++ b/stages/first_stage.sh
@@ -23,11 +23,6 @@
set -e
-# debug output
-
-print_ok "Entering first_stage.sh"
-
-
# check bootmode
print_ok "Checking bootmode ..."
@@ -186,16 +181,21 @@ print_ok "Formatting done"
# optimize mirrorlist
-print_ok "Optimize pacman mirrorlist ..."
+print_ok "Optimize /etc/pacman.d/mirrorlist ..."
curl "https://www.archlinux.org/mirrorlist/?country=$pacman_mirror_region&protocol=http&protocol=https&ip_version=4" > /etc/pacman.d/mirrorlist
sed -i '/#Server = *./s/^#//g' /etc/pacman.d/mirrorlist
+print_ok "/etc/pacman.d/mirrorlist optimized"
+
# install packages with pacstrap
+print_ok "Installing Arch Linux packages with 'pacstrap' ..."
pacstrap /mnt $PACKAGE_LIST
print_ok "Installed packages"
# generate /etc/fstab
+print_ok "Generating /etc/fstab ..."
genfstab -U /mnt >> /mnt/etc/fstab
+print_ok "/etc/fstab generated"
diff --git a/stages/second_stage.sh b/stages/second_stage.sh
index 5800828..abf407a 100644
--- a/stages/second_stage.sh
+++ b/stages/second_stage.sh
@@ -23,47 +23,98 @@
set -e
-# debug output
-
-print_ok "Entering second_stage.sh"
-
-
# set timezone
+print_ok "Setting timezone ..."
ln -sf $path_to_timezone /etc/localtime
hwclock --systohc
+print_ok "Timezone set"
# localization
+print_ok "Generating locales ..."
echo "$locales_to_generate" >> /etc/locale.gen
locale-gen
touch /etc/locale.conf
echo "LANG=$language" >> /etc/locale.conf
touch /etc/vconsole.conf
echo "KEYMAP=$keymap" >> /etc/vconsole.conf
+print_ok "Locales generated"
# network configuration
+print_ok "Setting /etc/hostname and /etc/hosts file ..."
touch /etc/hostname
echo "$hostname" > /etc/hostname
touch /etc/hosts
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
+print_ok "/etc/hostname and /etc/hosts configured"
# initramfs
-### to be implemented
+if [ "$luks_encryption" == "yes" ];then
+
+ print_ok "Re-generating initramfs ..."
+
+ old_hooks_config_line=$(cat /etc/mkinitcpio.conf | grep "^HOOKS=")
+ print_ok "Old 'HOOKS' line in /etc/mkinitcpio : $old_hooks_config_line"
+ new_hooks_config_line="HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)"
+ print_ok "New 'HOOKS' line in /etc/mkinitcpio : $new_hooks_config_line"
+
+ sed -i "s|$old_hooks_config_line|$new_hooks_config_line|" /etc/mkinitcpio.conf
+ mkinitcpio -P
+
+ print_ok "Initramfs re-generated"
+
+fi
# setting root password
+print_ok "Setting default password for user 'root' ..."
echo "root:${DEFAULT_PASSWORD}" | chpasswd
+print_ok "Default password for user 'root' set"
+
+
+# install and configure bootloader
+
+print_ok "Installing grub bootloader ..."
+if [ "$boot_mode" == "uefi" ]; then
+ grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \
+ --removable
+else
+ grub-install --target=i386-pc $path_to_disk
+fi
+print_ok "Grub bootloader installed"
+
+if [ $luks_encryption == "yes" ];then
+
+ print_ok "Setup of /etc/default/grub for LUKS encryption ..."
+
+ if [ "$boot_mode" == "uefi" ]; then
+ crypto_partition=${path_to_disk}3
+ else
+ crypto_partition=${path_to_disk}2
+ fi
+
+ cryptdevice_uuid=$(lsblk --fs | grep "$(basename $crypto_partition)" | awk '{print $3}')
+ print_ok "cryptdevice_uuid: $cryptdevice_uuid"
+ old_kernel_param_line=$(cat /etc/default/grub | grep "GRUB_CMDLINE_LINUX_DEFAULT")
+ print_ok "old_kernel_param_line: $old_kernel_param_line"
+ new_kernal_param_line="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet cryptdevice=UUID=${cryptdevice_uuid}:main root=/dev/mapper/main\""
+ print_ok "new_kernel_param_line: $new_kernal_param_line"
+ print_ok "Adding kernel parameters to /etc/default/grub ..."
+ sed -i "s|$old_kernel_param_line|$new_kernal_param_line|" /etc/default/grub
+ print_ok "Kernel parameters added to /etc/default/grub"
+ print_ok "Setup of /etc/default/grub for LUKS encryption done"
-# install bootloader
+fi
-grub-install --target=i386-pc $path_to_disk
+print_ok "Generating /boot/grub/grub.cfg from /etc/default/grub ..."
grub-mkconfig -o /boot/grub/grub.cfg
+print_ok "/boot/grub/grub.cfg generated"