diff options
Diffstat (limited to 'dbx-start')
| -rwxr-xr-x | dbx-start | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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" |
