Project

General

Profile

1
#!/bin/bash -e
2
# runscripts: a bash-based replacement for make
3
# unlike make, supports full bash functionality including multiline commands
4
# usage: path/to/dir/run cmd args
5

    
6
if false; then #### run script template:
7
#!/bin/bash -e
8
. "$(dirname "${BASH_SOURCE[0]}")"/path/to/util.run or file_including_util.run
9
. "$(dirname "${BASH_SOURCE[0]}")"/other_includes
10

    
11
cmd()
12
{
13
	echo_func
14
	"$(dirname "${BASH_SOURCE[0]}")"/path_relative_to_self
15
	"$(dirname "${BASH_SOURCE[1]}")"/path_relative_to_caller
16
	"$top_dir"/path_relative_to_outermost_script
17
}
18
fi ####
19

    
20
. "$(dirname "${BASH_SOURCE[0]}")"/../sh/make.sh
21
. "$(dirname "${BASH_SOURCE[0]}")"/../sh/util.sh
22

    
23
if self_not_included; then
24

    
25
# users can override run_args_cmd to perform other commands (or no commands)
26
# after the script is read
27
on_exit() { test $? -eq 0 || return; run_args_cmd; }
28
trap on_exit EXIT
29

    
30
func_override set_paths__util_sh
31
set_paths()
32
{
33
	set_paths__util_sh "$@"
34
	top_file="${top_script%[./]run}"; echo_vars top_file
35
	top_filename="$(basename "$top_file")"; echo_vars top_filename
36
}
37
set_paths
38

    
39
fi
(3-3/3)