From 7ad18eb02190c99e0f41a0934caf992f9f13e5af Mon Sep 17 00:00:00 2001 From: Iven Schlenther Date: Tue, 21 May 2024 12:11:31 +0200 Subject: [PATCH] task: add condition for ci use and add user prompt for install.sh no root warning --- install.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 472813eeef..3b5496da88 100755 --- a/install.sh +++ b/install.sh @@ -8,11 +8,20 @@ if [[ -n "$MSYSTEM" ]]; then fi # Check if script was executed with root/sudo -if [ `id -u` -ne 0 ] - then echo Please run this script as root or using sudo! - exit +if [ "$(id -u)" -ne 0 ]; then + if [ "$CI" != "true" ]; then + echo "You should be using sudo, are you sure you want to continue? [y/n]" + read -r answer + if [ "$answer" != "${answer#[Yy]}" ] ;then + echo "Continuing without sudo. This might cause issues later on." + else + echo "The script execution was stopped. Please run it again with sudo." + exit + fi + fi fi + source install/_lib.sh # Pre-flight. No impact yet.