aboutsummaryrefslogtreecommitdiff
path: root/dbx-start
diff options
context:
space:
mode:
Diffstat (limited to 'dbx-start')
-rwxr-xr-xdbx-start15
1 files changed, 13 insertions, 2 deletions
diff --git a/dbx-start b/dbx-start
index 0fd1419..1b602e1 100755
--- a/dbx-start
+++ b/dbx-start
@@ -1,12 +1,23 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only
+# SPDX-FileCopyrightText: 2026 Nicholas Rodrigues Lordello <[email protected]>
set -euo pipefail
-C="dbx"
+root="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+machine="${DBX_MACHINE:-dbx}"
if ! container system status &>/dev/null; then
container system start >/dev/null
fi
-container start $C >/dev/null
+container machine run --name="$machine" true >/dev/null
+
+# The IP address assigned to the machine changes on restarts, so update the SSH
+# configuration with the current value.
+ip="$(container machine inspect "$machine" | jq -r '.[0].ipAddress')"
+cat "$root/ssh/config.in" \
+ | sed -e 's|$ROOT|'"$root"'|g' \
+ | sed -e 's|$MACHINE|'"$machine"'|g' \
+ | sed -e 's|$IP|'"$ip"'|g' \
+ >"$root/ssh/$machine.config"