From be08b1b19bb9081c582d426cc30bee7633474309 Mon Sep 17 00:00:00 2001 From: fiorile Date: Fri, 23 Aug 2024 12:46:25 -0400 Subject: [PATCH] THIS SCRIPT IS NOT FINISHED YET --- nbsd-www.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 nbsd-www.sh diff --git a/nbsd-www.sh b/nbsd-www.sh new file mode 100644 index 0000000..a1eaaec --- /dev/null +++ b/nbsd-www.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +# WTFPL version 2 shell script which installs Apache, +# MariaDB, and PHP using pkgin, primarily for NetBSD. +# +# Additional information: +# + +echo ">Apache-MariaDB-PHP installer for NetBSD<" +echo "Welcome to this A.M.P. script for NetBSD!" +echo "Please note - this script is using pkgin." +echo "This script requires elevated privileges." +echo + +#[DEBUG - disabled for dev.] +# +#if [ "$(id -u)" -ne 0 ]; then +# echo "[FAIL] Insufficient privileges - exiting." +# exit 1 +#fi + +echo "[INFO] You have the necessary privileges." +echo "[INFO] Commencing installation procedure." + +# Apache +if [ -z "$(pkg_info | grep apache)" ]; then + echo "[INFO] Apache isn't present - installing." + pkgin install apache -y + echo "[CONF] Loc. /usr/pkg/etc/httpd/httpd.conf" + echo "[INFO] Viewing the config. in: 5 seconds." + sleep 5 + less /usr/pkg/etc/httpd/httpd.conf + cp /usr/pkg/share/examples/rc.d/apache /etc/rc.d + echo "[INFO] Apache's auto-start script copied." + echo "[INFO] The installation is now completed!" + echo +fi + + + +# MariaDB +read -p "[WARN] Permission - install MariaDB? Y/N " yn + +case $yn in + [Yy]* ) echo "[INFO] Commencing MariaDB's installation." + pkgin install mariadb-server -y + /usr/bin/printf "[WARN] THE REST OF THE INSTALLATION IS NOT\nIMPLEMENTED YET, PLEASE READ THE DOCUMENTATION:\nhttps://wiki.netbsd.org/pkgsrc/how_to_install_a_lamp_server/\n" ;; + + [Nn]* ) echo "[INFO] Installation stage 2: now skipped." ;; + + * ) echo "[FAIL] Invalid response - considering no." ;; +esac +echo + + + +# PHP +read -p "[WARN] Please confirm - install PHP? Y/N " yn + +case $yn in + [Yy]* ) echo "[INFO] Starting PHP's installation now..." + pkgin install php -y + /usr/bin/printf "[WARN] THE REST OF THE INSTALLATION IS NOT\nIMPLEMENTED YET, PLEASE READ THE DOCUMENTATION:\nhttps://wiki.netbsd.org/pkgsrc/how_to_install_a_lamp_server/\n" ;; + #TO-DO: + #Install the MySQL module for PHP + + [Nn]* ) echo "[INFO] Installation stage 3: now skipped." ;; + + * ) echo "[FAIL] Invalid response - considering no." ;; +esac +echo + + + +echo "[INFO] Installation finished - exiting..." \ No newline at end of file