Skip to content

Commit

Permalink
Update wp-bash.sh
Browse files Browse the repository at this point in the history
back to php8.1 as default as php8.3 is not defined in this script as of yet for PHP modules, and added loading bar during PHP install and updates.
  • Loading branch information
cloudrack-ca authored Mar 22, 2024
1 parent a2ffa6d commit 9a89d07
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions wp-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to display a loading bar
function loading_bar() {
local pid=$1
local delay=0.1
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
echo -e "${RED}*******************************************************************************${NC}"
echo "▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌";
echo "▐ ___ _ _ _ _ _ ___ ___ _ _ _ ▌";
Expand All @@ -24,9 +38,9 @@ ip=$(hostname -I | awk '{print $1}')
# Tell the user "Let's start installing your WordPress site" in Purple
echo -e "${BLUE}Lets start installing your WordPress site simply follow the steps to install.${NC}"
# Prompt user to define PHP version
echo -e "${YELLOW}Enter PHP version (e.g. 8.3) [If none is entered default will be used: 8.3]: ${NC}"
read -p "(default: 8.3) " php_version
php_version=${php_version:-8.3}
echo -e "${YELLOW}Enter PHP version (e.g. 8.1) [If none is entered default will be used: 8.1]: ${NC}"
read -p "(default: 8.1) " php_version
php_version=${php_version:-8.1}
echo -e "${GREEN}Using PHP version: $php_version${NC}"

# Prompt user to define WordPress version
Expand Down Expand Up @@ -68,10 +82,12 @@ echo -e "${GREEN}Using WordPress database user password: $wp_db_password${NC}"
# Add PHP repository
echo -e "${BLUE}Adding PHP $php_version repository...${NC}"
add-apt-repository -y ppa:ondrej/php &>> install.log
loading_bar $!

# Update apt
echo -e "${GREEN}Updating apt...${NC}"
apt-get update &>> install.log
loading_bar $!

# Install required packages
echo -e "${BLUE}Installing required packages...${NC}"
Expand Down

0 comments on commit 9a89d07

Please sign in to comment.