diff options
30 files changed, 192 insertions, 958 deletions
@@ -1,2 +1,3 @@ **/__pycache__ archive +notes.md @@ -10,7 +10,7 @@ Note: There are many Arch Install scripts out there but I wanted to create my ow ## Usage 1. Download the Arch Linux .iso file (maybe [here](http://ftp.halifax.rwth-aachen.de/archlinux/iso/latest/)) and verify it. -2. Write the .iso to an USB stick (maybe with this [tool](https://www.balena.io/etcher/)) and boot the machine from this USB stick in UEFI mode. +2. Write the .iso to an USB stick (maybe with this [tool](https://www.balena.io/etcher/)) and boot the machine from this USB stick. 3. Download the script with 'curl -L archinstall.xengineering.eu > archinstall.sh'. 4. Run the script with 'bash archinstall.sh' and follow the instructions. @@ -23,14 +23,12 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s ### Usage with VirtualBox 1. Create a VirtualBox virtual machine (VM) for 64-bit Arch Linux with the default or customized settings. -2. Enable Extensible Firmware Interface (EFI) in the settings of this VM. -3. Start the VM and provide the .iso file if you are asked to. -4. You booted the Arch Linux live environment in VirtualBox. Proceed with the normal use of archinstall. +2. Start the VM and provide the .iso file if you are asked to. +3. You booted the Arch Linux live environment in VirtualBox. Proceed with the normal use of archinstall. ## Restrictions -- Just UEFI systems - Just german localization of the installed system - Just installation with cable network connection (no WiFi) @@ -42,6 +40,7 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s - [ ] Support BIOS systems - [ ] Optimize mirrorlist - [ ] Automatic abort in case of errors +- [ ] Optimize mirrorlist - [ ] Support installation with WiFi (instead of cable connection) - [ ] Provide recommended package lists - [ ] Support english localization diff --git a/archinstall.sh b/archinstall.sh index 2dfbf9e..43f9d8f 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,13 +52,37 @@ cat << EOF EOF +# Constants + + ######################## CHANGE FOR PRODUCTION: +export BRANCH="devel" # possible alternatives: "devel" or "feature_<myfeature>" +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" +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" + + +# Variables + +export boot_mode="unknown" # alternatives: "bios" or "uefi" +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 +export language="de_DE.UTF-8" +export keymap="de-latin1" +export hostname="archlinux" # will be set to a user-chosen hostname + + # Check internet connection -if ping -w $NETWORK_DEADLINE -c 1 $TESTSERVER; then +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 testserver '$TESTSERVER' - FAILED" + echo "Could not reach INTERNET_TEST_SERVER '$INTERNET_TEST_SERVER' - FAILED" exit fi @@ -77,31 +90,16 @@ 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 +# Download and run first stage -echo "Git repository cloned - OK" -echo "" +curl $FIRST_STAGE_LINK > /root/first_stage.sh +bash /root/first_stage.sh -# Launching first stage +# Download, run and delete second stage -bash first_stage.sh | tee -a $LOG_FILE_PATH +curl $SECOND_STAGE_LINK > /mnt/root/second_stage.sh +echo "bash /root/second_stage.sh" | arch-chroot /mnt +rm /mnt/root/second_stage.sh 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 diff --git a/util/check_bootmode.sh b/util/check_bootmode.sh deleted file mode 100644 index 299856a..0000000 --- a/util/check_bootmode.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 <https://www.gnu.org/licenses/>. - - -if [ -d "/sys/firmware/efi/efivars" ]; then - echo "Booted with UEFI" -else - echo "Not booted with UEFI. Please enable it in your mainboard settings. - FAILED" - exit -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 cd2d37c..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 <https://www.gnu.org/licenses/>. - - -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 NetworkManager - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 972eefd..0000000 --- a/util/create_filesystems.sh +++ /dev/null @@ -1,33 +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 <https://www.gnu.org/licenses/>. - - -efi_partition_path=$1 # e.g. /dev/sda1 -boot_partition_path=$2 # e.g. /dev/sda2 -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" -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -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 3f63f64..0000000 --- a/util/install_bootloader.sh +++ /dev/null @@ -1,46 +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 <https://www.gnu.org/licenses/>. - - -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 - -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 -umount $efi_partition_path - -echo "Installed bootloader - OK" diff --git a/util/install_packages.sh b/util/install_packages.sh deleted file mode 100644 index 6faeb2b..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 <https://www.gnu.org/licenses/>. - - -desktop_wanted=$1 # e.g. "yes" - - -pacstrap /mnt base linux linux-firmware networkmanager nano sudo grub efibootmgr -if [ "$desktop_wanted" = "yes" ]; then - pacstrap /mnt xorg lightdm lightdm-gtk-greeter cinnamon gnome-terminal papirus-icon-theme gedit -fi - -echo "Installed packages - OK" diff --git a/util/mount_filesystems.sh b/util/mount_filesystems.sh deleted file mode 100644 index f24421b..0000000 --- a/util/mount_filesystems.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 <https://www.gnu.org/licenses/>. - - -boot_partition_path=$1 -root_partition_path=$2 - - -mount $root_partition_path /mnt -mkdir /mnt/boot -mount $boot_partition_path /mnt/boot - -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 <https://www.gnu.org/licenses/>. - - -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 fcad5b9..0000000 --- a/util/partition_disk.sh +++ /dev/null @@ -1,44 +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 <https://www.gnu.org/licenses/>. - - -disk_path=$1 # e.g. /dev/sda - - -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 - OK" 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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -########################## -# 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 6ccce3b..0000000 --- a/util/unmount_filesystems.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 <https://www.gnu.org/licenses/>. - - -boot_partition_path=$1 -root_partition_path=$2 - - -cd /root -umount $boot_partition_path -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 <https://www.gnu.org/licenses/>. - - -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 <https://www.gnu.org/licenses/>. - - -genfstab -U /mnt >> /mnt/etc/fstab - -echo "Wrote /etc/fstab - OK" |