1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Tidy installer + common functions

This commit is contained in:
billz 2020-12-16 11:35:15 +00:00
parent fa8c6548a5
commit 87e2d812a7
2 changed files with 33 additions and 24 deletions

View File

@ -2,8 +2,10 @@
# #
# RaspAP installation functions # RaspAP installation functions
# Author: @billz <billzimmerman@gmail.com> # Author: @billz <billzimmerman@gmail.com>
# Author URI: https://github.com/billz/
# License: GNU General Public License v3.0 # License: GNU General Public License v3.0
# # License URI: https://github.com/billz/raspap-webgui/blob/master/LICENSE
# You are not obligated to bundle the LICENSE file with your RaspAP projects as long # You are not obligated to bundle the LICENSE file with your RaspAP projects as long
# as you leave these references intact in the header comments of your source files. # as you leave these references intact in the header comments of your source files.
@ -27,6 +29,27 @@ webroot_dir="/var/www/html"
git_source_url="https://github.com/$repo" # $repo from install.raspap.com git_source_url="https://github.com/$repo" # $repo from install.raspap.com
# NOTE: all the below functions are overloadable for system-specific installs # NOTE: all the below functions are overloadable for system-specific installs
function _install_raspap() {
_display_welcome
_config_installation
_update_system_packages
_install_dependencies
_enable_php_lighttpd
_create_raspap_directories
_optimize_php
_check_for_old_configs
_download_latest_files
_change_file_ownership
_create_hostapd_scripts
_create_lighttpd_scripts
_move_config_file
_default_configuration
_configure_networking
_prompt_install_adblock
_prompt_install_openvpn
_patch_system_files
_install_complete
}
# Prompts user to set installation options # Prompts user to set installation options
function _config_installation() { function _config_installation() {
@ -550,24 +573,3 @@ function _install_complete() {
fi fi
} }
function _install_raspap() {
_display_welcome
_config_installation
_update_system_packages
_install_dependencies
_enable_php_lighttpd
_create_raspap_directories
_optimize_php
_check_for_old_configs
_download_latest_files
_change_file_ownership
_create_hostapd_scripts
_create_lighttpd_scripts
_move_config_file
_default_configuration
_configure_networking
_prompt_install_adblock
_prompt_install_openvpn
_patch_system_files
_install_complete
}

View File

@ -36,8 +36,7 @@ set -eo pipefail
function _main() { function _main() {
# set defaults # set defaults
repo="billz/raspap-webgui" # override with -r, --repo option repo="billz/raspap-webgui" # override with -r, --repo option
_get_release
branch=$RASPAP_LATEST # override with -b, --branch option
_parse_params "$@" _parse_params "$@"
_setup_colors _setup_colors
_log_output _log_output
@ -202,6 +201,14 @@ function _update_system_packages() {
# Fetch required installer functions # Fetch required installer functions
function _load_installer() { function _load_installer() {
# fetch latest release tag
_get_release
# assign default branch if not defined with -b, --branch option
if [ -z ${branch} ]; then
branch=$RASPAP_LATEST
fi
UPDATE_URL="https://raw.githubusercontent.com/$repo/$branch/" UPDATE_URL="https://raw.githubusercontent.com/$repo/$branch/"
if [ "${install_cert:-}" = 1 ]; then if [ "${install_cert:-}" = 1 ]; then
source="mkcert" source="mkcert"