diff --git a/README.md b/README.md index f4eaa5a..9807c4b 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 +**Shipped version:** 5.4~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..49d0e37 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 + +**Version incluse :** 5.4~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 diff --git a/conf/go.amd64.src b/conf/go.amd64.src new file mode 100644 index 0000000..71eb790 --- /dev/null +++ b/conf/go.amd64.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://go.dev/dl/go1.18.5.linux-amd64.tar.gz +SOURCE_SUM=9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/go.arm.src b/conf/go.arm.src index ba5efc9..7f4d622 100644 --- a/conf/go.arm.src +++ b/conf/go.arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://go.dev/dl/go1.18.linux-armv6l.tar.gz -SOURCE_SUM=a80fa43d1f4575fb030adbfbaa94acd860c6847820764eecb06c63b7c103612b +SOURCE_URL=https://go.dev/dl/go1.18.5.linux-armv6l.tar.gz +SOURCE_SUM=d5ac34ac5f060a5274319aa04b7b11e41b123bd7887d64efb5f44ead236957af SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/go.arm64.src b/conf/go.arm64.src index 10e72b6..9f4b858 100644 --- a/conf/go.arm64.src +++ b/conf/go.arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://go.dev/dl/go1.18.linux-arm64.tar.gz -SOURCE_SUM=7ac7b396a691e588c5fb57687759e6c4db84a2a3bbebb0765f4b38e5b1c5b00e +SOURCE_URL=https://go.dev/dl/go1.18.5.linux-arm64.tar.gz +SOURCE_SUM=006f6622718212363fa1ff004a6ab4d87bbbe772ec5631bab7cac10be346e4f1 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/go.i386.src b/conf/go.i386.src index 756c57d..88c74f0 100644 --- a/conf/go.i386.src +++ b/conf/go.i386.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://go.dev/dl/go1.18.linux-386.tar.gz -SOURCE_SUM=1c04cf4440b323a66328e0df95d409f955b9b475e58eae235fdd3d1f1cf02f4f +SOURCE_URL=https://go.dev/dl/go1.18.5.linux-386.tar.gz +SOURCE_SUM=0c44f85d146c6f98c34e8ff436a42af22e90e36fe232d3d9d3101f23fd61362b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/go.x86-64.src b/conf/go.x86-64.src deleted file mode 100644 index 21b66db..0000000 --- a/conf/go.x86-64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://go.dev/dl/go1.18.linux-amd64.tar.gz -SOURCE_SUM=e85278e98f57cdb150fe8409e6e5df5343ecb13cebf03a5d5ff12bd55a80264f -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/lxd.src b/conf/lxd.src index caa9cdd..a4189ab 100644 --- a/conf/lxd.src +++ b/conf/lxd.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/lxc/lxd/releases/download/lxd-5.3/lxd-5.3.tar.gz -SOURCE_SUM=0d174a09fa749cbde58393bf5a6eef5f682b3bf0c1bb2847462f395c8e656995 +SOURCE_URL=https://github.com/lxc/lxd/releases/download/lxd-5.4/lxd-5.4.tar.gz +SOURCE_SUM=e234b67c5077d05e22f958e3256bd91f262450545993d0aaf1b4ce2bdb99393a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true 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..fe0169b --- /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-logo.png new file mode 100644 index 0000000..e344c1d Binary files /dev/null and b/doc/screenshots/LXD-logo.png differ diff --git a/manifest.json b/manifest.json index 4d0dd1d..b624e80 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Offers a user experience similar to virtual machines but using Linux containers instead.", "fr": "Offre une expérience utilisateur similaire aux machines virtuelles mais en utilisant des conteneurs Linux à la place." }, - "version": "5.3~ynh1", + "version": "5.4~ynh1", "url": "https://example.com", "upstream": { "license": "Apache-2.0", @@ -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" #=================================================