From 8f82bb22bd293e569d989534c115d5a842779cfa Mon Sep 17 00:00:00 2001 From: Sophia Atkinson Date: Fri, 28 Oct 2022 22:45:20 -0700 Subject: [PATCH] Add 'scripts/wpinstall.sh' --- scripts/wpinstall.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/wpinstall.sh diff --git a/scripts/wpinstall.sh b/scripts/wpinstall.sh new file mode 100644 index 0000000..3aea5e3 --- /dev/null +++ b/scripts/wpinstall.sh @@ -0,0 +1,38 @@ +#!/bin/bash +while true +do + read -r -p "Would you like to install Wordpress? [Y/n] " input + + case $input in + [yY][eE][sS]|[yY]) + break + ;; + [nN][oO]|[nN]) + break + ;; + *) + echo "That wasn't an option..." + ;; + esac +done + +while true +do + read -p "Enter The Directory Where you want to install Wordpress: " INSTALL_DIR + + if [ -d "$INSTALL_DIR" ]; then + echo "The Directory $INSTALL_DIR Already Exist" + sleep 1 + else + mkdir -p $INSTALL_DIR + echo "creating $INSTALL_DIR" + break + fi +done + +wget -O latest.zip https://wordpress.org/latest.zip +apt install unzip -y +unzip latest.zip -d $INSTALL_DIR +cp -r $INSTALL_DIR/wordpress/* $INSTALL_DIR +rm -rf $INSTALL_DIR/wordpress +rm -rf latest.zip \ No newline at end of file