diff options
-rw-r--r-- | archinstall.sh | 25 | ||||
-rw-r--r-- | stages/first_stage.sh | 66 |
2 files changed, 87 insertions, 4 deletions
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_<myfeature>" 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 |