Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #255 from mfgbhatti/backgrounds
Browse files Browse the repository at this point in the history
Backgrounds checks
  • Loading branch information
ChrisTitusTech committed Jul 30, 2022
2 parents ce1d6ca + 3054110 commit 2c2adda
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,46 @@ set_option() {
fi
echo "${1}=${2}" >>$CONFIG_FILE # add option
}
# @description Renders a text based list of options that can be selected by the

root_check() {
if [[ "$(id -u)" != "0" ]]; then
echo -ne "ERROR! This script must be run under the 'root' user!\n"
exit 0
fi
}

docker_check() {
if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then
echo -ne "ERROR! Docker container is not supported (at the moment)\n"
exit 0
elif [[ -f /.dockerenv ]]; then
echo -ne "ERROR! Docker container is not supported (at the moment)\n"
exit 0
fi
}

arch_check() {
if [[ ! -e /etc/arch-release ]]; then
echo -ne "ERROR! This script must be run in Arch Linux!\n"
exit 0
fi
}

pacman_check() {
if [[ -f /var/lib/pacman/db.lck ]]; then
echo "ERROR! Pacman is blocked."
echo -ne "If not running remove /var/lib/pacman/db.lck.\n"
exit 0
fi
}

background_checks() {
root_check
arch_check
pacman_check
docker_check
}
# Renders a text based list of options that can be selected by the
# user using up, down and enter keys and returns the chosen option.
#
# Arguments : list of options, maximum of 256
Expand Down Expand Up @@ -317,6 +356,7 @@ installtype () {
# language (){}

# Starting functions
background_checks
clear
logo
userinfo
Expand Down

0 comments on commit 2c2adda

Please sign in to comment.