1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/incus_ynh.git synced 2024-09-03 19:26:15 +02:00

Update package

This commit is contained in:
Salamandar 2024-03-14 22:22:49 +01:00
parent c3a2affe09
commit 3ac4fe21f6
7 changed files with 83 additions and 30 deletions

View file

@ -14,10 +14,12 @@ maintainers = ["Salamandar"]
[upstream]
license = "Apache-2.0"
website = "https://linuxcontainers.org/incus/"
admindoc = "https://linuxcontainers.org/incus/docs/main/"
code = "https://github.com/lxc/incus"
<<<<<<< Updated upstream
=======
# cpe = ""
>>>>>>> Stashed changes
[integration]
yunohost = '>= 11.2'
@ -25,7 +27,6 @@ architectures = ["amd64"]
multi_instance = false
ldap = "not_relevant"
sso = "not_relevant"
# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... You may have have a look at CI results
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
@ -33,11 +34,20 @@ ram.runtime = "50M"
[install]
[resources]
<<<<<<< Updated upstream
# Do NOT handle system_user, deb package will
# [resources.system_user]
# [resources.install_dir]
=======
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
# TODO: incus actual data dir
>>>>>>> Stashed changes
# Do NOT handle /var/lib, deb package will
# [resources.data_dir]

View file

@ -8,6 +8,29 @@
# PERSONAL HELPERS
#=================================================
_ynh_add_dnsmasq_config() {
ynh_add_config --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app"
ynh_systemd_action --service=dnsmasq --action=restart --log_path=systemd
}
_ynh_remove_dnsmasq_config() {
ynh_secure_remove --file="/etc/dnsmasq.d/$app"
ynh_systemd_action --service=dnsmasq --action=restart --log_path=systemd
}
_ynh_add_subuid_subgid() {
subuid_string="# Added for Incus\nroot:100000:65536"
echo -e "$subuid_string" > /etc/subuid
echo -e "$subuid_string" > /etc/subgid
}
_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/subgid
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -17,6 +15,8 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/dnsmasq.d/$app"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
@ -25,7 +25,6 @@ ynh_backup --src_path="/var/lib/incus/"
ynh_backup --src_path="/var/log/incus/"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,41 +1,40 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="First stopping the service..."
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..."
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)
ynh_use_logrotate --logfile="/var/log/incus/incusd.log"
yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log"
_ynh_add_dnsmasq_config
_ynh_add_subuid_subgid
#=================================================
# APP INITIAL CONFIGURATION
# START SYSTEMD SERVICE
#=================================================
# ADD A CONFIGURATION
#=================================================
# ynh_script_progression --message="Adding app's configuration file..."
ynh_script_progression --message="Starting $app's systemd service..."
# ynh_add_config --template="" --destination="$install_dir/"
# # FIXME: this should be handled by the core in the future
# # You may need to use chmod 600 instead of 400,
# # for example if the app is expected to be able to modify its own config
# chmod 400 "$install_dir/"
# chown $app:$app "$install_dir/"
# Start a systemd service
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,8 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#=================================================
@ -18,11 +14,17 @@ ynh_script_progression --message="Removing system configurations related to $app
yunohost service remove "$app"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
ynh_remove_logrotate
_ynh_remove_dnsmasq_config
_ynh_remove_subuid_subgid
# Remove other various files specific to the app... such as :
ynh_secure_remove --file="/var/log/$app"
ynh_secure_remove --file="/var/log/incus"
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -19,6 +17,10 @@ yunohost service add "$app" --description="Incus system container and virtual ma
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app"
_ynh_add_subuid_subgid
#=================================================
# RESTORE VARIOUS FILES
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,6 +7,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="First stopping $app service..."
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
@ -16,8 +21,21 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
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)
ynh_use_logrotate --non-append
_ynh_add_dnsmasq_config
_ynh_add_subuid_subgid
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..."
# Start a systemd service
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log"
#=================================================
# END OF SCRIPT
#=================================================