move scripts into installer directories

pull/2/head
necro-nemesis 6 years ago
parent 71046e8d1d
commit 0e7bc5d06d

@ -1,47 +1,47 @@
raspap_dir="/etc/raspap" snapp_dir="/home/$username/SNApp"
raspap_user="www-data"
webroot_dir="/var/www/html" webroot_dir="/var/www/html"
version=`sed 's/\..*//' /etc/debian_version`
#create hostname account
# Determine version, set default home location for lighttpd and
# php package to install function create_user () {
if [ $version -eq 10 ]; then
version_msg="Raspbian 10.0 (Buster)" if [ $(id -u) -eq 0 ]; then
sudo apt update --allow-releaseinfo-change read -p "Enter username : " username
php_package="php7.3-cgi" read -s -p "Enter password : " password
elif [ $version -eq 9 ]; then egrep "^$username" /etc/passwd >/dev/null
version_msg="Raspbian 9.0 (Stretch)" if [ $? -eq 0 ]; then
php_package="php7.0-cgi" echo "$username exists!"
elif [ $version -eq 8 ]; then exit 1
version_msg="Raspbian 8.0 (Jessie)"
php_package="php5.6-cgi"
else else
version_msg="Raspbian earlier than 8.0 (Wheezy)" pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
webroot_dir="/var/www" useradd -m -p $pass $username
php_package="php5.6-cgi" [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
fi fi
else
phpcgiconf="" echo "Only root may add a user to the system"
if [ "$php_package" = "php7.3-cgi" ]; then exit 2
phpcgiconf="/etc/php/7.3/cgi/php.ini"
elif [ "$php_package" = "php7.0-cgi" ]; then
phpcgiconf="/etc/php/7.0/cgi/php.ini"
elif [ "$php_package" = "php5.6-cgi" ]; then
phpcgiconf="/etc/php5/cgi/php.ini"
fi fi
# Outputs a RaspAP Install log line }
#create host webpage directory
function create_webpage () {
sudo mkdir -p "$snapp_dir" || install_error "Unable to create directory '$snapp_dir'"
# Outputs a SNApp-Pi-Host Install log line
function install_log() { function install_log() {
echo -e "\033[1;32mLokiAP Install: $*\033[m" echo -e "\033[1;32mLokiAP Install: $*\033[m"
} }
# Outputs a RaspAP Install Error log line and exits with status code 1 # Outputs a SNApp-Pi-Host Install Error log line and exits with status code 1
function install_error() { function install_error() {
echo -e "\033[1;37;41mLokiAP Install Error: $*\033[m" echo -e "\033[1;37;41mLokiAP Install Error: $*\033[m"
exit 1 exit 1
} }
# Outputs a RaspAP Warning line # Outputs a SNApp-Pi-Host Warning line
function install_warning() { function install_warning() {
echo -e "\033[1;33mWarning: $*\033[m" echo -e "\033[1;33mWarning: $*\033[m"
} }
@ -66,20 +66,8 @@ function display_welcome() {
### NOTE: all the below functions are overloadable for system-specific installs ### NOTE: all the below functions are overloadable for system-specific installs
### NOTE: some of the below functions MUST be overloaded due to system-specific installs ### NOTE: some of the below functions MUST be overloaded due to system-specific installs
function config_installation() {
install_log "Configure installation"
echo "Detected ${version_msg}"
echo "Install directory: ${raspap_dir}"
echo "Lighttpd directory: ${webroot_dir}"
echo -n "Complete installation with these values? [y/N]: "
read answer
if [[ $answer != "y" ]]; then
echo "Installation aborted."
exit 0
fi
}
# Runs a system software update to make sure we're using all fresh packages # Runs a system software update to make sure we're using all fresh packages
function update_system_packages() { function update_system_packages() {
# OVERLOAD THIS # OVERLOAD THIS
install_error "No function definition for update_system_packages" install_error "No function definition for update_system_packages"
@ -91,25 +79,6 @@ function install_dependencies() {
install_error "No function definition for install_dependencies" install_error "No function definition for install_dependencies"
} }
function stop_lokinet(){
sudo systemctl stop lokinet.service
}
# Replaces NetworkManager with DHCPD
function check_for_networkmananger() {
# OVERLOAD THIS
install_error "No function definition for install_dependencies"
}
# Enables PHP for lighttpd and restarts service for settings to take effect
function enable_php_lighttpd() {
install_log "Enabling PHP for lighttpd"
sudo lighttpd-enable-mod fastcgi-php
sudo service lighttpd force-reload
sudo /etc/init.d/lighttpd restart || install_error "Unable to restart lighttpd"
}
# Verifies existence and permissions of RaspAP directory # Verifies existence and permissions of RaspAP directory
function create_raspap_directories() { function create_raspap_directories() {
Loading…
Cancel
Save