summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2019-11-14 19:36:03 +0100
committerxengineering <mail2xengineering@protonmail.com>2019-11-14 19:36:03 +0100
commit6716e1b213d8108dac86d688f17016faa7f03c1a (patch)
treec47e8bb29235dfc39c01de802b467c2d3f053c07
parentb872b3eba4209f7a3c7c554a020eb6b4af606d80 (diff)
downloadarchinstall-6716e1b213d8108dac86d688f17016faa7f03c1a.tar
archinstall-6716e1b213d8108dac86d688f17016faa7f03c1a.tar.zst
archinstall-6716e1b213d8108dac86d688f17016faa7f03c1a.zip
Improved code readability and avoided output redirect to /dev/null.
-rw-r--r--archinstall.sh8
-rw-r--r--bin/first_stage.sh30
-rw-r--r--bin/install_bootloader.sh9
-rw-r--r--bin/second_stage.sh9
4 files changed, 24 insertions, 32 deletions
diff --git a/archinstall.sh b/archinstall.sh
index e764b4c..025f318 100644
--- a/archinstall.sh
+++ b/archinstall.sh
@@ -60,7 +60,7 @@ DELAY=0.5 # delay for reading messages in seconds
# Check internet connection
-if ping -w $NETWORK_DEADLINE -c 1 $TESTSERVER > /dev/null; then
+if ping -w $NETWORK_DEADLINE -c 1 $TESTSERVER; then
echo "Internet connection is ready - OK"
echo ""
sleep $DELAY
@@ -72,7 +72,7 @@ fi
# Update the system clock
-timedatectl set-ntp true > /dev/null
+timedatectl set-ntp true
if [ $? -eq 0 ]; then
echo "Updated system clock - OK"
echo ""
@@ -95,6 +95,7 @@ git clone $REPOSITORY_URL $REPOSITORY_PATH
cd $REPOSITORY_PATH
git checkout $BRANCH_OR_COMMIT
cd
+
echo "Git repository cloned - OK"
echo ""
sleep $DELAY
@@ -102,4 +103,5 @@ sleep $DELAY
# Launching first stage
-bash $REPOSITORY_PATH/bin/first_stage.sh $DELAY $REPOSITORY_PATH $LOG_FILE_PATH | tee -a $LOG_FILE_PATH
+bash $REPOSITORY_PATH/bin/first_stage.sh \
+$DELAY $REPOSITORY_PATH $LOG_FILE_PATH | tee -a $LOG_FILE_PATH
diff --git a/bin/first_stage.sh b/bin/first_stage.sh
index 0970049..a27641a 100644
--- a/bin/first_stage.sh
+++ b/bin/first_stage.sh
@@ -98,24 +98,11 @@ else
fi
-# Update the system clock
-
-timedatectl set-ntp true
-if [ $? -eq 0 ]; then
- echo "Updated system clock - OK"
- echo ""
- sleep $DELAY
-else
- echo "Could not update system clock - FAILED"
- exit
-fi
-
-
# Partitioning
-wipefs -a $disk_path > /dev/null # make sure that fdisk does not ask for
- # removing signatures which breaks the script
-fdisk $disk_path > /dev/null 2> /dev/null << EOF
+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
@@ -137,10 +124,10 @@ echo ""
# Create Filesystems
-mkfs.fat -F32 $boot_partition_path > /dev/null 2> /dev/null
-mkfs.ext4 $root_partition_path > /dev/null 2> /dev/null
-fatlabel $boot_partition_path "BOOT" > /dev/null
-e2label $root_partition_path "ROOT" > /dev/null
+mkfs.fat -F32 $boot_partition_path
+mkfs.ext4 $root_partition_path
+fatlabel $boot_partition_path "BOOT"
+e2label $root_partition_path "ROOT"
echo "Created filesystems - OK"
sleep $DELAY
echo ""
@@ -181,7 +168,8 @@ echo ""
# Launch second stage in chroot
-echo "bash $REPOSITORY_PATH/bin/second_stage.sh $hostname ${disk_path}1 $REPOSITORY_PATH" | arch-chroot /mnt
+echo "bash $REPOSITORY_PATH/bin/second_stage.sh $hostname \
+${disk_path}1 $REPOSITORY_PATH" | arch-chroot /mnt
# Copy log from live image to root partition
diff --git a/bin/install_bootloader.sh b/bin/install_bootloader.sh
index 2f19ca3..7967a54 100644
--- a/bin/install_bootloader.sh
+++ b/bin/install_bootloader.sh
@@ -26,14 +26,11 @@
# Install Grub
pacman --noconfirm -Syu grub efibootmgr
-mount $1 /mnt # $1 = boot_partition_path
-grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB --removable
+mount $1 /mnt
+grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \
+--removable
grub-mkconfig -o /boot/grub/grub.cfg
umount $1
echo "Grub bootloader installed - OK"
echo ""
sleep 1
-
-echo "Leaving chroot environment - OK"
-echo ""
-sleep 1
diff --git a/bin/second_stage.sh b/bin/second_stage.sh
index f3353d3..f2fe43a 100644
--- a/bin/second_stage.sh
+++ b/bin/second_stage.sh
@@ -28,8 +28,6 @@
hostname=$1
boot_partition_path=$2
REPOSITORY_PATH=$3
-echo "hostname: $hostname"
-echo "boot_partition_path: $boot_partition_path"
# Localization
@@ -58,3 +56,10 @@ sleep 1
# Bootloader Installation
bash $REPOSITORY_PATH/bin/install_bootloader.sh $boot_partition_path
+
+
+# Good bye chroot
+
+echo "Leaving chroot environment - OK"
+echo ""
+sleep 1