set the url
This commit is contained in:
parent
23f622bf49
commit
7c3bef2d8b
57
install.sh
57
install.sh
|
@ -4,13 +4,21 @@ PURPLE='\033[35m'
|
|||
BOLD='\033[1m'
|
||||
RESET='\033[0m'
|
||||
|
||||
install_expect() {
|
||||
if ! command -v expect &> /dev/null; then
|
||||
apt install -y expect
|
||||
install_pkg() {
|
||||
pkg="$1"
|
||||
if ! command -v "$pkg" &> /dev/null; then
|
||||
apt install -y "$pkg"
|
||||
echo -e "${PURPLE}${BOLD}expect installed${RESET}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_username() {
|
||||
if [[ -z "$username" ]]; then
|
||||
username=$(getent passwd 1000 | cut -d: -f1)
|
||||
echo $username
|
||||
fi
|
||||
}
|
||||
|
||||
echo -e "${PURPLE}${BOLD}Deployment Debian + Caddy + Directus + Nuxt${RESET}"
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
|
@ -105,7 +113,7 @@ if [[ "$answer" == "y" ]]; then
|
|||
echo -e "${PURPLE}${BOLD}Enter the MariaDB root password : ${RESET}"
|
||||
read -s db_root_password
|
||||
echo
|
||||
install_expect
|
||||
install_pkg expect
|
||||
SECURE_MYSQL=$(expect -c "
|
||||
set timeout 3
|
||||
spawn mysql_secure_installation
|
||||
|
@ -149,7 +157,7 @@ if [[ "$answer" == "y" ]]; then
|
|||
read -s db_root_password
|
||||
echo
|
||||
fi
|
||||
install_expect
|
||||
install_pkg expect
|
||||
CREATE_DIRECTUS_DB=$(expect -c "
|
||||
spawn mariadb -u root -p
|
||||
expect \"Enter password:\"
|
||||
|
@ -167,20 +175,47 @@ if [[ "$answer" == "y" ]]; then
|
|||
echo -e "${PURPLE}${BOLD}Directus database created${RESET}"
|
||||
fi
|
||||
|
||||
echo -e "${PURPLE}${BOLD}Install NPM ? (y/n) ${RESET}"
|
||||
#
|
||||
# NODE
|
||||
#
|
||||
|
||||
echo -e "${PURPLE}${BOLD}Install Node ? (y/n) ${RESET}"
|
||||
read answer
|
||||
if [[ "$answer" == "y" ]]; then
|
||||
if [[ -z "$username" ]]; then
|
||||
username=$(getent passwd 1000 | cut -d: -f1)
|
||||
echo $username
|
||||
fi
|
||||
get_username
|
||||
su -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash &&\
|
||||
export NVM_DIR="$HOME/.nvm" &&\
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&\
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" &&\
|
||||
nvm install v18' $username
|
||||
echo "ok pour npm";
|
||||
echo "${PURPLE}${BOLD}Node installed${RESET}";
|
||||
fi
|
||||
|
||||
#
|
||||
# SET THE URL
|
||||
#
|
||||
|
||||
echo -e "${PURPLE}${BOLD}Enter the domain name of the website${RESET}"
|
||||
read domain_name
|
||||
$ip=$(hostname -I)
|
||||
echo -e "${PURPLE}${BOLD}Configure the ${domain_name} DNS ZONE as the following${RESET}"
|
||||
echo -e "${PURPLE}Domain : ${domain_name} | Type : A | Target : ${ip}${RESET}"
|
||||
echo -e "${PURPLE}Domain : ${domain_name} | Type : A | Target : ${ip}${RESET}"
|
||||
echo -e "${PURPLE}Domain : cms.${domain_name} | Type : A | Target : ${ip}${RESET}"
|
||||
echo -e "${PURPLE}Domain : www.${domain_name} | Type : A | Target : ${ip}${RESET}"
|
||||
echo -e "${PURPLE}${BOLD}Press any key when done${RESET}"
|
||||
read
|
||||
|
||||
#
|
||||
# DIRECTUS
|
||||
#
|
||||
|
||||
echo -e "${PURPLE}${BOLD}Install Directus ? (y/n) ${RESET}"
|
||||
read answer
|
||||
if [[ "$answer" == "y" ]]; then
|
||||
echo "yooo"
|
||||
# get_username
|
||||
# su -c 'cd &&\
|
||||
# ' $username
|
||||
fi
|
||||
# TODO REMOVE EXPECT IF IT IS INSTALLED
|
Loading…
Reference in New Issue