From 5026f03692102631de78f319118e917cc103adc8 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 14:50:37 +0800 Subject: [PATCH] (MOD) Added a feature where it displays the current user identity once it's not root. --- postinstall | 5 +++++ preinstall | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/postinstall b/postinstall index 12dd101..4378197 100755 --- a/postinstall +++ b/postinstall @@ -1,5 +1,10 @@ #!/bin/sh +if [ "$(whoami)" != "root" ]; then + echo "The script require root privilege to execute properly. Current identity: $(whoami)" + exit 1 +fi + # Install Compound library. echo "Installing libcompound:" cp -v "libcompound.so" "/usr/lib" diff --git a/preinstall b/preinstall index 4f94d2a..cbf5c87 100755 --- a/preinstall +++ b/preinstall @@ -1,14 +1,10 @@ #!/bin/sh -if [ "`whoami`" != "root" ]; then - echo "The script require root privilege to execute properly." +if [ "$(whoami)" != "root" ]; then + echo "The script require root privilege to execute properly. Current identity: $(whoami)" exit 1 fi -# echo "Please ensure the current work directory is the home directory to the project Compound! -# Press enter key to continue..." -# read - SRC="$PWD" DST=/usr/include/Compound PROJ=("Array" "Paper" "Pen" "Render" "Status" "Var" "MemMan" "Stack" "Utils"\