|
|
@ -4,6 +4,7 @@ |
|
|
|
|
|
|
|
|
BASEDIR=$(dirname "$0") |
|
|
BASEDIR=$(dirname "$0") |
|
|
DEBIAN='images:debian/13' |
|
|
DEBIAN='images:debian/13' |
|
|
|
|
|
APT_ARCHIVES=/var/cache/apt/archives |
|
|
CONTAINER='' |
|
|
CONTAINER='' |
|
|
|
|
|
|
|
|
# FUNCTIONS |
|
|
# FUNCTIONS |
|
|
@ -33,14 +34,19 @@ function parse_options { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# cold changes |
|
|
function before_start { |
|
|
function before_start { |
|
|
# cold changes |
|
|
|
|
|
if [[ -v MIAOU_BASH_DIR ]]; then |
|
|
if [[ -v MIAOU_BASH_DIR ]]; then |
|
|
incus config device add $CONTAINER MIAOU-BASH disk source=$MIAOU_BASH_DIR path=/opt/miaou-bash readonly=true | grep -q 'Device MIAOU-BASH added' |
|
|
incus config device add $CONTAINER MIAOU-BASH disk source=$MIAOU_BASH_DIR path=/opt/miaou-bash readonly=true | grep -q 'Device MIAOU-BASH added' |
|
|
incus config set $CONTAINER environment.PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/miaou-bash/tools |
|
|
incus config set $CONTAINER environment.PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/miaou-bash/tools |
|
|
else |
|
|
else |
|
|
echo >&2 "Warn: variable MIAOU_BASH_DIR missing!" |
|
|
echo >&2 "Warn: variable MIAOU_BASH_DIR missing!" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
incus config device add $CONTAINER MIAOU-HOSTED-ARCHIVES disk source=$APT_ARCHIVES path=/var/cache/apt-hosted-archives readonly=true | grep -q 'Device MIAOU-HOSTED-ARCHIVES added' |
|
|
|
|
|
incus file delete $CONTAINER/etc/apt/sources.list |
|
|
|
|
|
incus file push --uid 0 --gid 0 --mode 644 --create-dirs /etc/apt/sources.list.d/debian.sources $CONTAINER/etc/apt/sources.list.d/debian.sources |
|
|
|
|
|
|
|
|
cat << EOF | incus file push --uid 0 --gid 0 --mode 644 --create-dirs - $CONTAINER/etc/systemd/resolved.conf.d/10-disable-ipv4-listener.conf |
|
|
cat << EOF | incus file push --uid 0 --gid 0 --mode 644 --create-dirs - $CONTAINER/etc/systemd/resolved.conf.d/10-disable-ipv4-listener.conf |
|
|
[Resolve] |
|
|
[Resolve] |
|
|
LLMNR=no |
|
|
LLMNR=no |
|
|
@ -49,9 +55,13 @@ EOF |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# hot changes |
|
|
function after_start { |
|
|
function after_start { |
|
|
# hot changes |
|
|
|
|
|
incus exec "$CONTAINER" -- /opt/miaou-bash/init.sh |
|
|
|
|
|
|
|
|
# FIXME: should be done in some other way |
|
|
|
|
|
incus exec "$CONTAINER" -- apt-get update |
|
|
|
|
|
incus exec "$CONTAINER" -- apt-get install -y curl |
|
|
|
|
|
|
|
|
|
|
|
incus exec "$CONTAINER" -- /opt/miaou-bash/install.sh |
|
|
|
|
|
|
|
|
local domain=$(incus network get incusbr0 dns.domain) |
|
|
local domain=$(incus network get incusbr0 dns.domain) |
|
|
domain=${domain:-incus} |
|
|
domain=${domain:-incus} |
|
|
|