From e12ac9b213ef3e8ecebc0c3052ec7e0e8bd7a31c Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 11:41:39 +0100 Subject: Test for new check_bootmode.sh. --- stages/first_stage.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 75f5b5a..ab99ce1 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -47,6 +47,18 @@ export admin_username=$(python $REPOSITORY_PATH/util/read_config_string.py $CONF export system_encryption=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption") +if [ $(check_bootmode.sh) == "Booted with UEFI" ];then + + echo "Booted with UEFI - OK" + +else + + echo "Booted with BIOS - OK" + +fi + +exit + bash confirm_installation.sh $disk bash check_bootmode.sh -- cgit v1.2.3-70-g09d2 From f06de7db204216d4fe0d1d9a302ca78272afb1ad Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 13:50:48 +0100 Subject: Bugfix according to bash syntax. --- stages/first_stage.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index ab99ce1..03e5252 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -47,7 +47,7 @@ export admin_username=$(python $REPOSITORY_PATH/util/read_config_string.py $CONF export system_encryption=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption") -if [ $(check_bootmode.sh) == "Booted with UEFI" ];then +if [ "$(check_bootmode.sh)" == "Booted with UEFI" ];then echo "Booted with UEFI - OK" @@ -68,9 +68,7 @@ bash partition_disk.sh $disk_path if [ $system_encryption == "yes" ];then bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD - bash open_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD - export root_partition_path="/dev/mapper/main" else -- cgit v1.2.3-70-g09d2 From 19dd3e315bc713f8ad313bf063a1016a903e0df4 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 13:52:48 +0100 Subject: Second bugfix. --- stages/first_stage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 03e5252..acb58f0 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -47,7 +47,7 @@ export admin_username=$(python $REPOSITORY_PATH/util/read_config_string.py $CONF export system_encryption=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption") -if [ "$(check_bootmode.sh)" == "Booted with UEFI" ];then +if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then echo "Booted with UEFI - OK" -- cgit v1.2.3-70-g09d2 From 4d386c57aa1a002bd3d45d1871de8517bd6673e6 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 16:42:06 +0100 Subject: Another test for check_bootmode.sh. --- stages/first_stage.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index acb58f0..03cbb43 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -48,13 +48,14 @@ export system_encryption=$(python $REPOSITORY_PATH/util/read_config_string.py $C if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then - echo "Booted with UEFI - OK" - -else - + export boot_mode="UEFI" +elif [ "$(bash check_bootmode.sh)" == "Booted with legacy boot / BIOS" ];then echo "Booted with BIOS - OK" - + export boot_mode="BIOS" +else + echo "Unknown boot mode - FAILED" + exit fi exit @@ -66,15 +67,11 @@ bash check_bootmode.sh bash partition_disk.sh $disk_path if [ $system_encryption == "yes" ];then - bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD bash open_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD export root_partition_path="/dev/mapper/main" - else - export root_partition_path=$main_partition_path - fi bash create_filesystems.sh $efi_partition_path $boot_partition_path $root_partition_path @@ -94,9 +91,7 @@ bash copy_archinstall_log.sh $LOG_FILE_PATH bash unmount_filesystems.sh $boot_partition_path $root_partition_path if [ $system_encryption == "yes" ];then - bash close_crypto_partition.sh $main_partition_path - fi bash print_final_message.sh $DEFAULT_PASSWORD -- cgit v1.2.3-70-g09d2 From b71ec259f10635f1fb907caa8076bbc2710adf02 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 16:55:12 +0100 Subject: Added -u flag to every python call (bugfix). --- stages/first_stage.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 03cbb43..037d554 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -31,22 +31,24 @@ export DEFAULT_PASSWORD="archinstall" mkdir $(dirname "$CONFIG_FILE_PATH") touch $CONFIG_FILE_PATH -python $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH +python -u $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH # Reading config values to bash -export disk=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "disk") +export disk=$(python -u $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") +export hostname=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname") +export desktop=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop") +export admin_username=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username") +export system_encryption=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption") +bash confirm_installation.sh $disk + if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then echo "Booted with UEFI - OK" export boot_mode="UEFI" @@ -60,10 +62,6 @@ fi exit -bash confirm_installation.sh $disk - -bash check_bootmode.sh - bash partition_disk.sh $disk_path if [ $system_encryption == "yes" ];then -- cgit v1.2.3-70-g09d2 From 2f6a6e43c47a345ca72028177cea92e7307cebff Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 12 Jan 2020 17:40:15 +0100 Subject: First version of BIOS boot. --- README.md | 2 +- stages/first_stage.sh | 13 +++++++------ stages/second_stage.sh | 2 +- util/create_filesystems.sh | 22 ++++++++++++++++------ util/install_bootloader.sh | 23 +++++++++++++++++------ util/mount_filesystems.sh | 7 +++++-- util/partition_disk.sh | 28 ++++++++++++++++++++++++---- util/unmount_filesystems.sh | 4 +++- 8 files changed, 74 insertions(+), 27 deletions(-) (limited to 'stages') diff --git a/README.md b/README.md index 9a3ed39..a49cd5c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s (Highest priority first) - [ ] Support BIOS systems -- [ ] Use LVM - [ ] Create swap partition - [ ] Enable suspension to disk - [ ] Optimize mirrorlist @@ -47,6 +46,7 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s - [ ] Provide recommended package lists - [ ] Set a beautiful theme - [ ] Support english localization +- [ ] Use LVM - [ ] Package for the AUR diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 037d554..cdf661e 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -38,9 +38,6 @@ python -u $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH export disk=$(python -u $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 -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname") export desktop=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop") export admin_username=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username") @@ -52,17 +49,21 @@ bash confirm_installation.sh $disk if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then echo "Booted with UEFI - OK" export boot_mode="UEFI" + export efi_partition_path="${disk_path}1" + export boot_partition_path="${disk_path}2" + export main_partition_path="${disk_path}3" elif [ "$(bash check_bootmode.sh)" == "Booted with legacy boot / BIOS" ];then echo "Booted with BIOS - OK" export boot_mode="BIOS" + export efi_partition_path="/dev/null" + export boot_partition_path="/dev/null" + export main_partition_path="${disk_path}1" else echo "Unknown boot mode - FAILED" exit fi -exit - -bash partition_disk.sh $disk_path +bash partition_disk.sh $disk_path $boot_mode if [ $system_encryption == "yes" ];then bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD diff --git a/stages/second_stage.sh b/stages/second_stage.sh index c2c0b92..30dc495 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -33,6 +33,6 @@ bash configure_initramfs.sh bash configure_users.sh $admin_username $DEFAULT_PASSWORD -bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path +bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path $boot_mode bash configure_desktop.sh diff --git a/util/create_filesystems.sh b/util/create_filesystems.sh index 972eefd..917363e 100644 --- a/util/create_filesystems.sh +++ b/util/create_filesystems.sh @@ -18,15 +18,25 @@ # along with this program. If not, see . -efi_partition_path=$1 # e.g. /dev/sda1 -boot_partition_path=$2 # e.g. /dev/sda2 +efi_partition_path=$1 # e.g. /dev/sda1 or /dev/null if not needed +boot_partition_path=$2 # e.g. /dev/sda2 or /dev/null if not needed root_partition_path=$3 # e.g. /dev/sda3 or /dev/SystemVolumeGroup/root -mkfs.fat -F32 $efi_partition_path -fatlabel $efi_partition_path "EFI" -mkfs.ext4 $boot_partition_path -e2label $boot_partition_path "BOOT" +if [ "$efi_partition_path" != "/dev/null" ]; then # if efi partition is needed + echo "EFI partition needed." + mkfs.fat -F32 $efi_partition_path + fatlabel $efi_partition_path "EFI" +else + echo "EFI partition not needed." +fi +if [ "$boot_partition_path" != "/dev/null" ]; then # if boot partition is needed + echo "BOOT partition needed." + mkfs.ext4 $boot_partition_path + e2label $boot_partition_path "BOOT" +else + echo "BOOT partition not needed." +fi mkfs.ext4 $root_partition_path e2label $root_partition_path "ROOT" diff --git a/util/install_bootloader.sh b/util/install_bootloader.sh index 3f63f64..78ca49b 100644 --- a/util/install_bootloader.sh +++ b/util/install_bootloader.sh @@ -21,11 +21,19 @@ efi_partition_path=$1 system_encryption=$2 main_partition_path=$3 - - -mount $efi_partition_path /mnt -grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \ ---removable +boot_mode=$4 # "UEFI" or "BIOS" + + +if [ "$boot_mode" == "UEFI" ]; then + mount $efi_partition_path /mnt + grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \ + --removable +elif [ "$boot_mode" == "BIOS" ]; then + grub-install --target=i386-pc $disk_path +else + echo "Unknown boot mode - FAILED" + exit +fi if [ $system_encryption == "yes" ];then @@ -41,6 +49,9 @@ if [ $system_encryption == "yes" ];then fi grub-mkconfig -o /boot/grub/grub.cfg -umount $efi_partition_path + +if [ "$boot_mode" == "UEFI" ];then + umount $efi_partition_path +fi echo "Installed bootloader - OK" diff --git a/util/mount_filesystems.sh b/util/mount_filesystems.sh index f24421b..75bbb14 100644 --- a/util/mount_filesystems.sh +++ b/util/mount_filesystems.sh @@ -23,7 +23,10 @@ root_partition_path=$2 mount $root_partition_path /mnt -mkdir /mnt/boot -mount $boot_partition_path /mnt/boot + +if [ "$boot_partition_path" != "/dev/null" ];then + mkdir /mnt/boot + mount $boot_partition_path /mnt/boot +fi echo "Mounted filesystems - OK" diff --git a/util/partition_disk.sh b/util/partition_disk.sh index fcad5b9..6164d1b 100644 --- a/util/partition_disk.sh +++ b/util/partition_disk.sh @@ -19,11 +19,13 @@ disk_path=$1 # e.g. /dev/sda +boot_mode=$2 # "UEFI" or "BIOS" -wipefs -a $disk_path # make sure that fdisk does not ask for removing - # signatures which breaks the script -fdisk $disk_path << EOF +if [ "$boot_mode" == "UEFI" ]; then + wipefs -a $disk_path # make sure that fdisk does not ask for removing + # signatures which breaks the script + fdisk $disk_path << EOF g n 1 @@ -41,4 +43,22 @@ p w EOF -echo "Partitioned disk - OK" + echo "Partitioned disk for UEFI/GPT- OK" +elif [ "$boot_mode" == "BIOS" ]; then + wipefs -a $disk_path # make sure that fdisk does not ask for removing + # signatures which breaks the script + fdisk $disk_path << EOF +o +n +p +1 + + +p +w +EOF + + echo "Partitioned disk for BIOS/MBR - OK" +else + +fi diff --git a/util/unmount_filesystems.sh b/util/unmount_filesystems.sh index 6ccce3b..0980e5a 100644 --- a/util/unmount_filesystems.sh +++ b/util/unmount_filesystems.sh @@ -23,7 +23,9 @@ root_partition_path=$2 cd /root -umount $boot_partition_path +if [ "$boot_partition_path" != "/dev/null" ];then + umount $boot_partition_path +fi umount $root_partition_path echo "Unmounted filesystems - OK" -- cgit v1.2.3-70-g09d2 From f0b4b9058a1631bf2fb4c3d24a3b9dce04acfc7e Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 12:13:51 +0100 Subject: Start from Scratch for a Rewrite --- archinstall.sh | 67 ++++++------------------- stages/first_stage.sh | 76 ++--------------------------- stages/second_stage.sh | 18 ++----- util/check_bootmode.sh | 25 ---------- util/close_crypto_partition.sh | 23 --------- util/configure_desktop.sh | 36 -------------- util/configure_initramfs.sh | 31 ------------ util/configure_keyboard.sh | 27 ----------- util/configure_locales.sh | 30 ------------ util/configure_network.sh | 34 ------------- util/configure_timezone.sh | 27 ----------- util/configure_users.sh | 36 -------------- util/confirm_installation.sh | 36 -------------- util/copy_archinstall_config.sh | 26 ---------- util/copy_archinstall_log.sh | 27 ----------- util/create_filesystems.sh | 43 ---------------- util/format_crypto_partition.sh | 27 ----------- util/install_archinstall.sh | 26 ---------- util/install_bootloader.sh | 57 ---------------------- util/install_packages.sh | 29 ----------- util/mount_filesystems.sh | 32 ------------ util/open_crypto_partition.sh | 27 ----------- util/partition_disk.sh | 66 ------------------------- util/print_final_message.sh | 37 -------------- util/read_config_string.py | 40 --------------- util/unmount_filesystems.sh | 31 ------------ util/write_config.py | 105 ---------------------------------------- util/write_fstab.sh | 23 --------- 28 files changed, 22 insertions(+), 1040 deletions(-) delete mode 100644 util/check_bootmode.sh delete mode 100644 util/close_crypto_partition.sh delete mode 100644 util/configure_desktop.sh delete mode 100644 util/configure_initramfs.sh delete mode 100644 util/configure_keyboard.sh delete mode 100644 util/configure_locales.sh delete mode 100644 util/configure_network.sh delete mode 100644 util/configure_timezone.sh delete mode 100644 util/configure_users.sh delete mode 100644 util/confirm_installation.sh delete mode 100644 util/copy_archinstall_config.sh delete mode 100644 util/copy_archinstall_log.sh delete mode 100644 util/create_filesystems.sh delete mode 100644 util/format_crypto_partition.sh delete mode 100644 util/install_archinstall.sh delete mode 100644 util/install_bootloader.sh delete mode 100644 util/install_packages.sh delete mode 100644 util/mount_filesystems.sh delete mode 100644 util/open_crypto_partition.sh delete mode 100644 util/partition_disk.sh delete mode 100644 util/print_final_message.sh delete mode 100644 util/read_config_string.py delete mode 100644 util/unmount_filesystems.sh delete mode 100644 util/write_config.py delete mode 100644 util/write_fstab.sh (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index 2dfbf9e..47afe7c 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -28,20 +28,9 @@ ################################################################# -# Settings +# Stop at any error to optimize debugging: -export TESTSERVER="archlinux.org" # IP or hostname -export NETWORK_DEADLINE=1 # in seconds -export REPOSITORY_URL="https://github.com/xengineering/archinstall/" # remote -export REPOSITORY_PATH="/opt/archinstall" # local -export BRANCH_OR_COMMIT="master" # select another branch or commit hash for checkout if needed -export LOG_FILE_PATH="/var/log/archinstall.log" - - -# PATH expansion - -export PATH=$PATH:$REPOSITORY_PATH/stages -export PATH=$PATH:$REPOSITORY_PATH/util +set -e # Greetings @@ -63,45 +52,21 @@ cat << EOF EOF -# Check internet connection - -if ping -w $NETWORK_DEADLINE -c 1 $TESTSERVER; then - echo "Internet connection is ready - OK" - echo "" -else - echo "Could not reach testserver '$TESTSERVER' - FAILED" - exit -fi - - -# Update the system clock - -timedatectl set-ntp true -if [ $? -eq 0 ]; then - echo "Updated system clock - OK" - echo "" -else - echo "Could not update system clock - FAILED" - exit -fi - - -# Cloning Git repository - -echo "Cloning git repository ..." -echo "" - -pacman --noconfirm -Sy git -mkdir $REPOSITORY_PATH -git clone $REPOSITORY_URL $REPOSITORY_PATH -cd $REPOSITORY_PATH -git checkout $BRANCH_OR_COMMIT -cd +# Constants -echo "Git repository cloned - OK" -echo "" +export INTERNET_TEST_SERVER="archlinux.org" +export INTERNET_TEST_PING_TIMEOUT=1 # seconds +export FIRST_STAGE_LINK="" +export SECOND_STAGE_LINK="" +export PACKAGE_LIST="base linux linux-firmware nano networkmanager" +export DEFAULT_PASSWORD="archinstall" -# Launching first stage +# Variables -bash first_stage.sh | tee -a $LOG_FILE_PATH +export boot_mode="unknown" # alternatives: "bios" or "uefi" +export luks_encryption="unknown" # alternatives: "yes" or "no" +export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" +export locales_to_generate="de_DE.UTF-8 UTF-8;de_DE ISO-8859-1;de_DE@euro ISO-8859-15" +export keymap="de-latin1" +export hostname="archlinux" # will be set to a user-chosen hostname diff --git a/stages/first_stage.sh b/stages/first_stage.sh index cdf661e..fe5e1bb 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -18,79 +18,9 @@ # along with this program. If not, see . -echo "Entering first_stage.sh - OK" - - -# Settings - -export CONFIG_FILE_PATH="/etc/archinstall/config.json" -export DEFAULT_PASSWORD="archinstall" - - -# Write config - -mkdir $(dirname "$CONFIG_FILE_PATH") -touch $CONFIG_FILE_PATH -python -u $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH - - -# Reading config values to bash - -export disk=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "disk") -export disk_path=/dev/$disk -export hostname=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname") -export desktop=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop") -export admin_username=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username") -export system_encryption=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "system_encryption") - - -bash confirm_installation.sh $disk +# Stop at any error to optimize debugging: -if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then - echo "Booted with UEFI - OK" - export boot_mode="UEFI" - export efi_partition_path="${disk_path}1" - export boot_partition_path="${disk_path}2" - export main_partition_path="${disk_path}3" -elif [ "$(bash check_bootmode.sh)" == "Booted with legacy boot / BIOS" ];then - echo "Booted with BIOS - OK" - export boot_mode="BIOS" - export efi_partition_path="/dev/null" - export boot_partition_path="/dev/null" - export main_partition_path="${disk_path}1" -else - echo "Unknown boot mode - FAILED" - exit -fi +set -e -bash partition_disk.sh $disk_path $boot_mode -if [ $system_encryption == "yes" ];then - bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD - bash open_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD - export root_partition_path="/dev/mapper/main" -else - export root_partition_path=$main_partition_path -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 - -bash copy_archinstall_log.sh $LOG_FILE_PATH - -bash unmount_filesystems.sh $boot_partition_path $root_partition_path - -if [ $system_encryption == "yes" ];then - bash close_crypto_partition.sh $main_partition_path -fi - -bash print_final_message.sh $DEFAULT_PASSWORD +echo "Entering first_stage.sh - OK" diff --git a/stages/second_stage.sh b/stages/second_stage.sh index 30dc495..abb8ed9 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -18,21 +18,9 @@ # along with this program. If not, see . -echo "Entering second_stage.sh - OK" - - -bash configure_keyboard.sh de-latin1 - -bash configure_locales.sh +# Stop at any error to optimize debugging: -bash configure_timezone.sh /usr/share/zoneinfo/Europe/Berlin +set -e -bash configure_network.sh $hostname -bash configure_initramfs.sh - -bash configure_users.sh $admin_username $DEFAULT_PASSWORD - -bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path $boot_mode - -bash configure_desktop.sh +echo "Entering second_stage.sh - OK" diff --git a/util/check_bootmode.sh b/util/check_bootmode.sh deleted file mode 100644 index 26f929c..0000000 --- a/util/check_bootmode.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -if [ -d "/sys/firmware/efi/efivars" ]; then - echo "Booted with UEFI" -else - echo "Booted with legacy boot / BIOS" -fi diff --git a/util/close_crypto_partition.sh b/util/close_crypto_partition.sh deleted file mode 100644 index de96f6c..0000000 --- a/util/close_crypto_partition.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -cryptsetup close main - -echo "Closed crypto partition - OK" diff --git a/util/configure_desktop.sh b/util/configure_desktop.sh deleted file mode 100644 index c002e70..0000000 --- a/util/configure_desktop.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -systemctl enable lightdm - -cat > /etc/X11/xorg.conf.d/00-keyboard.conf << EOF -# Written by systemd-localed(8), read by systemd-localed and Xorg. It's -# probably wise not to edit this file manually. Use localectl(1) to -# instruct systemd-localed to update it. -Section "InputClass" - Identifier "system-keyboard" - MatchIsKeyboard "on" - Option "XkbLayout" "de" - Option "XkbModel" "pc105" - Option "XkbVariant" "nodeadkeys" -EndSection -EOF - -echo "Configured desktop - OK" diff --git a/util/configure_initramfs.sh b/util/configure_initramfs.sh deleted file mode 100644 index 3222a89..0000000 --- a/util/configure_initramfs.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -new_hooks_config_line="HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)" -echo "new_hooks_config_line: $new_hooks_config_line" -old_hooks_config_line=$(cat /etc/mkinitcpio.conf | grep "^HOOKS=") -echo "old_hooks_config_line: $old_hooks_config_line" - -sed -i "s|$old_hooks_config_line|$new_hooks_config_line|" /etc/mkinitcpio.conf - -mkinitcpio -P - - -echo "Configured initramfs - OK" diff --git a/util/configure_keyboard.sh b/util/configure_keyboard.sh deleted file mode 100644 index 9a1a1a3..0000000 --- a/util/configure_keyboard.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -keymap=$1 # e.g. "de-latin1" - - -touch /etc/vconsole.conf -echo "KEYMAP=$keymap" > /etc/vconsole.conf - -echo "Keyboard configuration done - OK" diff --git a/util/configure_locales.sh b/util/configure_locales.sh deleted file mode 100644 index 3488bb7..0000000 --- a/util/configure_locales.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen -echo "de_DE ISO-8859-1" >> /etc/locale.gen -echo "de_DE@euro ISO-8859-15" >> /etc/locale.gen - -locale-gen - -touch /etc/locale.conf -echo "LANG=de_DE.UTF-8" > /etc/locale.conf - -echo "Configured locales - OK" diff --git a/util/configure_network.sh b/util/configure_network.sh deleted file mode 100644 index fd85e36..0000000 --- a/util/configure_network.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -hostname=$1 - - -touch /etc/hostname -echo $hostname > /etc/hostname - -touch /etc/hosts -echo "" >> /etc/hosts -echo "127.0.0.1 localhost" >> /etc/hosts -echo "::1 localhost" >> /etc/hosts - -systemctl enable dhcpcd - -echo "Configured network - OK" diff --git a/util/configure_timezone.sh b/util/configure_timezone.sh deleted file mode 100644 index fce6d99..0000000 --- a/util/configure_timezone.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -timezone=$1 # e.g. /usr/share/zoneinfo/Europe/Berlin - - -ln -sf $timezone /etc/localtime -hwclock --systohc - -echo "Configured timezone - OK" diff --git a/util/configure_users.sh b/util/configure_users.sh deleted file mode 100644 index 4c5f4ea..0000000 --- a/util/configure_users.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -admin_username=$1 -default_password=$2 - - -echo "root:${default_password}" | chpasswd - -useradd -m $admin_username # create user and according home directory -usermod -aG wheel $admin_username # add user to sudo-priviledged wheel group -echo "${admin_username}:${default_password}" | chpasswd - -sed -i '/%wheel ALL=(ALL) ALL/s/^# //g' /etc/sudoers # activate wheel group - # by uncommenting special - # line in sudoers file -passwd -l root # lock the root account - -echo "Configured users - OK" diff --git a/util/confirm_installation.sh b/util/confirm_installation.sh deleted file mode 100644 index 35112dd..0000000 --- a/util/confirm_installation.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -disk=$1 # e.g. sda - - -echo "All data on disk '$disk' will be finally lost!" -echo "Are you SURE that you want to install Arch Linux to '$disk'?!" -echo "Type 'Yes' for installation and 'No' for abort." -read answer -if [ $answer == "Yes" ]; then - echo "" - echo "Confirmed installation - OK" - echo "" -else - echo "" - echo "Abort of installation process!" - exit -fi diff --git a/util/copy_archinstall_config.sh b/util/copy_archinstall_config.sh deleted file mode 100644 index a56a222..0000000 --- a/util/copy_archinstall_config.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -config_file_path=$1 # e.g. "/var/log/archinstall.log" - - -cp $config_file_path /mnt$config_file_path - -echo "Copied archinstall configuration - OK" diff --git a/util/copy_archinstall_log.sh b/util/copy_archinstall_log.sh deleted file mode 100644 index 5f2a8b8..0000000 --- a/util/copy_archinstall_log.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -log_file_path=$1 # e.g. "/etc/archinstall/config.json" - - -mkdir /mnt$(dirname "$log_file_path") -cp $log_file_path /mnt$log_file_path - -echo "Copied archinstall log - OK" diff --git a/util/create_filesystems.sh b/util/create_filesystems.sh deleted file mode 100644 index 917363e..0000000 --- a/util/create_filesystems.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -efi_partition_path=$1 # e.g. /dev/sda1 or /dev/null if not needed -boot_partition_path=$2 # e.g. /dev/sda2 or /dev/null if not needed -root_partition_path=$3 # e.g. /dev/sda3 or /dev/SystemVolumeGroup/root - - -if [ "$efi_partition_path" != "/dev/null" ]; then # if efi partition is needed - echo "EFI partition needed." - mkfs.fat -F32 $efi_partition_path - fatlabel $efi_partition_path "EFI" -else - echo "EFI partition not needed." -fi -if [ "$boot_partition_path" != "/dev/null" ]; then # if boot partition is needed - echo "BOOT partition needed." - mkfs.ext4 $boot_partition_path - e2label $boot_partition_path "BOOT" -else - echo "BOOT partition not needed." -fi -mkfs.ext4 $root_partition_path -e2label $root_partition_path "ROOT" - -echo "Created filesystems - OK" diff --git a/util/format_crypto_partition.sh b/util/format_crypto_partition.sh deleted file mode 100644 index 688e280..0000000 --- a/util/format_crypto_partition.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -main_partition_path=$1 -DEFAULT_PASSWORD=$2 - - -echo -n "$DEFAULT_PASSWORD" | cryptsetup luksFormat $main_partition_path - - -echo "Formatted crypto partition - OK" diff --git a/util/install_archinstall.sh b/util/install_archinstall.sh deleted file mode 100644 index 67aee15..0000000 --- a/util/install_archinstall.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -repository_path=$1 # e.g. "/opt/archinstall" - - -cp -r $repository_path /mnt$repository_path - -echo "Installed archinstall - OK" diff --git a/util/install_bootloader.sh b/util/install_bootloader.sh deleted file mode 100644 index 78ca49b..0000000 --- a/util/install_bootloader.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -efi_partition_path=$1 -system_encryption=$2 -main_partition_path=$3 -boot_mode=$4 # "UEFI" or "BIOS" - - -if [ "$boot_mode" == "UEFI" ]; then - mount $efi_partition_path /mnt - grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \ - --removable -elif [ "$boot_mode" == "BIOS" ]; then - grub-install --target=i386-pc $disk_path -else - echo "Unknown boot mode - FAILED" - exit -fi - -if [ $system_encryption == "yes" ];then - - cryptdevice_uuid=$(lsblk --fs | grep "$(basename $main_partition_path)" | awk '{print $3}') - echo "cryptdevice_uuid: $cryptdevice_uuid" - old_kernel_param_line=$(cat /etc/default/grub | grep "GRUB_CMDLINE_LINUX_DEFAULT") - echo "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\"" - echo "new_kernel_param_line: $new_kernal_param_line" - echo "Adding kernel parameters to /etc/default/grub" - sed -i "s|$old_kernel_param_line|$new_kernal_param_line|" /etc/default/grub - -fi - -grub-mkconfig -o /boot/grub/grub.cfg - -if [ "$boot_mode" == "UEFI" ];then - umount $efi_partition_path -fi - -echo "Installed bootloader - OK" diff --git a/util/install_packages.sh b/util/install_packages.sh deleted file mode 100644 index 44fe0b4..0000000 --- a/util/install_packages.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -desktop_wanted=$1 # e.g. "yes" - - -pacstrap /mnt base linux linux-firmware dhcpcd nano sudo grub efibootmgr -if [ "$desktop_wanted" = "yes" ]; then - pacstrap /mnt xorg lightdm lightdm-gtk-greeter light-locker accountsservice gnome-screensaver xfce4-pulseaudio-plugin network-manager-applet xfce4 mousepad -fi - -echo "Installed packages - OK" diff --git a/util/mount_filesystems.sh b/util/mount_filesystems.sh deleted file mode 100644 index 75bbb14..0000000 --- a/util/mount_filesystems.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -boot_partition_path=$1 -root_partition_path=$2 - - -mount $root_partition_path /mnt - -if [ "$boot_partition_path" != "/dev/null" ];then - mkdir /mnt/boot - mount $boot_partition_path /mnt/boot -fi - -echo "Mounted filesystems - OK" diff --git a/util/open_crypto_partition.sh b/util/open_crypto_partition.sh deleted file mode 100644 index 40e7a61..0000000 --- a/util/open_crypto_partition.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -main_partition_path=$1 -DEFAULT_PASSWORD=$2 - - -echo -n "$DEFAULT_PASSWORD" | cryptsetup open $main_partition_path main - - -echo "Opened crypto partition - OK" diff --git a/util/partition_disk.sh b/util/partition_disk.sh deleted file mode 100644 index a7a1087..0000000 --- a/util/partition_disk.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -disk_path=$1 # e.g. /dev/sda -boot_mode=$2 # "UEFI" or "BIOS" - - -if [ "$boot_mode" == "UEFI" ]; then - echo "Partitioning for UEFI mode." - wipefs -a $disk_path # make sure that fdisk does not ask for removing - # signatures which breaks the script - fdisk $disk_path << 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 $disk_path # make sure that fdisk does not ask for removing - # signatures which breaks the script - fdisk $disk_path << EOF -o -n -p -1 - - -p -w -EOF - - echo "Partitioned disk for BIOS/MBR - OK" -else - -fi diff --git a/util/print_final_message.sh b/util/print_final_message.sh deleted file mode 100644 index 46e99b9..0000000 --- a/util/print_final_message.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -default_password=$1 - - -cat << EOF -##################################################################### - - The default password for your user and root is '${default_password}'. - It is also the default password for drive encryption. - You can now power off your machine with 'poweroff', - remove the installation media and boot your new - Arch Linux machine! - -##################################################################### - -EOF - -echo "Printed final message - OK" diff --git a/util/read_config_string.py b/util/read_config_string.py deleted file mode 100644 index 86febd1..0000000 --- a/util/read_config_string.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -########################## -# get_config_string.py # -########################## - - -import sys -import json - - -config_file_path = sys.argv[1] -requested_detail = sys.argv[2] - - -with open(config_file_path) as f: - config_json = f.read() - -config = json.loads(config_json) - - -print(config[requested_detail]) diff --git a/util/unmount_filesystems.sh b/util/unmount_filesystems.sh deleted file mode 100644 index 0980e5a..0000000 --- a/util/unmount_filesystems.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -boot_partition_path=$1 -root_partition_path=$2 - - -cd /root -if [ "$boot_partition_path" != "/dev/null" ];then - umount $boot_partition_path -fi -umount $root_partition_path - -echo "Unmounted filesystems - OK" diff --git a/util/write_config.py b/util/write_config.py deleted file mode 100644 index 2c694eb..0000000 --- a/util/write_config.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -import sys -import json -import subprocess - - -config_file_path = sys.argv[1] # e.g. "/etc/archinstall/config.json" - - -def print_separator(): - print() - print("#################################################################") - print() - - -config = {} - - -# Disk selection - -print_separator() -print("Please type in the 'NAME' of the hard disk on which you want to \ninstall Arch Linux:") -print() -subprocess.run("lsblk -o NAME,SIZE,TYPE | grep -v part", shell=True) -print() -config["disk"] = input(">>> ") - - -# Select hostname - -print_separator() -print("Please type in the hostname of your new machine:") -print() -config["hostname"] = input(">>> ") - - -# Desktop or no desktop - -print_separator() -print("Do you want to install a desktop? [Y/n]:") -print() -answer = input(">>> ") -if answer in ["", "Y", "y", "Yes", "yes"]: - config["desktop"] = "yes" -else: - config["desktop"] = "no" - - -# Admin account - -print_separator() -print("Please select your username (like 'paul' or 'alice'):") -print() -config["admin_username"] = input(">>> ") - - -# System encryption - -print_separator() -print("System encryption protects all your data if your device is stolen.") -print("A second password will be required at startup to decrypt the system.") -print("Do you want to encrypt your system? [Y/n]") -print() -answer = input(">>> ") -if answer in ["", "Y", "y", "Yes", "yes"]: - config["system_encryption"] = "yes" -else: - config["system_encryption"] = "no" - - -# Write config to json file - -config_json = json.dumps(config, indent=4) -with open(config_file_path, 'w') as f: - f.write(config_json) - - -# Output json config for logging purpose - -print_separator() -print("Config for this installation:") -print() -print(config_json) -print_separator() - -print("Wrote config - OK") diff --git a/util/write_fstab.sh b/util/write_fstab.sh deleted file mode 100644 index 61b1128..0000000 --- a/util/write_fstab.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - -# archinstall - A minimal Installation Script for Arch Linux -# Copyright (C) 2019 xengineering - -# 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 . - - -genfstab -U /mnt >> /mnt/etc/fstab - -echo "Wrote /etc/fstab - OK" -- cgit v1.2.3-70-g09d2 From 3d4061b6cec978642f2ca9b2de9c6dd9dff5c37b Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 13:33:26 +0100 Subject: Implement Partitioning --- archinstall.sh | 25 +++++++++++++++---- stages/first_stage.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 4 deletions(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index eedb287..1fc28fc 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -56,9 +56,9 @@ EOF export BRANCH="master" # possible alternatives: "devel" or "feature_" export INTERNET_TEST_SERVER="archlinux.org" -export INTERNET_TEST_PING_TIMEOUT=1 # seconds -export FIRST_STAGE_LINK="" -export SECOND_STAGE_LINK="" +export INTERNET_TEST_PING_TIMEOUT=1 # in seconds +export FIRST_STAGE_LINK="https://raw.githubusercontent.com/xengineering/archinstall/$BRANCH/stages/first_stage.sh" +export SECOND_STAGE_LINK="https://raw.githubusercontent.com/xengineering/archinstall/$BRANCH/stages/second_stage.sh" export PACKAGE_LIST="base linux linux-firmware nano networkmanager" export DEFAULT_PASSWORD="archinstall" @@ -66,6 +66,7 @@ export DEFAULT_PASSWORD="archinstall" # Variables export boot_mode="unknown" # alternatives: "bios" or "uefi" +export path_to_disk="/dev/null" # e.g. "/dev/sda" export luks_encryption="unknown" # alternatives: "yes" or "no" export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" export locales_to_generate="de_DE.UTF-8 UTF-8;de_DE ISO-8859-1;de_DE@euro ISO-8859-15" @@ -73,7 +74,23 @@ export keymap="de-latin1" export hostname="archlinux" # will be set to a user-chosen hostname +# Check internet connection + +if ping -w $INTERNET_TEST_PING_TIMEOUT -c 1 $INTERNET_TEST_SERVER; then + echo "Internet connection is ready - OK" + echo "" +else + echo "Could not reach INTERNET_TEST_SERVER '$INTERNET_TEST_SERVER' - FAILED" + exit +fi + + +# Update the system clock + +timedatectl set-ntp true + + # Download and run first stage -curl https://raw.githubusercontent.com/xengineering/archinstall/$BRANCH/stages/first_stage.sh > /root/first_stage.sh +curl $FIRST_STAGE_LINK > /root/first_stage.sh bash /root/first_stage.sh diff --git a/stages/first_stage.sh b/stages/first_stage.sh index fe5e1bb..8b91c9e 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -24,3 +24,69 @@ set -e echo "Entering first_stage.sh - OK" + + +# Check bootmode + +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 + + +# Partition the disk + +if [ "$boot_mode" == "unknown" ]; then + echo "boot_mode unknown! - FAILED" + exit 1 +fi + +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." + 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 + + +p +w +EOF + + echo "Partitioned disk for BIOS/MBR - OK" +else +fi -- cgit v1.2.3-70-g09d2 From 4271df687f16c4ba2bd349ac427b04aca7608154 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 13:40:03 +0100 Subject: Bugfix --- archinstall.sh | 2 +- stages/first_stage.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index 1fc28fc..82f76d1 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -54,7 +54,7 @@ EOF # Constants -export BRANCH="master" # possible alternatives: "devel" or "feature_" +export BRANCH="feature_bios" # possible alternatives: "devel" or "feature_" export INTERNET_TEST_SERVER="archlinux.org" export INTERNET_TEST_PING_TIMEOUT=1 # in seconds export FIRST_STAGE_LINK="https://raw.githubusercontent.com/xengineering/archinstall/$BRANCH/stages/first_stage.sh" diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 8b91c9e..de850e1 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -89,4 +89,5 @@ EOF echo "Partitioned disk for BIOS/MBR - OK" else + fi -- cgit v1.2.3-70-g09d2 From 85efdc6c00d89cd42f2c91331c2df299e6c4e872 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 13:42:35 +0100 Subject: Second Bugfix --- stages/first_stage.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index de850e1..b8f31dd 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -88,6 +88,4 @@ w EOF echo "Partitioned disk for BIOS/MBR - OK" -else - fi -- cgit v1.2.3-70-g09d2 From 33e55cffe600919b295f7a4fb0c621ba3b5db04e Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 18:18:34 +0100 Subject: Implement if/elif Blocks for Partition Formatting --- archinstall.sh | 2 +- stages/first_stage.sh | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index 82f76d1..ddec69c 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -67,7 +67,7 @@ export DEFAULT_PASSWORD="archinstall" export boot_mode="unknown" # alternatives: "bios" or "uefi" export path_to_disk="/dev/null" # e.g. "/dev/sda" -export luks_encryption="unknown" # alternatives: "yes" or "no" +export luks_encryption="no" # alternative: "yes" export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" export locales_to_generate="de_DE.UTF-8 UTF-8;de_DE ISO-8859-1;de_DE@euro ISO-8859-15" export keymap="de-latin1" diff --git a/stages/first_stage.sh b/stages/first_stage.sh index b8f31dd..dcd2cbd 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -51,6 +51,8 @@ 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 @@ -89,3 +91,24 @@ EOF echo "Partitioned disk for BIOS/MBR - OK" fi + + +# Format partitions + +if [ "$luks_encryption" == "no" ];then + if [ "$boot_mode" == "bios" ];then + echo "no/bios" + elif [ "$boot_mode" == "uefi" ];then + echo "no/uefi" + else + echo "oh no" + fi +elif [ "$luks_encryption" == "yes" ];then + if [ "$boot_mode" == "bios" ];then + echo "yes/bios" + elif [ "$boot_mode" == "uefi" ];then + echo "yes/uefi" + else + echo "oh no" + fi +fi -- cgit v1.2.3-70-g09d2 From f2fe1d86547458435c28ac96e023ee1cd773e161 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 18:22:27 +0100 Subject: Bugfix --- stages/first_stage.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index dcd2cbd..2dc2ee7 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -111,4 +111,6 @@ elif [ "$luks_encryption" == "yes" ];then else echo "oh no" fi +else + echo "oh no" fi -- cgit v1.2.3-70-g09d2 From 70e14eed39cb5c3b0f1220a2ff19851a85b9a90a Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 18:54:26 +0100 Subject: Implement Formatting for BIOS without LUKS --- stages/first_stage.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 2dc2ee7..204548f 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -97,20 +97,27 @@ fi if [ "$luks_encryption" == "no" ];then if [ "$boot_mode" == "bios" ];then - echo "no/bios" + mkfs.ext4 ${disk_path}1 + e2label ${disk_path}1 "ROOT" elif [ "$boot_mode" == "uefi" ];then - echo "no/uefi" + echo "Sorry, UEFI is not ready to use ..." + exit 1 else - echo "oh no" + echo "Unknown boot_mode! - FAILED" + exit 1 fi elif [ "$luks_encryption" == "yes" ];then + echo "Sorry, LUKS encryption is not ready to use ..." + exit 1 if [ "$boot_mode" == "bios" ];then echo "yes/bios" elif [ "$boot_mode" == "uefi" ];then echo "yes/uefi" else - echo "oh no" + echo "Unknown boot_mode! - FAILED" + exit 1 fi else - echo "oh no" + echo "luks_encryption not 'yes' or 'no'! - FAILED" + exit 1 fi -- cgit v1.2.3-70-g09d2 From fd30949efaea3d564f2a954a585d93264d671760 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 17 Mar 2020 18:57:12 +0100 Subject: Bugfix --- stages/first_stage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 204548f..ad2f6d4 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -97,8 +97,8 @@ fi if [ "$luks_encryption" == "no" ];then if [ "$boot_mode" == "bios" ];then - mkfs.ext4 ${disk_path}1 - e2label ${disk_path}1 "ROOT" + mkfs.ext4 ${path_to_disk}1 + e2label ${path_to_disk}1 "ROOT" elif [ "$boot_mode" == "uefi" ];then echo "Sorry, UEFI is not ready to use ..." exit 1 -- cgit v1.2.3-70-g09d2 From 8c6f99bf7fad289814537e1d915028ebae4a03b3 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 10:19:02 +0100 Subject: Implement seperate Boot Partition for BIOS/no LUKS --- archinstall.sh | 6 ++++++ stages/first_stage.sh | 28 +++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index ddec69c..86c8680 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -94,3 +94,9 @@ timedatectl set-ntp true curl $FIRST_STAGE_LINK > /root/first_stage.sh bash /root/first_stage.sh + + +# Download and run second stage + +#curl $SECOND_STAGE_LINK > /mnt/root/second_stage.sh +#echo "bash /root/second_stage.sh" | arch-chroot /mnt diff --git a/stages/first_stage.sh b/stages/first_stage.sh index ad2f6d4..000255c 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -23,6 +23,8 @@ set -e +# Debug output + echo "Entering first_stage.sh - OK" @@ -84,12 +86,19 @@ n p 1 ++200M +n +p +2 + p w EOF echo "Partitioned disk for BIOS/MBR - OK" +else + echo "Unknown boot_mode! - FAILED" fi @@ -97,9 +106,14 @@ fi 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 "ROOT" + e2label ${path_to_disk}1 "boot" + mkfs.ext4 ${path_to_disk}2 + e2label ${path_to_disk}2 "root" 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 @@ -107,12 +121,16 @@ if [ "$luks_encryption" == "no" ];then exit 1 fi elif [ "$luks_encryption" == "yes" ];then - echo "Sorry, LUKS encryption is not ready to use ..." - exit 1 if [ "$boot_mode" == "bios" ];then - echo "yes/bios" + echo "Formatting for disk encryption and bios/mbr" + ### + echo "Sorry, encryption is not ready to use ..." + exit 1 elif [ "$boot_mode" == "uefi" ];then - echo "yes/uefi" + 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 -- cgit v1.2.3-70-g09d2 From 1a582b6a1721dab41a8433a652143e7318ddbf32 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 12:22:12 +0100 Subject: Implement first Stage for Rewrite --- stages/first_stage.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index 000255c..e5b4ee6 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -102,7 +102,7 @@ else fi -# Format partitions +# Format and mount partitions if [ "$luks_encryption" == "no" ];then if [ "$boot_mode" == "bios" ];then @@ -111,6 +111,8 @@ if [ "$luks_encryption" == "no" ];then e2label ${path_to_disk}1 "boot" mkfs.ext4 ${path_to_disk}2 e2label ${path_to_disk}2 "root" + mount ${path_to_disk}2 /mnt + mount ${path_to_disk}1 /mnt/boot elif [ "$boot_mode" == "uefi" ];then echo "Formatting for no disk encryption and uefi/gpt" ### @@ -139,3 +141,14 @@ else echo "luks_encryption not 'yes' or 'no'! - FAILED" exit 1 fi + + +# Install packages with pacstrap + +pacstrap /mnt base linux linux-firmware networkmanager nano grub # maybe this is requiered: efibootmgr +echo "Installed packages - OK" + + +# Generate /etc/fstab + +genfstab -U /mnt >> /mnt/etc/fstab -- cgit v1.2.3-70-g09d2 From e9aa6ad0bc94473e165a1b878827f7a537d88acb Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 12:44:49 +0100 Subject: Bugfix --- stages/first_stage.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'stages') diff --git a/stages/first_stage.sh b/stages/first_stage.sh index e5b4ee6..daf856d 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -112,6 +112,7 @@ if [ "$luks_encryption" == "no" ];then 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" -- cgit v1.2.3-70-g09d2 From 9a3fb771fbce4b9ace6ee4bebdd60c9985210dff Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 14:02:16 +0100 Subject: Implement Timezone and Localization --- archinstall.sh | 3 ++- stages/second_stage.sh | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index dbff991..6f02551 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -70,7 +70,8 @@ export boot_mode="unknown" # alternatives: "bios" or "uefi" export path_to_disk="/dev/sda" # e.g. "/dev/sda" ######################## REMOVE FOR PRODUCTION export luks_encryption="no" # alternative: "yes" export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" -export locales_to_generate="de_DE.UTF-8 UTF-8;de_DE ISO-8859-1;de_DE@euro ISO-8859-15" +export locales_to_generate="de_DE.UTF-8 UTF-8\nde_DE ISO-8859-1\nde_DE@euro ISO-8859-15\n" +export language="de_DE.UTF-8" export keymap="de-latin1" export hostname="archlinux" # will be set to a user-chosen hostname diff --git a/stages/second_stage.sh b/stages/second_stage.sh index abb8ed9..3070e50 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -23,4 +23,22 @@ set -e +# Debug output + echo "Entering second_stage.sh - OK" + + +# 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 -- cgit v1.2.3-70-g09d2 From b3f36598ba1cfba147824dca69e793c29e3b13eb Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 17:16:54 +0100 Subject: Implement Network Config and Root Password --- archinstall.sh | 2 +- stages/second_stage.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index 6f02551..40f6575 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -70,7 +70,7 @@ export boot_mode="unknown" # alternatives: "bios" or "uefi" export path_to_disk="/dev/sda" # e.g. "/dev/sda" ######################## REMOVE FOR PRODUCTION export luks_encryption="no" # alternative: "yes" export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" -export locales_to_generate="de_DE.UTF-8 UTF-8\nde_DE ISO-8859-1\nde_DE@euro ISO-8859-15\n" +export locales_to_generate="de_DE.UTF-8 UTF-8" # currently just one option export language="de_DE.UTF-8" export keymap="de-latin1" export hostname="archlinux" # will be set to a user-chosen hostname diff --git a/stages/second_stage.sh b/stages/second_stage.sh index 3070e50..1530a7d 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -42,3 +42,22 @@ 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 + +### to be implemented + + +# Setting root password + +echo "root:${DEFAULT_PASSWORD}" | chpasswd -- cgit v1.2.3-70-g09d2 From c8929e831da5916c423cd39400e3eafa6e653254 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 17:25:39 +0100 Subject: Implement Bootloader Installation --- stages/second_stage.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'stages') diff --git a/stages/second_stage.sh b/stages/second_stage.sh index 1530a7d..ea623a7 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -61,3 +61,9 @@ echo "::1 localhost" >> /etc/hosts # Setting root password echo "root:${DEFAULT_PASSWORD}" | chpasswd + + +# Install bootloader + +grub-install --target=i386-pc $path_to_disk +grub-mkconfig -o /boot/grub/grub.cfg -- cgit v1.2.3-70-g09d2 From cc1553589ece2030e1d00cc75bb0ed16ff00cda8 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 17:35:37 +0100 Subject: Implement full Test Setup --- archinstall.sh | 6 +++--- stages/second_stage.sh | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'stages') diff --git a/archinstall.sh b/archinstall.sh index 40f6575..c1daaf9 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -67,7 +67,7 @@ export DEFAULT_PASSWORD="archinstall" # Variables export boot_mode="unknown" # alternatives: "bios" or "uefi" -export path_to_disk="/dev/sda" # e.g. "/dev/sda" ######################## REMOVE FOR PRODUCTION +export path_to_disk="/dev/null" # e.g. "/dev/sda" export luks_encryption="no" # alternative: "yes" export path_to_timezone="/usr/share/zoneinfo/Europe/Berlin" export locales_to_generate="de_DE.UTF-8 UTF-8" # currently just one option @@ -94,8 +94,8 @@ timedatectl set-ntp true # Download and run first stage -#curl $FIRST_STAGE_LINK > /root/first_stage.sh -#bash /root/first_stage.sh +curl $FIRST_STAGE_LINK > /root/first_stage.sh +bash /root/first_stage.sh # Download and run second stage diff --git a/stages/second_stage.sh b/stages/second_stage.sh index ea623a7..be55b29 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -66,4 +66,5 @@ echo "root:${DEFAULT_PASSWORD}" | chpasswd # Install bootloader grub-install --target=i386-pc $path_to_disk +mkdir /boot/grub grub-mkconfig -o /boot/grub/grub.cfg -- cgit v1.2.3-70-g09d2 From f72dcdc8c85707910ea3ad174196e6bc4db8ff17 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 17:43:09 +0100 Subject: Testpatch --- stages/second_stage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stages') diff --git a/stages/second_stage.sh b/stages/second_stage.sh index be55b29..b5b3afb 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -66,5 +66,5 @@ echo "root:${DEFAULT_PASSWORD}" | chpasswd # Install bootloader grub-install --target=i386-pc $path_to_disk -mkdir /boot/grub -grub-mkconfig -o /boot/grub/grub.cfg +#mkdir /boot/grub +#grub-mkconfig -o /boot/grub/grub.cfg -- cgit v1.2.3-70-g09d2 From 4e957a95bbd755d6d955d2c49794647f7f1be6b0 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 18 Mar 2020 17:56:09 +0100 Subject: Next Test --- stages/second_stage.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'stages') diff --git a/stages/second_stage.sh b/stages/second_stage.sh index b5b3afb..ea623a7 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -66,5 +66,4 @@ echo "root:${DEFAULT_PASSWORD}" | chpasswd # Install bootloader grub-install --target=i386-pc $path_to_disk -#mkdir /boot/grub -#grub-mkconfig -o /boot/grub/grub.cfg +grub-mkconfig -o /boot/grub/grub.cfg -- cgit v1.2.3-70-g09d2