mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
initial install test
This commit is contained in:
@@ -57,6 +57,7 @@ function _install_raspap() {
|
||||
_configure_networking
|
||||
_prompt_install_adblock
|
||||
_prompt_install_openvpn
|
||||
_prompt_isntall_restapi
|
||||
_install_extra_features
|
||||
_prompt_install_wireguard
|
||||
_prompt_install_vpn_providers
|
||||
@@ -502,6 +503,23 @@ function _prompt_install_openvpn() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompt to install restapi
|
||||
function _prompt_install_restapi() {
|
||||
_install_log "Configure restapi"
|
||||
echo -n "Install and enable RestAPI? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
_install_status 0 "(Skipped)"
|
||||
else
|
||||
_install_restapi
|
||||
elif [ "$restapi_option" == 1 ]; then
|
||||
_install_restapi
|
||||
else
|
||||
echo "(Skipped)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompt to install WireGuard
|
||||
function _prompt_install_wireguard() {
|
||||
_install_log "Configure WireGuard support"
|
||||
@@ -562,6 +580,20 @@ function _create_openvpn_scripts() {
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
# Install and enable RestAPI configuration option
|
||||
function _install_restapi() {
|
||||
_install_log "Installing and enabling RestAPI"
|
||||
sudo cp -r "$webroot_dir/api" "$raspap_dir/api" || _install_status 1 "Unable to move api folder"
|
||||
python -m pip install -r "$raspap_dir/api/requirements.txt" || _install_status 1 " Unable to install pip modules"
|
||||
|
||||
echo "Moving restapi systemd unit control file to /lib/systemd/system/"
|
||||
sudo mv $webroot_dir/installers/restapi.service /lib/systemd/system/ || _install_status 1 "Unable to move restapi.service file"
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable restapi.service || _install_status 1 "Failed to enable restapi.service"
|
||||
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
# Fetches latest files from github to webroot
|
||||
function _download_latest_files() {
|
||||
_install_log "Cloning latest files from GitHub"
|
||||
|
||||
@@ -94,6 +94,7 @@ function _parse_params() {
|
||||
upgrade=0
|
||||
update=0
|
||||
ovpn_option=1
|
||||
restapi_option=0
|
||||
adblock_option=1
|
||||
wg_option=1
|
||||
insiders=0
|
||||
@@ -111,6 +112,10 @@ function _parse_params() {
|
||||
ovpn_option="$2"
|
||||
shift
|
||||
;;
|
||||
--api|--rest|--restapi)
|
||||
restapi_option="$2"
|
||||
shift
|
||||
;;
|
||||
-a|--adblock)
|
||||
adblock_option="$2"
|
||||
shift
|
||||
|
||||
14
installers/restapi.service
Normal file
14
installers/restapi.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=raspap-restapi
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
WorkingDirectory=/etc/raspap/api
|
||||
LimitNOFILE=4096
|
||||
ExecStart=/usr/bin/python uvicorn main:app --host 0.0.0.0 --port 8081
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user