|
|
@ -40,8 +40,10 @@ function prepare_lxd { |
|
|
|
fi |
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install lxd btrfs-progs |
|
|
|
} |
|
|
|
|
|
|
|
override_lxd_service |
|
|
|
function configure_lxd { |
|
|
|
local PREFIX="lxd:configure" |
|
|
|
|
|
|
|
# test lxdbr0 FIXME: preseed too much repetitions!!!! |
|
|
|
if ! lxc network info lxdbr0 &>/dev/null; then |
|
|
@ -178,14 +180,14 @@ EOF |
|
|
|
|
|
|
|
echo -n "set environment container_hostname to <$env_container_hostname> ... " |
|
|
|
sg $NEW_GROUP -c "lxc profile set default environment.container_hostname \"$env_container_hostname\"" |
|
|
|
PREFIX="" echoinfo OK |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|
echo "environment container_hostname <$env_container_hostname> already defined!" |
|
|
|
fi |
|
|
|
|
|
|
|
if ! grep -q "root:$(id -u):1" /etc/subuid; then |
|
|
|
echo -n "subuid, subgid allowing <$(whoami)> ..." |
|
|
|
printf "root:$(id -u):1\n" | sudo tee -a /etc/subuid /etc/subgid |
|
|
|
echo -n "saving subuid, subgid permissions for <$(whoami)> ..." |
|
|
|
printf "root:$(id -u):1\n" | sudo tee -a /etc/subuid /etc/subgid &>/dev/null |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|
echo "subuid, subgid allowing <$(whoami)> already done!" |
|
|
@ -215,7 +217,7 @@ function set_alias { |
|
|
|
if ! lxc alias list -f csv | grep -q "^$name,"; then |
|
|
|
echo -n "defining new lxc alias <$name> ..." |
|
|
|
lxc alias add "$name" "$command" |
|
|
|
PREFIX="" echoinfo OK |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|
echo "lxc alias <$name> already defined!" |
|
|
|
fi |
|
|
@ -226,7 +228,7 @@ function miaou_evalfrombashrc() { |
|
|
|
local PREFIX="miaou:bashrc" |
|
|
|
output=$( |
|
|
|
/opt/miaou-bash/tools/append_or_replace \ |
|
|
|
"^eval \"\\$\($MIAOU_BASEDIR/lib/install.sh shellenv\)\"$" \ |
|
|
|
"^eval \"\\$\(.*miaou/lib/install.sh shellenv\)\"$" \ |
|
|
|
"eval \"\$($MIAOU_BASEDIR/lib/install.sh shellenv)\"" \ |
|
|
|
"$HOME/.bashrc" |
|
|
|
) |
|
|
@ -353,12 +355,13 @@ function miaou_resolver() { |
|
|
|
fi |
|
|
|
else |
|
|
|
if ! grep -q "nameserver $bridge" /etc/resolv.conf; then |
|
|
|
echo "customize resolv.conf from scratch (SERVER)..." |
|
|
|
echo -n "customize resolv.conf from scratch with bridge=<$bridge>, gatewary=<$gateway> ..." |
|
|
|
sudo tee /etc/resolv.conf &>/dev/null <<EOF |
|
|
|
nameserver $bridge |
|
|
|
nameserver $gateway |
|
|
|
# generated by miaou |
|
|
|
nameserver $bridge # LXD bridge |
|
|
|
nameserver $gateway # gateway |
|
|
|
EOF |
|
|
|
PREFIX="" echoinfo OK |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|
echo "customize resolv.conf already already defined!" |
|
|
|
fi |
|
|
@ -376,14 +379,14 @@ function override_lxd_service { |
|
|
|
if [[ ! -d /etc/systemd/system/lxd.service.d ]]; then |
|
|
|
echo -n "override lxd service..." |
|
|
|
sudo mkdir -p /etc/systemd/system/lxd.service.d |
|
|
|
cat <<EOF | sudo tee /etc/systemd/system/lxd.service.d/override.conf |
|
|
|
sudo tee /etc/systemd/system/lxd.service.d/override.conf &>/dev/null <<EOF |
|
|
|
[Service] |
|
|
|
ExecStartPost=systemctl reload nftables.service |
|
|
|
Environment=LANGUAGE=en:en_US |
|
|
|
EOF |
|
|
|
sudo systemctl daemon-reload |
|
|
|
sudo systemctl restart lxd.service |
|
|
|
PREFIX="" echo "OK" |
|
|
|
PREFIX="" echoinfo "DONE" |
|
|
|
else |
|
|
|
echo "lxd service already overridden!" |
|
|
|
fi |
|
|
@ -472,6 +475,8 @@ else |
|
|
|
add_toolbox_sudoers |
|
|
|
prepare_nftables |
|
|
|
prepare_lxd |
|
|
|
override_lxd_service |
|
|
|
configure_lxd |
|
|
|
preload_bookworm_image |
|
|
|
miaou_resolver |
|
|
|
miaou_evalfrombashrc |
|
|
|