3 if [ -z "$1" -o -z "$2" -o \
( "$(whoami)" = "root" -a -z "$CHOWNUSER" \
) ] ; then
5 echo "Usage: ./save.sh results_dir dir_tag file_tag [script args...]"
7 echo "Runs the given script, and then copies all resulting binaries"
8 echo "from <results_dir>/results/ into directory dir_tag and"
9 echo "renames all the files to include <file_tag> in the name."
11 echo "file_tag can be an empty string to skip the rename."
13 echo "Expects CHOWNUSER to be set appropriately"
14 echo "in the environment if run as root."
32 # copy the results back to the target directory
34 cp "$RESULTSDIR"/* "$TAG"
35 if [ "$(whoami)" = "root" ] ; then
36 chown
-R "$CHOWNUSER" "$TAG"
39 # We do this manually in a for loop, since the rename command is
40 # not the same across various linux distros...
41 if [ -n "$SHORTTAG" ] ; then
47 mv "$f" "$(echo $f | sed "s
/_\
([^_
]*\
)\.deb$
/_
${SHORTTAG}_\
1.deb
/")"
53 mv "$f" "$(echo $f | sed "s
/\.\
([^.
]*\
)\.rpm$
/.
${SHORTTAG}.\
1.rpm
/")"