mirror of
https://github.com/YunoHost-Apps/incus_ynh.git
synced 2024-09-03 19:26:15 +02:00
Merge 8efe4c9c1b
into 9c25b6026f
This commit is contained in:
commit
11af1821bd
8 changed files with 37 additions and 52 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -20,6 +20,7 @@ code = "https://github.com/lxc/incus"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = '>= 11.2'
|
yunohost = '>= 11.2'
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = ["amd64"]
|
architectures = ["amd64"]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = "not_relevant"
|
ldap = "not_relevant"
|
||||||
|
|
|
@ -1,24 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
_ynh_add_dnsmasq_config() {
|
_ynh_add_dnsmasq_config() {
|
||||||
ynh_add_config --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app"
|
ynh_config_add --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app"
|
||||||
ynh_systemd_action --service_name=dnsmasq --action=restart --log_path=systemd
|
ynh_systemctl --service=dnsmasq --action=restart --log_path=systemd
|
||||||
}
|
}
|
||||||
|
|
||||||
_ynh_remove_dnsmasq_config() {
|
_ynh_remove_dnsmasq_config() {
|
||||||
ynh_secure_remove --file="/etc/dnsmasq.d/$app"
|
ynh_safe_rm "/etc/dnsmasq.d/$app"
|
||||||
ynh_systemd_action --service_name=dnsmasq --action=restart --log_path=systemd
|
ynh_systemctl --service=dnsmasq --action=restart --log_path=systemd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_ynh_add_subuid_subgid() {
|
_ynh_add_subuid_subgid() {
|
||||||
subuid_string="# Added for Incus\nroot:100000:65536"
|
subuid_string="# Added for Incus\nroot:100000:65536"
|
||||||
echo -e "$subuid_string" > /etc/subuid
|
echo -e "$subuid_string" > /etc/subuid
|
||||||
|
@ -29,12 +24,3 @@ _ynh_remove_subuid_subgid() {
|
||||||
sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subuid
|
sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subuid
|
||||||
sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subgid
|
sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subgid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -8,25 +8,22 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/dnsmasq.d/$app"
|
ynh_backup "/etc/dnsmasq.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/var/lib/incus/"
|
ynh_backup "/var/lib/incus/"
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/incus/"
|
ynh_backup "/var/log/incus/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -10,19 +10,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="First stopping the service..."
|
ynh_script_progression "First stopping the service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..."
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --logfile="/var/log/incus/incusd.log"
|
ynh_config_add_logrotate "/var/log/incus/incusd.log"
|
||||||
|
|
||||||
_ynh_add_dnsmasq_config
|
_ynh_add_dnsmasq_config
|
||||||
|
|
||||||
|
@ -31,12 +31,12 @@ _ynh_add_subuid_subgid
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -10,13 +10,13 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEMD SERVICE
|
# REMOVE SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..."
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
yunohost service remove "$app"
|
yunohost service remove "$app"
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
_ynh_remove_dnsmasq_config
|
_ynh_remove_dnsmasq_config
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ _ynh_remove_subuid_subgid
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -11,13 +11,13 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app"
|
ynh_restore "/etc/dnsmasq.d/$app"
|
||||||
|
|
||||||
_ynh_add_subuid_subgid
|
_ynh_add_subuid_subgid
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ _ynh_add_subuid_subgid
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/var/lib/incus"
|
ynh_restore "/var/lib/incus"
|
||||||
ynh_restore_file --origin_path="/var/log/incus"
|
ynh_restore "/var/log/incus"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -10,19 +10,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="First stopping $app service..."
|
ynh_script_progression "First stopping $app service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..."
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
_ynh_add_dnsmasq_config
|
_ynh_add_dnsmasq_config
|
||||||
|
|
||||||
|
@ -32,13 +32,13 @@ _ynh_add_subuid_subgid
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue