Use QVM_BIN_DIR fallback for script paths and set in flake
This commit is contained in:
parent
8d68e1daf9
commit
7864673dcb
6 changed files with 13 additions and 14 deletions
|
|
@ -21,8 +21,7 @@ readonly QVM_LIB_DIR="${QVM_LIB_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../lib
|
||||||
source "${QVM_LIB_DIR}/common.sh"
|
source "${QVM_LIB_DIR}/common.sh"
|
||||||
|
|
||||||
# Get path to qvm-stop script
|
# Get path to qvm-stop script
|
||||||
readonly QVM_BIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
readonly QVM_STOP="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-stop"
|
||||||
readonly QVM_STOP="${QVM_BIN_DIR}/qvm-stop"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# confirm_clean - Prompt user for confirmation
|
# confirm_clean - Prompt user for confirmation
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@ readonly QVM_LIB_DIR="${QVM_LIB_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../lib
|
||||||
source "${QVM_LIB_DIR}/common.sh"
|
source "${QVM_LIB_DIR}/common.sh"
|
||||||
|
|
||||||
# Get path to qvm-stop script
|
# Get path to qvm-stop script
|
||||||
readonly QVM_BIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
readonly QVM_STOP="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-stop"
|
||||||
readonly QVM_STOP="${QVM_BIN_DIR}/qvm-stop"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# confirm_reset - Prompt user for confirmation
|
# confirm_reset - Prompt user for confirmation
|
||||||
|
|
|
||||||
12
bin/qvm-run
12
bin/qvm-run
|
|
@ -159,6 +159,9 @@ main() {
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ensure directories exist before accessing workspaces.json
|
||||||
|
ensure_dirs
|
||||||
|
|
||||||
# If no command given, default to interactive zsh shell
|
# If no command given, default to interactive zsh shell
|
||||||
local run_shell=false
|
local run_shell=false
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
|
|
@ -188,10 +191,8 @@ main() {
|
||||||
if [[ "$newly_added" -eq 1 ]] && is_vm_running; then
|
if [[ "$newly_added" -eq 1 ]] && is_vm_running; then
|
||||||
log_info "New workspace registered. Restarting VM to mount it..."
|
log_info "New workspace registered. Restarting VM to mount it..."
|
||||||
|
|
||||||
# Path to qvm-stop and qvm-start scripts
|
local qvm_stop="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-stop"
|
||||||
local script_dir="${QVM_LIB_DIR}/../bin"
|
local qvm_start="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-start"
|
||||||
local qvm_stop="$script_dir/qvm-stop"
|
|
||||||
local qvm_start="$script_dir/qvm-start"
|
|
||||||
|
|
||||||
# Stop the VM
|
# Stop the VM
|
||||||
if ! "$qvm_stop"; then
|
if ! "$qvm_stop"; then
|
||||||
|
|
@ -210,8 +211,7 @@ main() {
|
||||||
if ! is_vm_running; then
|
if ! is_vm_running; then
|
||||||
log_info "VM not running, starting..."
|
log_info "VM not running, starting..."
|
||||||
|
|
||||||
# Path to qvm-start script
|
local qvm_start="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-start"
|
||||||
local qvm_start="${QVM_LIB_DIR}/../bin/qvm-start"
|
|
||||||
|
|
||||||
if ! "$qvm_start"; then
|
if ! "$qvm_start"; then
|
||||||
die "Failed to start VM"
|
die "Failed to start VM"
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ main() {
|
||||||
# Ensure VM is running (auto-start if needed)
|
# Ensure VM is running (auto-start if needed)
|
||||||
if ! is_vm_running; then
|
if ! is_vm_running; then
|
||||||
log_info "VM is not running, starting it..."
|
log_info "VM is not running, starting it..."
|
||||||
"$QVM_LIB_DIR/../bin/qvm-start"
|
" "${QVM_BIN_DIR:-$(dirname "$0")}/qvm-start""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get SSH port
|
# Get SSH port
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ main() {
|
||||||
log_info "First run detected - building VM..."
|
log_info "First run detected - building VM..."
|
||||||
log_info "This may take several minutes."
|
log_info "This may take several minutes."
|
||||||
|
|
||||||
SCRIPT_DIR="$(dirname "$0")"
|
local qvm_rebuild="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-rebuild"
|
||||||
if ! "$SCRIPT_DIR/qvm-rebuild"; then
|
if ! "$qvm_rebuild"; then
|
||||||
die "Failed to build VM. Run 'qvm rebuild' manually to debug."
|
die "Failed to build VM. Run 'qvm rebuild' manually to debug."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@
|
||||||
pkgs.sshpass
|
pkgs.sshpass
|
||||||
]
|
]
|
||||||
} \
|
} \
|
||||||
--set QVM_LIB_DIR "$out/lib/qvm"
|
--set QVM_LIB_DIR "$out/lib/qvm" \
|
||||||
|
--set QVM_BIN_DIR "$out/bin"
|
||||||
done
|
done
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue