mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Autodetect incus/lxd unless specific YNHDEV_BACKEND
This commit is contained in:
parent
8db653ea9e
commit
2490e35731
3 changed files with 12 additions and 7 deletions
|
@ -33,9 +33,9 @@ assert_we_are_connected_to_the_internets() {
|
||||||
|
|
||||||
assert_we_have_all_dependencies() {
|
assert_we_have_all_dependencies() {
|
||||||
deps=("lynx" "jq" "python3" "pip3")
|
deps=("lynx" "jq" "python3" "pip3")
|
||||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
if [[ "${lxc}" == "incus" ]]; then
|
||||||
deps+=(incus)
|
deps+=(incus)
|
||||||
else
|
elif [[ "${lxc}" == "lxc" ]]; then
|
||||||
deps+=(lxc lxd)
|
deps+=(lxc lxd)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ function set_incus_remote()
|
||||||
|
|
||||||
function check_lxc_setup()
|
function check_lxc_setup()
|
||||||
{
|
{
|
||||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
if [[ "${lxc}" == "incus" ]]; then
|
||||||
check_incus_setup
|
check_incus_setup
|
||||||
else
|
else
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
|
|
11
lib/lxc.sh
11
lib/lxc.sh
|
@ -3,10 +3,15 @@
|
||||||
# Check for LXC or Incus
|
# Check for LXC or Incus
|
||||||
function switch_lxc_incus()
|
function switch_lxc_incus()
|
||||||
{
|
{
|
||||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
if [[ -z "${YNHDEV_BACKEND:-}" ]]; then
|
||||||
lxc=incus
|
# Autodetect because no preference was specified
|
||||||
|
if command -v incus 2>&1 >/dev/null; then
|
||||||
|
lxc="incus"
|
||||||
|
else
|
||||||
|
lxc="lxc"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
lxc=lxc
|
lxc="${YNHDEV_BACKEND}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ print_help() {
|
||||||
-S, --storage-dir DIRECTORY Where to store temporary test files like yunohost backups
|
-S, --storage-dir DIRECTORY Where to store temporary test files like yunohost backups
|
||||||
-h, --help Display this help
|
-h, --help Display this help
|
||||||
|
|
||||||
Pass YNHDEV_BACKEND=incus to use incus instead of lxd.
|
Pass YNHDEV_BACKEND=incus|lxd to use a specific LXD-compatible backend.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue