Update pkgrecover.sh

Will now stop people from trying to install packages without root privileges.
This commit is contained in:
mrhoomanwastaken 2024-09-22 19:13:24 -06:00 committed by GitHub
parent 76547593ae
commit 47a69730a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,9 +2,10 @@
VERSION="1.0.0"
USE_PACMAN_STATIC=${USE_PACMAN_STATIC:-"false"}
RED='\033[0;31m'
YELLOW='\033[1;33m'
directory_check() {
RED='\033[0;31m'
#checks to make sure that all the important directories are mounted properly
if [[ ! -d /proc]]; then
echo -e "${RED} ERROR: /proc is not mounted. upgrading without /proc mounted can cause damage."
@ -171,7 +172,12 @@ fi
# Check that we are running as root
if [[ $EUID -ne 0 ]]; then
echo "WARNING: This script must be run as root in order to install pacman packages. You can still use dryrun without root."
if [[ $3 == "--dry-run" ]] || [[ $2 == "--dry-run" ]]; then
echo -e "${YELLOW}WARNING: This script must be run as root in order to install pacman packages. You can still use dryrun without root."
else
echo -e "${RED}ERROR: This script must be run as root in order to install pacman packages."
exit 1
fi
fi
# Parse the command line arguments