From 189d7138f97dc5c9ffc52e0f6c5f0abb7a048da1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 27 Jul 2022 20:53:30 +0200 Subject: [PATCH 1/4] Apply last example_ynh --- doc/DESCRIPTION.md | 1 + doc/DESCRIPTION_fr.md | 1 + doc/DISCLAIMER_fr.md | 3 + doc/screenshots/.gitkeep | 0 doc/screenshots/LXD-logo.png | Bin 0 -> 10041 bytes manifest.json | 2 +- scripts/_common.sh | 16 ----- scripts/backup | 1 - scripts/install | 68 +++++++++---------- scripts/remove | 27 ++++---- scripts/restore | 36 +++++----- scripts/upgrade | 123 +++++++++++++++++------------------ 12 files changed, 133 insertions(+), 145 deletions(-) create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DESCRIPTION_fr.md create mode 100644 doc/DISCLAIMER_fr.md create mode 100644 doc/screenshots/.gitkeep create mode 100644 doc/screenshots/LXD-logo.png diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..c41d8e6 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines. \ No newline at end of file diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..b6581c7 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouvelle génération. Il offre une expérience utilisateur unifiée autour de systèmes Linux complets fonctionnant dans des conteneurs ou des machines virtuelles. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..d745899 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,3 @@ +## Configuration + +Comment configurer cette application : en cli diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/LXD-logo.png b/doc/screenshots/LXD-log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LqpJQ@4=@kIMLy=m^uC=)8j2^S1e$3hUP5ELo$KrC z_r-Qxp#{0t48*bh{I-7Kn0obz?3tSZ>5aRI-D{2O>B32d9dpPnT=-U1azKFcdwFRu ztR^&efUmhqz$F({&ED>oxZ4~JVbe*3^2b{qw4)nC+4AOkpbqi=JkaL;qE`PVN3qL) sg(8*$w!Ib&@EzEw4@Y-!TzsI=KvGI`+J_3@Egb0TWvff2#x9Zn2XQ-33IG5A literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json index 4d0dd1d..8d0e873 100644 --- a/manifest.json +++ b/manifest.json @@ -21,7 +21,7 @@ "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 4.2.8" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [], diff --git a/scripts/_common.sh b/scripts/_common.sh index 72aa754..37c653b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -100,22 +100,6 @@ ynh_remove_systemd_socket_config () { # EXPERIMENTAL HELPERS #================================================= -ynh_detect_arch(){ - local architecture - if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then - architecture="arm64" - elif [ -n "$(uname -m | grep 64)" ]; then - architecture="x86-64" - elif [ -n "$(uname -m | grep 86)" ]; then - architecture="i386" - elif [ -n "$(uname -m | grep arm)" ]; then - architecture="arm" - else - architecture="unknown" - fi - echo $architecture -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 5d5c634..402b1e8 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script diff --git a/scripts/install b/scripts/install index d25d182..0a5e584 100755 --- a/scripts/install +++ b/scripts/install @@ -42,6 +42,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=30 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -49,7 +57,7 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src go_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$(ynh_detect_arch)" +ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$YNH_ARCH" export PATH=$go_tmp/bin:$PATH @@ -58,55 +66,38 @@ ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd" export GOPATH=${lxd_tmp}/vendor/ +#================================================= +# SPECIFIC SETUP #================================================= # BUILD FROM SOURCES #================================================= ynh_script_progression --message="Building lxd from sources..." --weight=60 pushd ${lxd_tmp} + export HOME=${HOME:-"/root/"} -export HOME=${HOME:-"/root/"} + ynh_exec_warn_less make deps + export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" + export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" + export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" + export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" -ynh_exec_warn_less make deps -export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" -export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" -export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" -export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" + ynh_exec_warn_less make -ynh_exec_warn_less make - -mkdir -p /usr/local/lib/$app -mkdir -p /var/log/$app -cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ -cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin -cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ + mkdir -p /usr/local/lib/$app + mkdir -p /var/log/$app + cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ + cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin + cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ popd ynh_secure_remove --file="$go_tmp" ynh_secure_remove --file="$lxd_tmp" #================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - -#================================================= -# SPECIFIC SETUP -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_socket_config -ynh_add_systemd_config - -#================================================= -# MODIFY A CONFIG FILE +# ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Adding a configuration file..." echo "bind-interfaces except-interface=lxdbr0" > /etc/dnsmasq.d/lxd @@ -123,6 +114,15 @@ ldconfig echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_socket_config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/remove b/scripts/remove index 4bbf943..95203ad 100755 --- a/scripts/remove +++ b/scripts/remove @@ -35,8 +35,19 @@ fi ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config -ynh_remove_systemd_socket_config -ynh_exec_warn_less ynh_remove_systemd_config +ynh_exec_warn_less ynh_remove_systemd_socket_config +ynh_exec_warn_less ynh_remove_systemd_config + +#================================================= +# REMOVE CONTAINERS +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing containers..." + ynh_secure_remove --file="/var/lib/lxd" +fi #================================================= # REMOVE DEPENDENCIES @@ -61,6 +72,7 @@ fi #================================================= # REMOVE VARIOUS FILES #================================================= +ynh_script_progression --message="Removing various files..." # Remove a directory securely ynh_secure_remove --file="/etc/ld.so.conf.d/$app.conf" @@ -98,17 +110,6 @@ ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app -#================================================= -# REMOVE CONTAINERS -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing containers..." - ynh_secure_remove --file="/var/lib/lxd" -fi - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index b2e217f..635c162 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -48,25 +47,10 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=30 # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" -systemctl enable $app.service --quiet - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --log="/var/log/$app/$app.log" - #================================================= # RESTORE VARIOUS FILES #================================================= +ynh_script_progression --message="Restoring various files..." ynh_restore_file --origin_path="/var/log/$app/" @@ -93,6 +77,22 @@ ldconfig echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" +systemctl enable $app.service --quiet + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index de91b2f..0048c21 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,13 +16,6 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -sed -i "/root:1000000:65536 # Added by lxd#/d" /etc/sub{u,g}id - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -57,56 +50,11 @@ ynh_systemd_action --service_name="$app.socket" --action="stop" ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= -# UPGRADE DEPENDENCIES +# ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Upgrading dependencies..." +ynh_script_progression --message="Ensuring downward compatibility..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -ynh_script_progression --message="Setting up source files..." - -# Download, check integrity, uncompress and patch the source from app.src -go_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$(ynh_detect_arch)" - -export PATH=$go_tmp/bin:$PATH - -lxd_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd" - -export GOPATH=${lxd_tmp}/vendor/ - -#================================================= -# BUILD FROM SOURCES -#================================================= -ynh_script_progression --message="Building lxd from sources..." --weight=60 - -pushd ${lxd_tmp} - -export HOME=${HOME:-"/root/"} - -ynh_exec_warn_less make deps -export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" -export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" -export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" -export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" - -export GOCACHE=$go_tmp - -ynh_exec_warn_less make - -mkdir -p /usr/local/lib/$app -mkdir -p /var/log/$app -cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ -cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin -cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ -popd - -ynh_secure_remove --file="$go_tmp" -ynh_secure_remove --file="$lxd_tmp" +sed -i "/root:1000000:65536 # Added by lxd#/d" /etc/sub{u,g}id #================================================= # CREATE DEDICATED USER @@ -116,20 +64,63 @@ ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." + +# Download, check integrity, uncompress and patch the source from app.src +go_tmp=$(mktemp -d) +ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$YNH_ARCH" + +export PATH=$go_tmp/bin:$PATH + +lxd_tmp=$(mktemp -d) +ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd" + +export GOPATH=${lxd_tmp}/vendor/ + +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # SPECIFIC UPGRADE #================================================= -# SETUP SYSTEMD +# BUILD FROM SOURCES #================================================= -ynh_script_progression --message="Configuring a systemd service..." +ynh_script_progression --message="Building lxd from sources..." --weight=60 -# Create a dedicated systemd config -ynh_add_systemd_socket_config -ynh_add_systemd_config +pushd ${lxd_tmp} + export HOME=${HOME:-"/root/"} + + ynh_exec_warn_less make deps + export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" + export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" + export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" + export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" + + export GOCACHE=$go_tmp + + ynh_exec_warn_less make + + mkdir -p /usr/local/lib/$app + mkdir -p /var/log/$app + cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ + cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin + cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ +popd + +ynh_secure_remove --file="$go_tmp" +ynh_secure_remove --file="$lxd_tmp" #================================================= -# MODIFY A CONFIG FILE +# UPDATE A CONFIG FILE #================================================= +ynh_script_progression --message="Updating a configuration file..." ynh_backup_if_checksum_is_different --file="/etc/dnsmasq.d/lxd" @@ -150,6 +141,15 @@ ldconfig echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_socket_config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= @@ -164,7 +164,6 @@ yunohost service add $app --log="/var/log/$app/$app.log" #================================================= ynh_script_progression --message="Starting a systemd service..." -# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= From 2c02dfc6df9ffae0386b27201959d972c815c295 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 27 Jul 2022 21:00:08 +0200 Subject: [PATCH 2/4] Fix amd64 source --- conf/{go.x86-64.src => go.amd64.src} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename conf/{go.x86-64.src => go.amd64.src} (100%) diff --git a/conf/go.x86-64.src b/conf/go.amd64.src similarity index 100% rename from conf/go.x86-64.src rename to conf/go.amd64.src From d3fbcaf70450f471aa45f6ed0e0c925481800bb1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 27 Jul 2022 21:22:13 +0200 Subject: [PATCH 3/4] Update DESCRIPTION_fr.md --- doc/DESCRIPTION_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index b6581c7..fe0169b 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1 +1 @@ -LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouvelle génération. Il offre une expérience utilisateur unifiée autour de systèmes Linux complets fonctionnant dans des conteneurs ou des machines virtuelles. +LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouvelle génération. Il offre une expérience utilisateur unifiée autour de systèmes Linux complets fonctionnant dans des conteneurs ou des machines virtuelles. From 9a06c85aba4fff4bc18463ad3a9a286382d38aaf Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 27 Jul 2022 19:22:18 +0000 Subject: [PATCH 4/4] Auto-update README --- README.md | 7 ++++++- README_fr.md | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f4eaa5a..f9a5a3c 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,16 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Offers a user experience similar to virtual machines but using Linux containers instead. +LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines. **Shipped version:** 5.3~ynh1 **Demo:** https://linuxcontainers.org/lxd/try-it/ + +## Screenshots + +![Screenshot of LXD](./doc/screenshots/LXD-logo.png) + ## Disclaimers / important information ## Configuration diff --git a/README_fr.md b/README_fr.md index 86042ec..af6326c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -15,16 +15,22 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Offre une expérience utilisateur similaire aux machines virtuelles mais en utilisant des conteneurs Linux à la place. +LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouvelle génération. Il offre une expérience utilisateur unifiée autour de systèmes Linux complets fonctionnant dans des conteneurs ou des machines virtuelles. + **Version incluse :** 5.3~ynh1 **Démo :** https://linuxcontainers.org/lxd/try-it/ + +## Captures d'écran + +![Capture d'écran de LXD](./doc/screenshots/LXD-logo.png) + ## Avertissements / informations importantes ## Configuration -How to configure this app: In cli +Comment configurer cette application : en cli ## Documentations et ressources