@@ -11,25 +11,43 @@ echo ">>> Using CKAN version $(ckan version)"
11
11
12
12
echo " >>> Setting up..."
13
13
14
- buildID= $ ( find / \
14
+ readarray -d ' ' buildIDs < < ( find / \
15
15
-not \( -path /proc -prune \) \
16
16
-not \( -path /usr -prune \) \
17
17
-not \( -path /var -prune \) \
18
18
-not \( -path /etc -prune \) \
19
19
-not \( -path /root -prune \) \
20
- -name buildID.txt | head -n 1)
20
+ -not \( -path /run -prune \) \
21
+ -not \( -path /tmp -prune \) \
22
+ -not \( -path /sys -prune \) \
23
+ -not \( -path /dev -prune \) \
24
+ -name buildID.txt -print0)
21
25
22
- if [ -z " $buildID " ]; then
26
+ for i in " ${! buildIDs[@]} " ; do
27
+ buildIDs[$i ]=$( dirname ${buildIDs[$i]} )
28
+ done
29
+
30
+ PS3=" #? "
31
+ kerbal=" " ;
32
+ if (( ${# buildIDs[@]} == 1 )) ; then
33
+ kerbal=${buildIDs[0]}
34
+ else
35
+ echo " Choose which KSP directory to use as the default:"
36
+ select file in " ${buildIDs[@]} " ; do
37
+ kerbal=$file
38
+ break
39
+ done
40
+ fi
41
+
42
+ if [ -z " $kerbal " ]; then
23
43
echo " No buildID.txt found, did you mount your KSP directory?"
24
44
echo " Use '--mount type=bind,source=<KSP_PATH>,target=/kerbal' in"
25
45
echo " your 'docker run' command, and replace <KSP_PATH>."
26
46
echo " "
27
47
echo " 'ckan' is still available, but you will have no KSP to work with."
28
48
exec_user=root
29
49
else
30
- kerbal=$( dirname " $buildID " )
31
-
32
- echo " Found $buildID , using $kerbal as KSP directory"
50
+ echo " Using $kerbal as default KSP directory"
33
51
34
52
gid=$( stat -c ' %g' " $kerbal /GameData" )
35
53
uid=$( stat -c ' %u' " $kerbal /GameData" )
0 commit comments