forked from zentralwerk/network
nixos-module/server/lxc-container: split container build and activation phases
This commit is contained in:
parent
9c63bd996f
commit
f7dabd8e2d
|
@ -122,8 +122,12 @@ let
|
||||||
mkdir -p /var/lib/lxc/$c/rootfs/$d
|
mkdir -p /var/lib/lxc/$c/rootfs/$d
|
||||||
done
|
done
|
||||||
ln -fs $SYSTEM/init /var/lib/lxc/$c/rootfs/init
|
ln -fs $SYSTEM/init /var/lib/lxc/$c/rootfs/init
|
||||||
|
done
|
||||||
|
|
||||||
set +e
|
# Activate all the desired container after all of them are
|
||||||
|
# built
|
||||||
|
set +e
|
||||||
|
for c in $@; do
|
||||||
active=$(systemctl is-active lxc@$c)
|
active=$(systemctl is-active lxc@$c)
|
||||||
if [[ "$active" = active ]] ; then
|
if [[ "$active" = active ]] ; then
|
||||||
echo Activating $c
|
echo Activating $c
|
||||||
|
@ -135,8 +139,8 @@ let
|
||||||
echo Starting $c
|
echo Starting $c
|
||||||
systemctl start lxc@$c
|
systemctl start lxc@$c
|
||||||
fi
|
fi
|
||||||
set -e
|
|
||||||
done
|
done
|
||||||
|
set -e
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enable-script = pkgs.writeScriptBin "enable-containers" ''
|
enable-script = pkgs.writeScriptBin "enable-containers" ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user