diff --git a/repos/dde_bsd/run/audio_out.run b/repos/dde_bsd/run/audio_out.run
index 902af1566..92c784b43 100644
--- a/repos/dde_bsd/run/audio_out.run
+++ b/repos/dde_bsd/run/audio_out.run
@@ -4,7 +4,7 @@ assert_spec x86
# Check used commands
#
-set wget [check_installed wget]
+set wget [installed_command wget]
#
# Configure
diff --git a/repos/dde_linux/run/lxip_http_srv.run b/repos/dde_linux/run/lxip_http_srv.run
index 9488c083b..d31f7f8dc 100644
--- a/repos/dde_linux/run/lxip_http_srv.run
+++ b/repos/dde_linux/run/lxip_http_srv.run
@@ -1,7 +1,7 @@
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
set use_nic_driver [expr [have_spec linux] || [expr !$use_usb_driver && ![have_spec imx53] && ![have_spec odroid_xu] && ![have_spec linux] && ![have_spec wand_quad]]]
-requires_installation_of lynx
+set lynx [installed_command lynx]
#
# Build
@@ -139,7 +139,7 @@ if {[have_include "power_on/qemu"]} {
puts "http server is up, try to query website $uri"
-set website [exec lynx -dump $uri]
+set website [exec $lynx -dump $uri]
puts "response:\n$website"
diff --git a/repos/dde_rump/run/fs_rom_update_ext2.run b/repos/dde_rump/run/fs_rom_update_ext2.run
index ff5647aed..d49856bd9 100644
--- a/repos/dde_rump/run/fs_rom_update_ext2.run
+++ b/repos/dde_rump/run/fs_rom_update_ext2.run
@@ -19,7 +19,7 @@ create_boot_directory
catch { exec dd if=/dev/zero of=bin/ext2.img bs=1024 count=8192 }
-set mkfs_cmd [check_installed mkfs.ext2]
+set mkfs_cmd [installed_command mkfs.ext2]
catch { exec $mkfs_cmd -F bin/ext2.img }
@@ -131,6 +131,7 @@ set boot_modules {
rump.lib.so
timer
vfs
+ vfs.lib.so
vfs_rump.lib.so
}
diff --git a/repos/dde_rump/run/libc_vfs_ext2.run b/repos/dde_rump/run/libc_vfs_ext2.run
index 7812dc7dc..21fd5071c 100644
--- a/repos/dde_rump/run/libc_vfs_ext2.run
+++ b/repos/dde_rump/run/libc_vfs_ext2.run
@@ -1,4 +1,4 @@
-set mkfs_cmd [check_installed mke2fs]
+set mkfs_cmd [installed_command mke2fs]
set mkfs_opts "-F"
set test_build_components "lib/vfs/rump"
diff --git a/repos/dde_rump/run/libc_vfs_fs_ext2.run b/repos/dde_rump/run/libc_vfs_fs_ext2.run
index 0e549eac5..42f1b885d 100644
--- a/repos/dde_rump/run/libc_vfs_fs_ext2.run
+++ b/repos/dde_rump/run/libc_vfs_fs_ext2.run
@@ -1,4 +1,4 @@
-set mkfs_cmd [check_installed mke2fs]
+set mkfs_cmd [installed_command mke2fs]
set mkfs_opts "-F"
set test_build_components "lib/vfs/rump"
diff --git a/repos/dde_rump/run/rump_ext2.run b/repos/dde_rump/run/rump_ext2.run
index a136a77a1..19e08bba5 100644
--- a/repos/dde_rump/run/rump_ext2.run
+++ b/repos/dde_rump/run/rump_ext2.run
@@ -5,8 +5,8 @@ if {[have_spec arm]} {
#
# Check used commands
#
-set mke2fs [check_installed mke2fs]
-set dd [check_installed dd]
+set mke2fs [installed_command mke2fs]
+set dd [installed_command dd]
#
# Build
diff --git a/repos/dde_rump/run/rump_fat.run b/repos/dde_rump/run/rump_fat.run
index 42055f10e..67cc9eceb 100644
--- a/repos/dde_rump/run/rump_fat.run
+++ b/repos/dde_rump/run/rump_fat.run
@@ -5,8 +5,8 @@ if {[have_spec arm]} {
#
# Check used commands
#
-set mkfs [check_installed mkfs.vfat]
-set dd [check_installed dd]
+set mkfs [installed_command mkfs.vfat]
+set dd [installed_command dd]
#
# Build
@@ -58,7 +58,7 @@ append config {
-
+
diff --git a/repos/dde_rump/run/rump_iso.run b/repos/dde_rump/run/rump_iso.run
index 14b704e9b..b7d5d4a8a 100644
--- a/repos/dde_rump/run/rump_iso.run
+++ b/repos/dde_rump/run/rump_iso.run
@@ -5,7 +5,7 @@ if {[have_spec arm]} {
#
# Check used commands
#
-set mkisofs [check_installed mkisofs]
+set mkisofs [installed_command mkisofs]
#
# Build
@@ -51,7 +51,7 @@ append config {
-
+
diff --git a/repos/dde_rump/run/vfs_stress_ext2.run b/repos/dde_rump/run/vfs_stress_ext2.run
index 4910f0664..12a1a67d2 100644
--- a/repos/dde_rump/run/vfs_stress_ext2.run
+++ b/repos/dde_rump/run/vfs_stress_ext2.run
@@ -7,8 +7,8 @@
#
# Check used commands
#
-set mke2fs [check_installed mke2fs]
-set dd [check_installed dd]
+set mke2fs [installed_command mke2fs]
+set dd [installed_command dd]
build "core init drivers/timer test/vfs_stress server/ram_blk lib/vfs/rump"
@@ -55,7 +55,8 @@ install_config {
set boot_modules {
core init ld.lib.so timer vfs_stress
- rump.lib.so rump_fs.lib.so vfs_rump.lib.so
+ rump.lib.so rump_fs.lib.so
+ vfs.lib.so vfs_rump.lib.so
ram_blk ext2.raw
}
diff --git a/repos/dde_rump/run/vfs_stress_rump_fs.run b/repos/dde_rump/run/vfs_stress_rump_fs.run
index ebeb3cd6e..10bc7fad4 100644
--- a/repos/dde_rump/run/vfs_stress_rump_fs.run
+++ b/repos/dde_rump/run/vfs_stress_rump_fs.run
@@ -7,8 +7,8 @@
#
# Check used commands
#
-set mke2fs [check_installed mke2fs]
-set dd [check_installed dd]
+set mke2fs [installed_command mke2fs]
+set dd [installed_command dd]
build "core init drivers/timer test/vfs_stress server/ram_blk server/rump_fs"
@@ -63,7 +63,7 @@ install_config {
set boot_modules {
core init ld.lib.so timer vfs_stress
rump.lib.so rump_fs.lib.so rump_fs
- ram_blk ext2.raw
+ ram_blk ext2.raw vfs.lib.so
}
build_boot_image $boot_modules
diff --git a/repos/gems/run/driver_manager.run b/repos/gems/run/driver_manager.run
index d084f2167..052298ffc 100644
--- a/repos/gems/run/driver_manager.run
+++ b/repos/gems/run/driver_manager.run
@@ -134,8 +134,8 @@ build_boot_image { driver_manager test-driver_manager ld.lib.so }
#
if {[have_include "power_on/qemu"]} {
- set mke2fs [check_installed mke2fs]
- set dd [check_installed dd]
+ set mke2fs [installed_command mke2fs]
+ set dd [installed_command dd]
catch { exec $dd if=/dev/zero of=bin/hdd_disk.raw bs=1M count=32 }
catch { exec $mke2fs -F bin/hdd_disk.raw }
diff --git a/repos/libports/run/fs_rom_update_fat.run b/repos/libports/run/fs_rom_update_fat.run
index e81b561a4..81bb1780d 100644
--- a/repos/libports/run/fs_rom_update_fat.run
+++ b/repos/libports/run/fs_rom_update_fat.run
@@ -17,7 +17,7 @@ build $build_components
create_boot_directory
-set mkfs_cmd [check_installed mkfs.vfat]
+set mkfs_cmd [installed_command mkfs.vfat]
catch { exec $mkfs_cmd -C bin/fat.img -n "ROM_UPDATE" 64 }
@@ -127,6 +127,7 @@ set boot_modules {
rom_to_file
timer
vfs
+ vfs.lib.so
vfs_fatfs.lib.so
}
diff --git a/repos/libports/run/libc_fatfs.run b/repos/libports/run/libc_fatfs.run
index 577078d1d..f837d6959 100644
--- a/repos/libports/run/libc_fatfs.run
+++ b/repos/libports/run/libc_fatfs.run
@@ -1,4 +1,4 @@
-set mkfs_cmd [check_installed mkfs.vfat]
+set mkfs_cmd [installed_command mkfs.vfat]
set mkfs_opts "-F32"
set filesystem fatfs
diff --git a/repos/libports/run/libc_vfs_fat.run b/repos/libports/run/libc_vfs_fat.run
index c89c50324..8ea6c53b8 100644
--- a/repos/libports/run/libc_vfs_fat.run
+++ b/repos/libports/run/libc_vfs_fat.run
@@ -1,4 +1,4 @@
-set mkfs_cmd [check_installed mkfs.vfat]
+set mkfs_cmd [installed_command mkfs.vfat]
set mkfs_opts "-F32 -nlibc_vfs"
set test_build_components lib/vfs/fatfs
diff --git a/repos/libports/run/libc_vfs_fs_fat.run b/repos/libports/run/libc_vfs_fs_fat.run
index bc6daa71f..47f9269c9 100644
--- a/repos/libports/run/libc_vfs_fs_fat.run
+++ b/repos/libports/run/libc_vfs_fs_fat.run
@@ -1,4 +1,4 @@
-set mkfs_cmd [check_installed mkfs.vfat]
+set mkfs_cmd [installed_command mkfs.vfat]
set mkfs_opts "-F32 -nlibc_vfs"
set test_build_components lib/vfs/fatfs
diff --git a/repos/libports/run/libc_vfs_fs_test.inc b/repos/libports/run/libc_vfs_fs_test.inc
index 48bb4fb1e..7096efb32 100644
--- a/repos/libports/run/libc_vfs_fs_test.inc
+++ b/repos/libports/run/libc_vfs_fs_test.inc
@@ -7,7 +7,7 @@
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_ahci_drv [expr [have_spec x86] && ![have_spec linux]]
set use_ram_blk [have_spec linux]
-set mkfs [check_installed $mkfs_cmd]
+set mkfs [installed_command $mkfs_cmd]
if {[have_spec odroid_xu]} {
puts "Run script does not support this platform"; exit }
diff --git a/repos/libports/run/lwip.run b/repos/libports/run/lwip.run
index 87f8d34b2..dd71d2a58 100644
--- a/repos/libports/run/lwip.run
+++ b/repos/libports/run/lwip.run
@@ -27,7 +27,7 @@ if {[expr !$use_usb_driver && !$use_nic_driver] ||
[expr [have_spec imx53] && [have_spec trustzone]]} {
puts "\n Run script is not supported on this platform. \n"; exit 0 }
-requires_installation_of lynx
+set lynx [installed_command lynx]
#
# Build
@@ -163,7 +163,7 @@ if {[have_include "power_on/qemu"]} {
puts "http server is up, try to query website $uri"
-set website [exec lynx -dump $uri]
+set website [exec $lynx -dump $uri]
puts "response:\n$website"
diff --git a/repos/os/run/ahci_bench.run b/repos/os/run/ahci_bench.run
index b346e31fc..db26d09f4 100644
--- a/repos/os/run/ahci_bench.run
+++ b/repos/os/run/ahci_bench.run
@@ -1,6 +1,6 @@
-set mke2fs [check_installed mke2fs]
-set dd [check_installed dd]
+set mke2fs [installed_command mke2fs]
+set dd [installed_command dd]
#
# Build
diff --git a/repos/os/run/ahci_blk.run b/repos/os/run/ahci_blk.run
index a6fb82665..c0769e9ea 100644
--- a/repos/os/run/ahci_blk.run
+++ b/repos/os/run/ahci_blk.run
@@ -1,6 +1,6 @@
-set mke2fs [check_installed mke2fs]
-set dd [check_installed dd]
+set mke2fs [installed_command mke2fs]
+set dd [installed_command dd]
#
# Build
diff --git a/repos/os/run/block_tester.run b/repos/os/run/block_tester.run
index c653535b9..c718a7dbd 100644
--- a/repos/os/run/block_tester.run
+++ b/repos/os/run/block_tester.run
@@ -3,7 +3,7 @@ set use_linux [have_spec linux]
#
# Check used commands
#
-set dd [check_installed dd]
+set dd [installed_command dd]
#
# Build
diff --git a/repos/os/run/nvme.run b/repos/os/run/nvme.run
index e39375233..5c22dc005 100644
--- a/repos/os/run/nvme.run
+++ b/repos/os/run/nvme.run
@@ -27,7 +27,7 @@ set small_test [expr $is_qemu || [have_spec foc] || [have_spec sel4]]
#
# Check used commands
#
-set dd [check_installed dd]
+set dd [installed_command dd]
#
# Build
diff --git a/repos/os/run/part_blk.inc b/repos/os/run/part_blk.inc
index d96fb392e..71e619a4e 100644
--- a/repos/os/run/part_blk.inc
+++ b/repos/os/run/part_blk.inc
@@ -2,7 +2,7 @@
# \brief Test of Block session interface provided by server/part_blk
#
-requires_installation_of parted
+set parted [installed_command parted]
#
# Build
@@ -30,15 +30,15 @@ if { ![file exists $img_path] } then {
puts "using parted to partition disk image"
if { $mode == "mbr" } {
- exec parted -s $img_path mklabel msdos
- exec parted -s $img_path mkpart primary fat32 2048s 4095s
- exec parted -s $img_path mkpart extended 4096s 20479s
- exec parted -s $img_path mkpart logical fat32 6144s 10239s
- exec parted -s $img_path mkpart logical fat32 12288s 20479s
+ exec $parted -s $img_path mklabel msdos
+ exec $parted -s $img_path mkpart primary fat32 2048s 4095s
+ exec $parted -s $img_path mkpart extended 4096s 20479s
+ exec $parted -s $img_path mkpart logical fat32 6144s 10239s
+ exec $parted -s $img_path mkpart logical fat32 12288s 20479s
} else {
- exec parted -s $img_path mklabel gpt
- exec parted -s $img_path mkpart one fat32 2048s 4095s
- exec parted -s $img_path mkpart two fat32 4096s 20446s
+ exec $parted -s $img_path mklabel gpt
+ exec $parted -s $img_path mkpart one fat32 2048s 4095s
+ exec $parted -s $img_path mkpart two fat32 4096s 20446s
}
}
diff --git a/repos/ports/run/noux_fs.run b/repos/ports/run/noux_fs.run
index 4b8cf5bf0..b89818285 100644
--- a/repos/ports/run/noux_fs.run
+++ b/repos/ports/run/noux_fs.run
@@ -1,5 +1,5 @@
-set genext2fs [check_installed genext2fs]
-set e2fsck [check_installed e2fsck]
+set genext2fs [installed_command genext2fs]
+set e2fsck [installed_command e2fsck]
create_boot_directory
diff --git a/tool/run/image/disk b/tool/run/image/disk
index c217ca857..cc1bb9e33 100644
--- a/tool/run/image/disk
+++ b/tool/run/image/disk
@@ -15,14 +15,13 @@ proc image_disk_size { } { return [get_cmd_arg --image-disk-size 0] }
#
proc run_image { {unused ""} } {
- requires_installation_of sgdisk
- requires_installation_of e2cp
+ set sgdisk [installed_command sgdisk]
# make copy of template grub2 header image
exec cp [get_grub2_dir]/boot/grub2-head.img [run_dir].header
# remove template partition
- exec sgdisk --delete=3 [run_dir].header
+ exec $sgdisk --delete=3 [run_dir].header
# calculate size of grub2 header and the size of Genode scenario
set size_header [expr [regsub {\s.*} [exec du -b [run_dir].header] {}]]
@@ -36,7 +35,7 @@ proc run_image { {unused ""} } {
# setup partition with content
exec dd if=/dev/zero of=[run_dir].partition bs=1k count=$disk_size_kb 2>/dev/null
- exec mkfs.ext2 -L GENODE -q -T default [run_dir].partition
+ exec [installed_command mkfs.ext2] -L GENODE -q -T default [run_dir].partition
# copy content to disk image
foreach file [exec find [run_dir]] {
@@ -46,9 +45,9 @@ proc run_image { {unused ""} } {
}
if {[file isdirectory $file]} {
- exec e2mkdir [run_dir].partition:$filename
+ exec [installed_command e2mkdir] [run_dir].partition:$filename
} else {
- exec e2cp $file [run_dir].partition:$filename
+ exec [installed_command e2cp] $file [run_dir].partition:$filename
}
}
@@ -57,7 +56,7 @@ proc run_image { {unused ""} } {
set last_sector [expr ((($size_header + ($disk_size_kb * 1024)) / 512) - 1)]
# add free space for the backup gpt at the end of disk
- set sector_backup [exec sgdisk --info=1 [run_dir].header]
+ set sector_backup [exec $sgdisk --info=1 [run_dir].header]
set sector_backup [regexp -all -line -inline {First sector: ([0-9]+)} $sector_backup]
set sector_backup [lindex $sector_backup 1]
@@ -72,14 +71,14 @@ proc run_image { {unused ""} } {
exec rm [run_dir].partition
# move backup GPT to the end of the disk
- exec sgdisk --move-second-header [run_dir].img
+ exec $sgdisk --move-second-header [run_dir].img
# create partition table entry pointing to the content
- exec sgdisk --new=3:$first_sector:$last_sector [run_dir].img
- exec sgdisk --change-name=3:GENODE [run_dir].img
+ exec $sgdisk --new=3:$first_sector:$last_sector [run_dir].img
+ exec $sgdisk --change-name=3:GENODE [run_dir].img
# create hybrid MBR
- exec sgdisk --hybrid [run_dir].img
+ exec $sgdisk --hybrid [run_dir].img
set size_image [expr [regsub {\s.*} [exec du -sk [run_dir].img] {}]]
puts "Created image file [run_dir].img (${size_image}kiB)"
diff --git a/tool/run/image/iso b/tool/run/image/iso
index b415faabd..d0578420f 100644
--- a/tool/run/image/iso
+++ b/tool/run/image/iso
@@ -6,8 +6,6 @@ source [genode_dir]/tool/run/iso.inc
#
proc run_image { {unused ""} } {
- requires_installation_of xorriso
-
puts "creating ISO image..."
exec rm -f "[run_dir].iso"
@@ -17,7 +15,7 @@ proc run_image { {unused ""} } {
# 'xorriso' writes diagnostics to stderr, which are interpreted as
# execution failure by expect unless '-ignorestderr' is set on 'exec'.
#
- if {[catch {exec -ignorestderr xorriso -out_charset utf-8 -report_about HINT -as mkisofs -f -l -R -hide-rr-moved -graft-points --modification-date=2017101816570300 -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table --embedded-boot $grub2_path/boot/grub2/embedded.img --protective-msdos-label -o [run_dir].iso -r [run_dir] --sort-weight 0 / --sort-weight 1 /boot} ]} {
+ if {[catch {exec -ignorestderr [installed_command xorriso] -out_charset utf-8 -report_about HINT -as mkisofs -f -l -R -hide-rr-moved -graft-points --modification-date=2017101816570300 -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table --embedded-boot $grub2_path/boot/grub2/embedded.img --protective-msdos-label -o [run_dir].iso -r [run_dir] --sort-weight 0 / --sort-weight 1 /boot} ]} {
puts stderr "Error: ISO image creation failed"
exit -5
}
diff --git a/tool/run/image/uefi b/tool/run/image/uefi
index b17101360..77354137d 100644
--- a/tool/run/image/uefi
+++ b/tool/run/image/uefi
@@ -14,10 +14,6 @@ proc image_uefi_size { } { return [get_cmd_arg --image-uefi_size 0] }
#
proc run_image { {unused ""} } {
- requires_installation_of sgdisk
- requires_installation_of mkfs.vfat
- requires_installation_of mcopy
-
set run_size [expr [regsub {\s.*} [exec du -sm [run_dir]] {}]]
if {[image_uefi_size] > 0} {
@@ -30,16 +26,16 @@ proc run_image { {unused ""} } {
exec dd if=/dev/zero of=[run_dir].header count=34 bs=512 2>/dev/null
exec dd if=/dev/zero of=[run_dir].partition bs=1M count=$disk_size 2>/dev/null
- exec mkfs.vfat -n GENODE [run_dir].partition
+ exec [installed_command mkfs.vfat] -n GENODE [run_dir].partition
# copy content to disk image
foreach file [exec ls [run_dir]] {
- exec mcopy -i [run_dir].partition -s [run_dir]/$file ::
+ exec [installed_command mcopy] -i [run_dir].partition -s [run_dir]/$file ::
}
exec cat [run_dir].header [run_dir].partition > [run_dir].img
- exec sgdisk --set-alignment=1 --largest-new=1 --typecode=1:EF00 [run_dir].img
+ exec [installed_command sgdisk] --set-alignment=1 --largest-new=1 --typecode=1:EF00 [run_dir].img
exec rm -f [run_dir].header [run_dir].partition
}
diff --git a/tool/run/power_on/softreset b/tool/run/power_on/softreset
index a00ec62f4..9e1160f7a 100644
--- a/tool/run/power_on/softreset
+++ b/tool/run/power_on/softreset
@@ -49,7 +49,7 @@ proc run_power_on { } {
exit -1
}
- set telnet [check_installed telnet]
+ set telnet [installed_command telnet]
spawn $telnet $host $port
set connection_id $spawn_id
diff --git a/tool/run/run b/tool/run/run
index 5676b9dae..4f4184205 100755
--- a/tool/run/run
+++ b/tool/run/run
@@ -506,18 +506,41 @@ proc have_spec {spec} { global specs; return [expr [lsearch $specs $spec] != -1]
# Return true if specified program is installed
#
proc have_installed {program} {
- if {[catch { exec which $program }]} { return false; }
- return true
+ if {[catch { exec which $program }] == 0} { return true; }
+ if {[catch { exec which "/sbin/$program" }] == 0} { return true; }
+ if {[catch { exec which "/usr/sbin/$program" }] == 0} { return true; }
+ if {[catch { exec which "/usr/local/bin/$program" }] == 0} { return true; }
+
+ return false;
}
##
-# Return true if specified program is installed on the host platform
+# Check if a shell command is installed
#
-proc requires_installation_of {program} {
- if {![have_installed $program]} {
- puts "Run script aborted because $program is not installed"; exit 1
+# \param command name of the command to search
+#
+# \return absolute path of command if found, or exists if not
+#
+proc installed_command {command} {
+ if { [catch {set path [exec which $command]}] == 0} {
+ return $path
}
+
+ set dir { /sbin /usr/sbin /usr/local/bin }
+
+ foreach location $dir {
+ append location / $command
+
+ if { [file exists $location] == 1} {
+ return $location
+ }
+ }
+
+ puts stderr "Error: '$command' command could be not found. Please make sure to install the"
+ puts stderr " packet containing '$command', or make it available in your PATH variable.\n"
+
+ exit 1
}
@@ -757,39 +780,7 @@ proc gdb { } {
if {[have_installed "[cross_dev_prefix]gdb"]} {
return "[cross_dev_prefix]gdb" }
- if {[have_installed gdb]} {
- return "gdb" }
-
- requires_installation_of gdb
-}
-
-
-##
-# Check if a shell command is installed
-#
-# \param command name of the command to search
-#
-# \return absolute path of command if found, or exists if not
-#
-proc check_installed {command} {
- if { [catch {set path [exec which $command]}] == 0} {
- return $path
- }
-
- set dir { /sbin /usr/sbin /usr/local/bin }
-
- foreach location $dir {
- append location / $command
-
- if { [file exists $location] == 1} {
- return $location
- }
- }
-
- puts stderr "Error: '$command' command could be not found. Please make sure to install the"
- puts stderr " packet containing '$command', or make it available in your PATH variable.\n"
-
- exit 1
+ return [installed_command gdb]
}