0
0

control-m.sh: Move config into dir, change suffix into .bash

To me it looks cleaner if all data are inside a subdirectory.
The handling script itself stays outside, which brings us to a structure
like this (as also mentioned in the file itself):

 ${HOME}/vm/
 ${HOME}/vm/control-vm.sh
 ${HOME}/vm/Gentoo-guest-1/virtual-machine.img
 ${HOME}/vm/Gentoo-guest-1/virtual-machine.bash

 While on it, rename the file suffix of the config file that is sourced
 by the main script into '.bash'.

This is a breaking change, paths in configs need to be adopted.
This commit is contained in:
Nils Freydank 2024-05-05 18:28:44 +02:00
parent ac904da92d
commit b4f5beaa69
Signed by: nfr
GPG Key ID: 0F1DEAB2D36AD112

View File

@ -28,7 +28,7 @@
# Create a directory named exactly as the guest (case sensitive).
# Create an qcow2 image named virtual-machine.img inside
# the newly created directory.
# Create a configuration file named exactly as the guest plus a suffix '.sh'.
# Create a configuration file named exactly as the guest plus a suffix '.bash'.
# Fill in the data from the example below into the configuration file.
# Control the vm by calling: ./<name-of-this-script.sh> <guest> <operation>,
# e.g. ./control-vm.sh Gentoo-guest start
@ -38,14 +38,14 @@
# You should now have a setup like:
# ${HOME}/vm/
# ${HOME}/vm/control-vm.sh
# ${HOME}/vm/Gentoo-guest/virtual-machine.img
# ${HOME}/vm/Gentoo-guest.sh
# ${HOME}/vm/Gentoo-guest-1/virtual-machine.img
# ${HOME}/vm/Gentoo-guest-1/virtual-machine.bash
# === Configuration of the guest ===
# Create a file with the guest's parameters and name it same as the "GUEST_NAME"
# plus a "sh" suffix, so we can easily assume the name later.
# plus a ".bash" suffix, so we can easily assume the name later.
#
# cat << _EOF > "${GUEST_NAME}.sh"
# cat << _EOF > "${GUEST_NAME}/virtual-machine.bash"
# # Provide the GUEST_NAME which is used in further configuration.
# GUEST_NAME="Guest-OS"
# # Configure the number of CPUs.
@ -85,7 +85,7 @@ UI="${UI:-}"
# Define paths.
# Note: Sort in alphabetical order as long as inheritance is respected.
BASE_PATH="${BASE_PATH:-${HOME}/vm/${GUEST_NAME}}"
GUEST_CONFIG_FILE="${HOME}/vm/${GUEST_NAME}.sh"
GUEST_CONFIG_FILE="${HOME}/vm/${GUEST_NAME}/virtual-machine.bash"
IMAGE_PATH="${IMAGE_PATH:-${BASE_PATH}/virtual-machine.img}"
ISO_PATH="${ISO_PATH:-${BASE_PATH}/../installer/${GUEST_NAME}.iso}"
MONITOR_SOCKET="${MONITOR_SOCKET:-${BASE_PATH}/monitor.socket}"