-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathshrun.sh
38 lines (30 loc) · 923 Bytes
/
shrun.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# simple wrapper to run a script in docker
preso=$1
script=$2
#######################################################
if [ $# -ne 2 ]; then
echo "ERROR script requires two paramters preso from preso-list and script name"
exit 2
fi
working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# figure out presentation specific settings
if [ "$preso" == "" ]; then
echo "ERROR please provide a presentation id from the preso-list"
exit 2
else
preso_dir=$( grep "$preso" preso-list | cut -d , -f 2 )
if [ "$preso_dir" == "" ]; then
echo "ERROR preso ID $preso is not in the preso-list"
exit 2
fi
fi
# Verify script exists
if [ ! -f "$working_dir/$preso_dir/$script" ]; then
echo "ERROR script $script not found in directory $preso_dir"
exit 2
fi
#######################################################
cd "$working_dir/$preso_dir" || exit 2
chmod +x "$script"
./"$script"