fallback to local image

This commit is contained in:
Kay0u 2021-02-17 16:17:36 +01:00
parent d5dcbdd8be
commit 8228370c84
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -6,13 +6,25 @@
LXC_CREATE () { LXC_CREATE () {
log_info "Launching new LXC $LXC_NAME ..." log_info "Launching new LXC $LXC_NAME ..."
# Check if we can launch container from yunohost remote image
if lxc remote list | grep -q "yunohost" && lxc image list yunohost:$LXC_BASE | grep -q -w $LXC_BASE; then
lxc launch yunohost:$LXC_BASE $LXC_NAME \ lxc launch yunohost:$LXC_BASE $LXC_NAME \
-c security.nesting=true \ -c security.nesting=true \
-c security.privileged=true \ -c security.privileged=true \
-c limits.memory=80% \ -c limits.memory=80% \
-c limits.cpu.allowance=80% \ -c limits.cpu.allowance=80% \
>>/proc/self/fd/3 >>/proc/self/fd/3
# Check if we can launch container from a local image
elif lxc image list $LXC_BASE | grep -q -w $LXC_BASE; then
lxc launch $LXC_BASE $LXC_NAME \
-c security.nesting=true \
-c security.privileged=true \
-c limits.memory=80% \
-c limits.cpu.allowance=80% \
>>/proc/self/fd/3
else
log_critical "Can't find base image $LXC_BASE, run ./package_check --rebuild"
fi
[[ "${PIPESTATUS[0]}" -eq 0 ]] || exit 1 [[ "${PIPESTATUS[0]}" -eq 0 ]] || exit 1
_LXC_START_AND_WAIT $LXC_NAME _LXC_START_AND_WAIT $LXC_NAME