diff --git a/manifest.toml b/manifest.toml index e25971b..d448f04 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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] diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..54107d3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 #================================================= diff --git a/scripts/backup b/scripts/backup index 5fc645f..d951f93 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 #================================================= diff --git a/scripts/install b/scripts/install index cf23305..286308f 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/remove b/scripts/remove index 5f01d44..edaf939 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index dbbdac8..f05c33d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 85de93c..fcd6aa4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #=================================================