1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lxd_ynh.git synced 2024-09-03 19:45:53 +02:00

Merge pull request #50 from YunoHost-Apps/testing

Testing
This commit is contained in:
Kayou 2022-08-02 16:16:22 +02:00 committed by GitHub
commit c33736b381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 165 additions and 166 deletions

View file

@ -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

View file

@ -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

7
conf/go.amd64.src Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

1
doc/DESCRIPTION.md Normal file
View file

@ -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.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -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.

3
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,3 @@
## Configuration
Comment configurer cette application : en cli

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -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": [],

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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"
#=================================================