You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.1 KiB
75 lines
2.1 KiB
#!/bin/sh |
|
|
|
# WTFPL version 2 shell script which installs Apache, |
|
# MariaDB, and PHP using pkgin, primarily for NetBSD. |
|
# |
|
# Additional information: |
|
# <https://wiki.netbsd.org/pkgsrc/how_to_install_a_lamp_server/> |
|
|
|
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..." |