mirror of
https://github.com/YunoHost-Apps/webmin_ynh.git
synced 2024-09-03 20:36:08 +02:00
Updated few tings
This commit is contained in:
parent
6d08c1d89b
commit
d6fcf4e378
8 changed files with 184 additions and 80 deletions
|
@ -1,8 +1,12 @@
|
||||||
# WebMin package installation for YunoHost
|
# WebMin package installation for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/webmin)  
|
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=webmin) <br> <br>
|
[](https://dash.yunohost.org/appci/app/webmin)
|
||||||
|
[](https://install-app.yunohost.org/?app=webmin)
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
> *This package allow you to install Webmin quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
**Note:** This app has **root** access which can change core things in the system, thus **breaking the YunoHost**. Use it carefully and read the [documents](https://doxfer.webmin.com/Webmin/Main_Page) two times before changing values.
|
**Note:** This app has **root** access which can change core things in the system, thus **breaking the YunoHost**. Use it carefully and read the [documents](https://doxfer.webmin.com/Webmin/Main_Page) two times before changing values.
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# ============= FUTURE YUNOHOST HELPER =============
|
#=================================================
|
||||||
# Delete a file checksum from the app settings
|
# COMMON VARIABLES
|
||||||
#
|
#=================================================
|
||||||
# $app should be defined when calling this helper
|
|
||||||
#
|
# dependencies used by the app
|
||||||
# usage: ynh_remove_file_checksum file
|
pkg_dependencies="perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python"
|
||||||
# | arg: file - The file for which the checksum will be deleted
|
|
||||||
ynh_delete_file_checksum () {
|
#=================================================
|
||||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
# PERSONAL HELPERS
|
||||||
ynh_app_setting_delete $app $checksum_setting_name
|
#=================================================
|
||||||
}
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -23,21 +24,42 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd Webmin service..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_backup "/etc/webmin/miniserv.conf"
|
ynh_backup --src_path="/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
|
=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd Webmin service..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="start"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
|
||||||
|
|
|
@ -49,6 +49,13 @@ fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -40,55 +40,69 @@ admin=$YNH_APP_ARG_ADMIN
|
||||||
### db names, ...
|
### db names, ...
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Normalize the url path syntax
|
#=================================================
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
#=================================================
|
||||||
|
### About --weight and --time
|
||||||
|
### ynh_script_progression will show to your final users the progression of each scripts.
|
||||||
|
### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script.
|
||||||
|
### --time is a packager option, it will show you the execution time since the previous call.
|
||||||
|
### This option should be removed before releasing your app.
|
||||||
|
### Use the execution time, given by --time, to estimate the weight of a step.
|
||||||
|
### A common way to do it is to set a weight equal to the execution time in second +1.
|
||||||
|
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
|
||||||
|
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
||||||
|
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring firewall..." --time --weight=1
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
### Use these lines if you have to open a port for the application
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
### `ynh_find_port` will find the first available port starting from the given port.
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
### - Remove the section "CLOSE A PORT" in the remove script
|
||||||
|
|
||||||
# Find a free port
|
# Find an available port
|
||||||
port=$(ynh_find_port 10000)
|
port=$(ynh_find_port --port=10000)
|
||||||
# Open this port
|
# Open this port
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||||
|
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
### If you're not using this helper:
|
### If you're not using this helper:
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
|
### - Remove the variable "pkg_dependencies" in _common.sh
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
ynh_install_app_dependencies perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
|
@ -99,12 +113,12 @@ sudo sh -c "echo 'deb http://download.webmin.com/download/repository sarge contr
|
||||||
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
||||||
|
|
||||||
|
|
||||||
sudo wget http://www.webmin.com/jcameron-key.asc
|
wget http://www.webmin.com/jcameron-key.asc
|
||||||
sudo apt-key add jcameron-key.asc
|
apt-key add jcameron-key.asc
|
||||||
sudo rm jcameron-key.asc
|
rm jcameron-key.asc
|
||||||
|
|
||||||
sudo apt-get update
|
apt-get update
|
||||||
sudo apt-get install -y webmin
|
apt-get install -y webmin
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -113,8 +127,8 @@ sudo apt-get install -y webmin
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
ynh_replace_string "port=10000" "port=$port" "/etc/webmin/miniserv.conf"
|
ynh_replace_string --match_string="port=10000" --replace_string"port=$port" --target_file="/etc/webmin/miniserv.conf"
|
||||||
ynh_replace_string "listen=10000" "listen=$port" "/etc/webmin/miniserv.conf"
|
ynh_replace_string --match_string="listen=10000" --replace_string"listen=$port" --target_file="/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -125,20 +139,26 @@ ynh_replace_string "listen=10000" "listen=$port" "/etc/webmin/miniserv.conf"
|
||||||
### you can make a backup of this file before modifying it again if the admin had modified it.
|
### you can make a backup of this file before modifying it again if the admin had modified it.
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "/etc/webmin/miniserv.conf"
|
ynh_store_file_checksum --file="/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
|
||||||
|
|
||||||
# Restrict access to admin only
|
# Restrict access to admin only
|
||||||
yunohost app addaccess --users=$admin $app
|
yunohost app addaccess --users=$admin $app
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND START WEBMIN
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl enable webmin
|
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||||
systemctl restart webmin
|
|
||||||
sudo service nginx reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
ynh_script_progression --message="Starting webmin web server..." --time --weight=1
|
||||||
|
ynh_systemd_action --service_name=$app --action=enable
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action=start
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,15 +12,24 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STOP WEBMIN
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping webmin service..." --time --weight=1
|
||||||
|
|
||||||
|
# Remove the dedicated Webmin
|
||||||
|
ynh_systemd_action --service_name=webmin --action=stop
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -28,6 +37,7 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -38,12 +48,15 @@ ynh_remove_nginx_config
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
echo "Close port $port" >&2
|
ynh_script_progression --message="Closing port $port..."
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
sudo apt-get remove -y --purge webmin
|
#=================================================
|
||||||
sudo rm -r /etc/apt/sources.list.d/webmin.list
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
apt-get remove -y --purge webmin
|
||||||
|
rm -r /etc/apt/sources.list.d/webmin.list
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -23,20 +24,22 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -44,7 +47,8 @@ ynh_webpath_available $domain $path_url \
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -53,7 +57,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,12 +65,12 @@ sudo sh -c "echo 'deb http://download.webmin.com/download/repository sarge contr
|
||||||
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
||||||
|
|
||||||
|
|
||||||
sudo wget http://www.webmin.com/jcameron-key.asc
|
wget http://www.webmin.com/jcameron-key.asc
|
||||||
sudo apt-key add jcameron-key.asc
|
apt-key add jcameron-key.asc
|
||||||
sudo rm jcameron-key.asc
|
rm jcameron-key.asc
|
||||||
|
|
||||||
sudo apt-get update
|
apt-get update
|
||||||
sudo apt-get install -y webmin
|
apt-get install -y webmin
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -75,9 +79,8 @@ sudo apt-get install -y webmin
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
ynh_replace_string "port=10000" "port=$port" "/etc/webmin/miniserv.conf"
|
ynh_replace_string --match_string="port=10000" --replace_string"port=$port" --target_file="/etc/webmin/miniserv.conf"
|
||||||
ynh_replace_string "listen=10000" "listen=$port" "/etc/webmin/miniserv.conf"
|
ynh_replace_string --match_string="listen=10000" --replace_string"listen=$port" --target_file="/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -89,6 +92,16 @@ yunohost app addaccess --users=$admin $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND START WEBMIN
|
# RELOAD NGINX AND START WEBMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl enable webmin
|
ynh_script_progression --message="Starting webmin web server..." --time --weight=1
|
||||||
systemctl restart webmin
|
|
||||||
sudo service nginx reload
|
ynh_systemd_action --service_name=$app --action=enable
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action=start
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --time --last
|
||||||
|
|
|
@ -12,13 +12,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE PATH
|
# CHECK THE PATH
|
||||||
|
@ -30,15 +31,24 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -47,9 +57,9 @@ ynh_install_app_dependencies perl libnet-ssleay-perl openssl libauthen-pam-perl
|
||||||
sudo sh -c "echo 'deb http://download.webmin.com/download/repository sarge contrib' > /etc/apt/sources.list.d/webmin.list"
|
sudo sh -c "echo 'deb http://download.webmin.com/download/repository sarge contrib' > /etc/apt/sources.list.d/webmin.list"
|
||||||
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
sudo sh -c "echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list"
|
||||||
|
|
||||||
sudo wget http://www.webmin.com/jcameron-key.asc
|
wget http://www.webmin.com/jcameron-key.asc
|
||||||
sudo apt-key add jcameron-key.asc
|
apt-key add jcameron-key.asc
|
||||||
sudo rm jcameron-key.asc
|
rm jcameron-key.asc
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get upgrade
|
sudo apt-get upgrade
|
||||||
|
@ -67,8 +77,8 @@ ynh_store_file_checksum "/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
echo "Close port $port" >&2
|
ynh_script_progression --message="Closing port $port..."
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,8 +91,14 @@ yunohost app addaccess --users=$admin $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND START WEBMIN
|
# RELOAD NGINX AND START WEBMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl enable webmin
|
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||||
systemctl restart webmin
|
|
||||||
sudo service nginx reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
ynh_script_progression --message="Starting webmin web server..." --time --weight=1
|
||||||
|
ynh_systemd_action --service_name=$app --action=enable
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action=start
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue