summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall.sh26
-rw-r--r--stages/first_stage.sh37
-rw-r--r--stages/second_stage.sh16
3 files changed, 37 insertions, 42 deletions
diff --git a/archinstall.sh b/archinstall.sh
index 7caa6dd..d5197e2 100644
--- a/archinstall.sh
+++ b/archinstall.sh
@@ -28,12 +28,12 @@
#################################################################
-# Stop at any error to optimize debugging:
+# stop at any error to optimize debugging:
set -e
-# Greetings
+# greetings
cat << EOF
@@ -52,24 +52,24 @@ cat << EOF
EOF
-# Constants
+# constants
######################## CHANGE FOR PRODUCTION:
-export BRANCH="master" # possible alternatives: "devel" or "feature_<myfeature>"
+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 grub networkmanager nano" # maybe this is requiered: efibootmgr
export DEFAULT_PASSWORD="archinstall"
-export OK="\033[m[ \033[32mOK\033[m ]"
-export ERROR="\033[m[ \033[31mERROR\033[m ]"
+export OK="\033[m[ \033[32mOK\033[m ]" # ref. https://en.wikipedia.org/wiki/ANSI_escape_code
+export FAILED="\033[m[ \033[31mFAILED\033[m ]" # ref. https://en.wikipedia.org/wiki/ANSI_escape_code
-# Variables
+# variables
export boot_mode="unknown" # alternatives: "bios" or "uefi"
-export path_to_disk="/dev/null" # e.g. "/dev/sda"
+export path_to_disk="/dev/sda" # 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
@@ -78,30 +78,30 @@ export keymap="de-latin1"
export hostname="archlinux" # will be set to a user-chosen hostname
-# Check internet connection
+# check internet connection
if ping -w $INTERNET_TEST_PING_TIMEOUT -c 1 $INTERNET_TEST_SERVER; then
printf "$OK Internet connection is ready\n"
else
- printf "$ERROR Could not reach INTERNET_TEST_SERVER '$INTERNET_TEST_SERVER'\n"
+ printf "$FAILED Could not reach INTERNET_TEST_SERVER '$INTERNET_TEST_SERVER'\n"
exit 1
fi
-# Update the system clock
+# update the system clock
timedatectl set-ntp true
printf "$OK Updated system clock\n"
-# Download and run first stage
+# download and run first stage
curl $FIRST_STAGE_LINK > /root/first_stage.sh
bash /root/first_stage.sh
printf "$OK first_stage.sh finished\n"
-# Download, run and delete second stage
+# download, run and delete 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 c8101b7..0643671 100644
--- a/stages/first_stage.sh
+++ b/stages/first_stage.sh
@@ -18,17 +18,17 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-# Stop at any error to optimize debugging:
+# stop at any error to optimize debugging:
set -e
-# Debug output
+# debug output
printf "$OK Entering first_stage.sh\n"
-# Check bootmode
+# check bootmode
if [ -d "/sys/firmware/efi/efivars" ]; then
export boot_mode="uefi"
@@ -39,21 +39,16 @@ else
fi
-# Partition the disk
-
-if [ "$boot_mode" == "unknown" ]; then
- printf "$ERROR Bootmode unknown\n"
- exit 1
-fi
+# partition the disk
if [ "$path_to_disk" == "/dev/null" ]; then
- printf "$ERROR path_to_disk has still default value\n"
+ printf "$FAILED path_to_disk variable has still default value '/dev/null'\n"
exit 1
fi
if [ "$boot_mode" == "uefi" ]; then
printf "$OK Partitioning for UEFI mode\n"
- printf "$ERROR Sorry, this is still untested and you should not try it ...\n"
+ printf "$FAILED Sorry, this is still untested and you should not try it ...\n"
exit 1
wipefs -a $path_to_disk # make sure that fdisk does not ask for removing
# signatures which breaks the script
@@ -98,11 +93,11 @@ EOF
printf "$OK Partitioned disk for BIOS/MBR\n"
else
- printf "$ERROR Unknown boot_mode\n"
+ printf "$FAILED Unknown boot_mode\n"
fi
-# Format and mount partitions
+# format and mount partitions
if [ "$luks_encryption" == "no" ];then
if [ "$boot_mode" == "bios" ];then
@@ -117,39 +112,39 @@ if [ "$luks_encryption" == "no" ];then
elif [ "$boot_mode" == "uefi" ];then
printf "$OK Formatting for no disk encryption and uefi/gpt\n"
###
- printf "$ERROR Sorry, UEFI is not ready to use ...\n"
+ printf "$FAILED Sorry, UEFI is not ready to use ...\n"
exit 1
else
- printf "$ERROR Unknown boot_mode\n"
+ printf "$FAILED Unknown boot_mode\n"
exit 1
fi
elif [ "$luks_encryption" == "yes" ];then
if [ "$boot_mode" == "bios" ];then
printf "$OK Formatting for disk encryption and bios/mbr\n"
###
- printf "$ERROR Sorry, encryption is not ready to use ...\n"
+ printf "$FAILED Sorry, encryption is not ready to use ...\n"
exit 1
elif [ "$boot_mode" == "uefi" ];then
printf "$OK Formatting for disk encryption and uefi/gpt\n"
###
- printf "$ERROR Sorry, encryption is not ready to use ...\n"
+ printf "$FAILED Sorry, encryption is not ready to use ...\n"
exit 1
else
- printf "$ERROR Unknown boot_mode\n"
+ printf "$FAILED Unknown boot_mode\n"
exit 1
fi
else
- printf "$ERROR luks_encryption not 'yes' or 'no'\n"
+ printf "$FAILED luks_encryption not 'yes' or 'no'\n"
exit 1
fi
-# Install packages with pacstrap
+# install packages with pacstrap
pacstrap /mnt $PACKAGE_LIST
printf "$OK Installed packages\n"
-# Generate /etc/fstab
+# generate /etc/fstab
genfstab -U /mnt >> /mnt/etc/fstab
diff --git a/stages/second_stage.sh b/stages/second_stage.sh
index faedde1..a649fc6 100644
--- a/stages/second_stage.sh
+++ b/stages/second_stage.sh
@@ -18,23 +18,23 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-# Stop at any error to optimize debugging:
+# stop at any error to optimize debugging:
set -e
-# Debug output
+# debug output
printf "$OK Entering second_stage.sh\n"
-# Set timezone
+# set timezone
ln -sf $path_to_timezone /etc/localtime
hwclock --systohc
-# Localization
+# localization
echo "$locales_to_generate" >> /etc/locale.gen
locale-gen
@@ -44,7 +44,7 @@ touch /etc/vconsole.conf
echo "KEYMAP=$keymap" >> /etc/vconsole.conf
-# Network configuration
+# network configuration
touch /etc/hostname
echo "$hostname" > /etc/hostname
@@ -53,17 +53,17 @@ echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
-# Initramfs
+# initramfs
### to be implemented
-# Setting root password
+# setting root password
echo "root:${DEFAULT_PASSWORD}" | chpasswd
-# Install bootloader
+# install bootloader
grub-install --target=i386-pc $path_to_disk
grub-mkconfig -o /boot/grub/grub.cfg