summaryrefslogtreecommitdiff
path: root/stages
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-03-18 18:09:06 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-03-18 18:09:06 +0100
commit4caebd10edfd7a7d6515185637bd52067bd56ace (patch)
treeac2fa2e4221515796145284ffd8f4bbba06f349b /stages
parent7a26c8516f712ee8ea58690bb5dd696efa920295 (diff)
parentebf7eac32d7ce0f176e269d6647ed1914cdeaff9 (diff)
downloadarchinstall-4caebd10edfd7a7d6515185637bd52067bd56ace.tar
archinstall-4caebd10edfd7a7d6515185637bd52067bd56ace.tar.zst
archinstall-4caebd10edfd7a7d6515185637bd52067bd56ace.zip
Merging feature_bios into devel
Diffstat (limited to 'stages')
-rw-r--r--stages/first_stage.sh163
-rw-r--r--stages/second_stage.sh51
2 files changed, 152 insertions, 62 deletions
diff --git a/stages/first_stage.sh b/stages/first_stage.sh
index 75f5b5a..daf856d 100644
--- a/stages/first_stage.sh
+++ b/stages/first_stage.sh
@@ -18,75 +18,138 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-echo "Entering first_stage.sh - OK"
-
-
-# Settings
-
-export CONFIG_FILE_PATH="/etc/archinstall/config.json"
-export DEFAULT_PASSWORD="archinstall"
-
-
-# Write config
+# Stop at any error to optimize debugging:
-mkdir $(dirname "$CONFIG_FILE_PATH")
-touch $CONFIG_FILE_PATH
-python $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH
+set -e
-# Reading config values to bash
-
-export disk=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "disk")
-export disk_path=/dev/$disk
-export efi_partition_path="${disk_path}1"
-export boot_partition_path="${disk_path}2"
-export main_partition_path="${disk_path}3"
-export hostname=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname")
-export desktop=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop")
-export admin_username=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username")
-export system_encryption=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption")
+# Debug output
+echo "Entering first_stage.sh - OK"
-bash confirm_installation.sh $disk
-bash check_bootmode.sh
+# Check bootmode
-bash partition_disk.sh $disk_path
+if [ -d "/sys/firmware/efi/efivars" ]; then
+ export boot_mode="uefi"
+ echo "Booted with UEFI"
+else
+ export boot_mode="bios"
+ echo "Booted with legacy boot / BIOS"
+fi
-if [ $system_encryption == "yes" ];then
- bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD
+# Partition the disk
- bash open_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD
+if [ "$boot_mode" == "unknown" ]; then
+ echo "boot_mode unknown! - FAILED"
+ exit 1
+fi
- export root_partition_path="/dev/mapper/main"
+if [ "$path_to_disk" == "/dev/null" ]; then
+ echo "path_to_disk has still default value! - FAILED"
+ exit 1
+fi
+if [ "$boot_mode" == "uefi" ]; then
+ echo "Partitioning for UEFI mode."
+ echo "Sorry, this is still untested and you should not try it ..."
+ exit 1
+ wipefs -a $path_to_disk # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $path_to_disk << EOF
+g
+n
+1
+
++512M
+n
+2
+
++200M
+n
+3
+
+
+p
+w
+EOF
+
+ echo "Partitioned disk for UEFI/GPT- OK"
+elif [ "$boot_mode" == "bios" ]; then
+ echo "Partitioning for BIOS mode."
+ wipefs -a $path_to_disk # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $path_to_disk << EOF
+o
+n
+p
+1
+
++200M
+n
+p
+2
+
+
+p
+w
+EOF
+
+ echo "Partitioned disk for BIOS/MBR - OK"
else
-
- export root_partition_path=$main_partition_path
-
+ echo "Unknown boot_mode! - FAILED"
fi
-bash create_filesystems.sh $efi_partition_path $boot_partition_path $root_partition_path
-
-bash mount_filesystems.sh $boot_partition_path $root_partition_path
-
-bash install_packages.sh $desktop
-bash install_archinstall.sh $REPOSITORY_PATH
-
-bash write_fstab.sh
-
-echo "bash second_stage.sh" | arch-chroot /mnt
+# Format and mount partitions
+
+if [ "$luks_encryption" == "no" ];then
+ if [ "$boot_mode" == "bios" ];then
+ echo "Formatting for no disk encryption and bios/mbr"
+ mkfs.ext4 ${path_to_disk}1
+ e2label ${path_to_disk}1 "boot"
+ mkfs.ext4 ${path_to_disk}2
+ e2label ${path_to_disk}2 "root"
+ mount ${path_to_disk}2 /mnt
+ mkdir /mnt/boot
+ mount ${path_to_disk}1 /mnt/boot
+ elif [ "$boot_mode" == "uefi" ];then
+ echo "Formatting for no disk encryption and uefi/gpt"
+ ###
+ echo "Sorry, UEFI is not ready to use ..."
+ exit 1
+ else
+ echo "Unknown boot_mode! - FAILED"
+ exit 1
+ fi
+elif [ "$luks_encryption" == "yes" ];then
+ if [ "$boot_mode" == "bios" ];then
+ echo "Formatting for disk encryption and bios/mbr"
+ ###
+ echo "Sorry, encryption is not ready to use ..."
+ exit 1
+ elif [ "$boot_mode" == "uefi" ];then
+ echo "Formatting for disk encryption and uefi/gpt"
+ ###
+ echo "Sorry, encryption is not ready to use ..."
+ exit 1
+ else
+ echo "Unknown boot_mode! - FAILED"
+ exit 1
+ fi
+else
+ echo "luks_encryption not 'yes' or 'no'! - FAILED"
+ exit 1
+fi
-bash copy_archinstall_log.sh $LOG_FILE_PATH
-bash unmount_filesystems.sh $boot_partition_path $root_partition_path
+# Install packages with pacstrap
-if [ $system_encryption == "yes" ];then
+pacstrap /mnt base linux linux-firmware networkmanager nano grub # maybe this is requiered: efibootmgr
+echo "Installed packages - OK"
- bash close_crypto_partition.sh $main_partition_path
-fi
+# Generate /etc/fstab
-bash print_final_message.sh $DEFAULT_PASSWORD
+genfstab -U /mnt >> /mnt/etc/fstab
diff --git a/stages/second_stage.sh b/stages/second_stage.sh
index 192b946..ea623a7 100644
--- a/stages/second_stage.sh
+++ b/stages/second_stage.sh
@@ -18,25 +18,52 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
+# Stop at any error to optimize debugging:
+
+set -e
+
+
+# Debug output
+
echo "Entering second_stage.sh - OK"
-bash configure_keyboard.sh de-latin1
+# Set timezone
+
+ln -sf $path_to_timezone /etc/localtime
+hwclock --systohc
+
+
+# Localization
+
+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
+
+
+# Network configuration
+
+touch /etc/hostname
+echo "$hostname" > /etc/hostname
+touch /etc/hosts
+echo "127.0.0.1 localhost" >> /etc/hosts
+echo "::1 localhost" >> /etc/hosts
+
+
+# Initramfs
-bash configure_locales.sh
+### to be implemented
-bash configure_timezone.sh /usr/share/zoneinfo/Europe/Berlin
-bash configure_network.sh $hostname
+# Setting root password
-if [ $system_encryption == "yes" ]; then
- bash configure_initramfs.sh
-fi
+echo "root:${DEFAULT_PASSWORD}" | chpasswd
-bash configure_users.sh $admin_username $DEFAULT_PASSWORD
-bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path
+# Install bootloader
-if [ "$desktop" = "yes" ]; then
- bash configure_desktop.sh $desktop
-fi
+grub-install --target=i386-pc $path_to_disk
+grub-mkconfig -o /boot/grub/grub.cfg