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

Commit

Permalink
Update build.func
Browse files Browse the repository at this point in the history
Check if the shell is using bash (retry)
  • Loading branch information
tteck authored Feb 22, 2024
1 parent f3e3958 commit 0b604d2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions misc/build.func
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,19 @@ msg_error() {
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}

# Check if the shell is using bash
shell_check() {
if [[ "$(basename "$SHELL")" != "bash" ]]; then
clear
msg_error "Your current shell is not Bash. To utilize these scripts, please switch to the Bash shell."
echo -e "\nExiting..."
sleep 2
exit
fi
}

# Run as root only
check_root() {
root_check() {
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
clear
msg_error "Please run this script as root."
Expand Down Expand Up @@ -450,10 +461,12 @@ advanced_settings() {
}

install_script() {
check_root
ssh_check
arch_check
pve_check
shell_check
root_check
arch_check
ssh_check

if systemctl is-active -q ping-instances.service; then
systemctl -q stop ping-instances.service
fi
Expand Down

0 comments on commit 0b604d2

Please sign in to comment.