mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
run: Add 'check_installed' command to run env
'check_installed' takes a command name as argument and tries to call 'which' in order to find the command path. If that does not succeed, paths like '/sbin' are '/usr/sbin' searched. On success the absolute path of the command is returned, on failure 'exit' is called with an error message. Issue #1048
This commit is contained in:
parent
1c4c4d6961
commit
b7575319bf
29
tool/run
29
tool/run
@ -768,6 +768,35 @@ proc gdb { } {
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Check if a shell command is installed
|
||||
#
|
||||
# \param command name of the command to search
|
||||
#
|
||||
# \return absolute path of command if cound, 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 avaiable in your PATH variable.\n"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# U-boot bootloader specific uImage
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user