From c37fa07f0b8951dc12a8fb21ebbf51b4f89f113f Mon Sep 17 00:00:00 2001 From: Willem Date: Sun, 30 Jun 2024 14:23:28 +0200 Subject: [PATCH] Renamed boot hdd to fire hdd. --- lib/make/mb_openmsx.mk | 8 +- lib/openmsx/share/scripts/boot_hdd.tcl | 128 ------------------------- lib/openmsx/share/scripts/fire_hdd.tcl | 128 +++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 132 deletions(-) delete mode 100644 lib/openmsx/share/scripts/boot_hdd.tcl create mode 100644 lib/openmsx/share/scripts/fire_hdd.tcl diff --git a/lib/make/mb_openmsx.mk b/lib/make/mb_openmsx.mk index e29f4f5..b69d699 100644 --- a/lib/make/mb_openmsx.mk +++ b/lib/make/mb_openmsx.mk @@ -20,8 +20,8 @@ define mb_openmsx_setup $(if $(wildcard $(1)-omsx/share/settings.xml),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/settings.xml,$(1)-omsx/share)) $(if $(wildcard $(1)-omsx/share/scripts),,$(call mb_mkdir,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/boot_exec.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_exec.tcl,$(1)-omsx/share/scripts)) - $(if $(wildcard $(1)-omsx/share/scripts/boot_hdd.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_hdd.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/fail_after.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/fail_after.tcl,$(1)-omsx/share/scripts)) + $(if $(wildcard $(1)-omsx/share/scripts/fire_hdd.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/fire_hdd.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/headless.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/headless.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/night_flight.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/night_flight.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/omsxctl.tcl),,$(call mb_msxhub_file,$(1)-omsx/share/scripts,OMSXCTL/1.0-1/get/OMSXCTL/omsxctl.tcl)) @@ -35,9 +35,9 @@ endef define _mb_openmsx_run @echo === openMSX Start for $@ BOOT_WATCHDOG=$(MB_OPENMSX_BOOT_TIMEOUT) \ - BOOT_HDD_PATH="$(1)" \ - BOOT_HDD_SIZE=$(MB_OPENMSX_HDD_SIZE) \ - BOOT_HDD_IMAGE="$(1)-omsx/persistent/ide-nextor/untitled1/hd.dsk" \ + FIRE_HDD_PATH="$(1)" \ + FIRE_HDD_SIZE=$(MB_OPENMSX_HDD_SIZE) \ + FIRE_HDD_IMAGE="$(1)-omsx/persistent/ide-nextor/untitled1/hd.dsk" \ SCALE_FACTOR=$(MB_OPENMSX_SCALE_FACTOR) \ SPEED=$(MB_OPENMSX_SPEED) \ HEADLESS=$(MB_OPENMSX_HEADLESS) \ diff --git a/lib/openmsx/share/scripts/boot_hdd.tcl b/lib/openmsx/share/scripts/boot_hdd.tcl deleted file mode 100644 index 43dc5e6..0000000 --- a/lib/openmsx/share/scripts/boot_hdd.tcl +++ /dev/null @@ -1,128 +0,0 @@ -# boot_hdd -- Create import/export disk images to local folder. -# -# Typically used in automation tools which run openMSX without human interaction. -# This script is basicly is a bit more generic and safe way to run the following code; -# -# diskmanipulator create disk.img 32m 32m 32m 32m -# hda disk.img -# diskmanipulator import hda1 ./disk-in/ -# after quit {diskmanipulator export hda1 ./disk-out/} -# -# Supported environment variables by this script; -# -# BOOT_HDD_SIZE=30m -# Sets the size of the created partitions, defaults to 15m for dos1. -# -# BOOT_HDD_IMAGE=bin/myapp/dsk.img -# Defaults to ./hdd.dsk -# -# BOOT_HDD_PATH=bin/myapp/dsk -# provides the default values for BOOT_HDD_PATH_IMPORT and BOOT_HDD_PATH_EXPORT -# -# BOOT_HDD_PATH_IMPORT=bin/myapp/dsk -# When set enables the import of all files into the first disk partition. -# -# BOOT_HDD_PATH_EXPORT=bin/myapp/dsk-result -# When set enables the export of all files back to the filesystem -# -# BOOT_HDD_EXPORT_PARTITION=2 -# When set override the export from 'first' to 'given' partition number. -# -# BOOT_HDD_EXPORT_DIR=myout -# By default export does chdir to root of msx partition override to custom export directory. -# -# BOOT_HDD_PARTITIONS=2 -# The number of partitions created in the disk image, defaults to 1. -# - -set boot_hdd_size 15m -set boot_hdd_image hdd.dsk -set boot_hdd_path_import 0 -set boot_hdd_path_export 0 -set boot_hdd_export_partition 0 -set boot_hdd_export_dir \\ -set boot_hdd_partitions 1 - -if {[info exists ::env(BOOT_HDD_SIZE)] && ([string trim $::env(BOOT_HDD_SIZE)] != "")} { - set boot_hdd_size [string trim $::env(BOOT_HDD_SIZE)] -} -if {[info exists ::env(BOOT_HDD_IMAGE)] && ([string trim $::env(BOOT_HDD_IMAGE)] != "")} { - set boot_hdd_image [string trim $::env(BOOT_HDD_IMAGE)] -} -if {[info exists ::env(BOOT_HDD_PATH)] && ([string trim $::env(BOOT_HDD_PATH)] != "")} { - set boot_hdd_path_import [string trim $::env(BOOT_HDD_PATH)] - set boot_hdd_path_export [string trim $::env(BOOT_HDD_PATH)] -} -if {[info exists ::env(BOOT_HDD_PATH_IMPORT)] && ([string trim $::env(BOOT_HDD_PATH_IMPORT)] != "")} { - set boot_hdd_path_import [string trim $::env(BOOT_HDD_PATH_IMPORT)] -} -if {[info exists ::env(BOOT_HDD_PATH_EXPORT)] && ([string trim $::env(BOOT_HDD_PATH_EXPORT)] != "")} { - set boot_hdd_path_export [string trim $::env(BOOT_HDD_PATH_EXPORT)] -} -if {[info exists ::env(BOOT_HDD_EXPORT_PARTITION)] && ([string trim $::env(BOOT_HDD_EXPORT_PARTITION)] != "")} { - set boot_hdd_export_partition [string trim $::env(BOOT_HDD_EXPORT_PARTITION)] -} -if {[info exists ::env(BOOT_HDD_EXPORT_DIR)] && ([string trim $::env(BOOT_HDD_EXPORT_DIR)] != "")} { - set boot_hdd_export_dir [string trim $::env(BOOT_HDD_EXPORT_DIR)] -} -if {[info exists ::env(BOOT_HDD_PARTITIONS)] && ([string trim $::env(BOOT_HDD_PARTITIONS)] != "")} { - set boot_hdd_partitions [string trim $::env(BOOT_HDD_PARTITIONS)] - if {$boot_hdd_partitions == 0 || $boot_hdd_partitions > 4} { - puts stderr "error: Invalid env.BOOT_HDD_PARTITIONS value 1-4 allowed: $boot_hdd_partitions" - exit 1 - } -} - -if {$boot_hdd_path_import != 0} { - set boot_hdd_disk_partition "hda" - if {$boot_hdd_partitions == 1} { - if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size} err_msg]} { - puts stderr "error: create1 $err_msg" - exit 1 - } - } - if {$boot_hdd_partitions > 1} { - set boot_hdd_disk_partition "hda1" - if {$boot_hdd_partitions == 2} { - if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size} err_msg]} { - puts stderr "error: create2 $err_msg" - exit 1 - } - } - if {$boot_hdd_partitions == 3} { - if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size $boot_hdd_size} err_msg]} { - puts stderr "error: create3 $err_msg" - exit 1 - } - } - if {$boot_hdd_partitions == 4} { - if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size $boot_hdd_size $boot_hdd_size} err_msg]} { - puts stderr "error: create4 $err_msg" - exit 1 - } - } - } - if {[catch {hda $boot_hdd_image} err_msg]} { - puts stderr "error: hda $err_msg" - exit 1 - } - if {[catch {diskmanipulator import $boot_hdd_disk_partition $boot_hdd_path_import} err_msg]} { - puts stderr "error: import $err_msg" - exit 1 - } - if {$boot_hdd_path_export != 0} { - if {$boot_hdd_export_partition != 0} { - set boot_hdd_disk_partition "hda$boot_hdd_export_partition" - } - after quit { - if {[catch {diskmanipulator chdir $boot_hdd_disk_partition $boot_hdd_export_dir} err_msg]} { - puts stderr "error: chdir $err_msg" - exit 1 - } - if {[catch {diskmanipulator export $boot_hdd_disk_partition $boot_hdd_path_export} err_msg]} { - puts stderr "error: export $err_msg" - exit 1 - } - } - } -} diff --git a/lib/openmsx/share/scripts/fire_hdd.tcl b/lib/openmsx/share/scripts/fire_hdd.tcl new file mode 100644 index 0000000..5bca198 --- /dev/null +++ b/lib/openmsx/share/scripts/fire_hdd.tcl @@ -0,0 +1,128 @@ +# fire_hdd -- Automatic fire hard disk drive which does import/export to local folder. +# +# Typically used in automation tools which run openMSX without human interaction. +# This script is a complex, but safe form, of the following code; +# +# diskmanipulator create disk.img 32m 32m 32m 32m +# hda disk.img +# diskmanipulator import hda1 ./disk-in/ +# after quit {diskmanipulator export hda1 ./disk-out/} +# +# Supported environment variables by this script; +# +# FIRE_HDD_SIZE=30m +# Sets the size of the created partitions, defaults to 15m for dos1. +# +# FIRE_HDD_IMAGE=bin/myapp/dsk.img +# Defaults to ./hdd.dsk +# +# FIRE_HDD_PATH=bin/myapp/dsk +# provides the default values for FIRE_HDD_PATH_IMPORT and FIRE_HDD_PATH_EXPORT +# +# FIRE_HDD_PATH_IMPORT=bin/myapp/dsk +# When set enables the import of all files into the first disk partition. +# +# FIRE_HDD_PATH_EXPORT=bin/myapp/dsk-result +# When set enables the export of all files back to the file system +# +# FIRE_HDD_EXPORT_PARTITION=2 +# When set override the export from 'first' to 'given' partition number. +# +# FIRE_HDD_EXPORT_DIR=myout +# By default export does change directory to root of MSX partition override to custom export directory. +# +# FIRE_HDD_PARTITIONS=2 +# The number of partitions created in the disk image, defaults to 1. +# + +set fire_hdd_size 15m +set fire_hdd_image hdd.dsk +set fire_hdd_path_import 0 +set fire_hdd_path_export 0 +set fire_hdd_export_partition 0 +set fire_hdd_export_dir \\ +set fire_hdd_partitions 1 + +if {[info exists ::env(FIRE_HDD_SIZE)] && ([string trim $::env(FIRE_HDD_SIZE)] != "")} { + set fire_hdd_size [string trim $::env(FIRE_HDD_SIZE)] +} +if {[info exists ::env(FIRE_HDD_IMAGE)] && ([string trim $::env(FIRE_HDD_IMAGE)] != "")} { + set fire_hdd_image [string trim $::env(FIRE_HDD_IMAGE)] +} +if {[info exists ::env(FIRE_HDD_PATH)] && ([string trim $::env(FIRE_HDD_PATH)] != "")} { + set fire_hdd_path_import [string trim $::env(FIRE_HDD_PATH)] + set fire_hdd_path_export [string trim $::env(FIRE_HDD_PATH)] +} +if {[info exists ::env(FIRE_HDD_PATH_IMPORT)] && ([string trim $::env(FIRE_HDD_PATH_IMPORT)] != "")} { + set fire_hdd_path_import [string trim $::env(FIRE_HDD_PATH_IMPORT)] +} +if {[info exists ::env(FIRE_HDD_PATH_EXPORT)] && ([string trim $::env(FIRE_HDD_PATH_EXPORT)] != "")} { + set fire_hdd_path_export [string trim $::env(FIRE_HDD_PATH_EXPORT)] +} +if {[info exists ::env(FIRE_HDD_EXPORT_PARTITION)] && ([string trim $::env(FIRE_HDD_EXPORT_PARTITION)] != "")} { + set fire_hdd_export_partition [string trim $::env(FIRE_HDD_EXPORT_PARTITION)] +} +if {[info exists ::env(FIRE_HDD_EXPORT_DIR)] && ([string trim $::env(FIRE_HDD_EXPORT_DIR)] != "")} { + set fire_hdd_export_dir [string trim $::env(FIRE_HDD_EXPORT_DIR)] +} +if {[info exists ::env(FIRE_HDD_PARTITIONS)] && ([string trim $::env(FIRE_HDD_PARTITIONS)] != "")} { + set fire_hdd_partitions [string trim $::env(FIRE_HDD_PARTITIONS)] + if {$fire_hdd_partitions == 0 || $fire_hdd_partitions > 4} { + puts stderr "error: Invalid env.FIRE_HDD_PARTITIONS value 1-4 allowed: $fire_hdd_partitions" + exit 1 + } +} + +if {$fire_hdd_path_import != 0} { + set fire_hdd_disk_partition "hda" + if {$fire_hdd_partitions == 1} { + if {[catch {diskmanipulator create $fire_hdd_image $fire_hdd_size} err_msg]} { + puts stderr "error: create1 $err_msg" + exit 1 + } + } + if {$fire_hdd_partitions > 1} { + set fire_hdd_disk_partition "hda1" + if {$fire_hdd_partitions == 2} { + if {[catch {diskmanipulator create $fire_hdd_image $fire_hdd_size $fire_hdd_size} err_msg]} { + puts stderr "error: create2 $err_msg" + exit 1 + } + } + if {$fire_hdd_partitions == 3} { + if {[catch {diskmanipulator create $fire_hdd_image $fire_hdd_size $fire_hdd_size $fire_hdd_size} err_msg]} { + puts stderr "error: create3 $err_msg" + exit 1 + } + } + if {$fire_hdd_partitions == 4} { + if {[catch {diskmanipulator create $fire_hdd_image $fire_hdd_size $fire_hdd_size $fire_hdd_size $fire_hdd_size} err_msg]} { + puts stderr "error: create4 $err_msg" + exit 1 + } + } + } + if {[catch {hda $fire_hdd_image} err_msg]} { + puts stderr "error: hda $err_msg" + exit 1 + } + if {[catch {diskmanipulator import $fire_hdd_disk_partition $fire_hdd_path_import} err_msg]} { + puts stderr "error: import $err_msg" + exit 1 + } + if {$fire_hdd_path_export != 0} { + if {$fire_hdd_export_partition != 0} { + set fire_hdd_disk_partition "hda$fire_hdd_export_partition" + } + after quit { + if {[catch {diskmanipulator chdir $fire_hdd_disk_partition $fire_hdd_export_dir} err_msg]} { + puts stderr "error: chdir $err_msg" + exit 1 + } + if {[catch {diskmanipulator export $fire_hdd_disk_partition $fire_hdd_path_export} err_msg]} { + puts stderr "error: export $err_msg" + exit 1 + } + } + } +}