From 64730980ea7174107c2ea92aae421d1b6ea10992 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Mon, 3 Jul 2023 14:08:11 +0200 Subject: [PATCH] install stage 1: add sanity checks at the start --- install-stage1.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/install-stage1.sh b/install-stage1.sh index 71f15b3..2587b2a 100644 --- a/install-stage1.sh +++ b/install-stage1.sh @@ -46,9 +46,17 @@ function run_in_target { clear touch $LOGFILE -#TODO: check that we are root -#TODO: check that we are online -# -> could be done by pinging repo-default.voidlinux.org +if [ ! "$(id -u)" -eq 0 ]; then + echo "Must be root to run this script!" + exit 1 +fi + +if ping -c4 repo-default.voidlinux.org >> $LOGFILE 2>&1; then + : +else + echo "An internet connection is required to run this script." + exit 1 +fi echo " This script will now download and install Void Linux on your USB stick.