forked from trouch/CreawsomeMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·69 lines (55 loc) · 1.41 KB
/
deploy.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
SRC_COPY="\
definitions \
extruders \
images \
meshes \
setting_visibility \
materials \
"
SRC_MACHINES="machines"
SRC_QUALITIES="src/quality"
SRC_VARIANTS="src/variants"
OUT_QUALITIES="resources/quality"
OUT_VARIANTS="resources/variants"
processMachineQuality() {
def=`echo $2 | sed 's/\//_/g'`
name=`echo $2 | sed -E 's/.*\///g'`
out=`printf "%q/%q_%q" $3 $name $1`
echo "Copying $1 to $out"
cat "$SRC_QUALITIES/$1" | sed -E "s/MACHINE_DEFINITION/$def/g" > $out
}
processMachineProfiles() {
dir="$OUT_QUALITIES/$2"
echo "Creating directory $dir"
mkdir -p $dir
for Q in $1
do processMachineQuality $Q $2 $dir
done
}
processMachineVariant() {
def=`echo $2 | sed 's/\//_/g'`
out=`printf "%q/%q_%q" $OUT_VARIANTS $def $1`
echo "Copying $1 to $out"
cat "$SRC_VARIANTS/$1" | sed -E "s/MACHINE_DEFINITION/$def/g" > $out
}
processMachineVariants() {
for V in $1
do processMachineVariant $V $2
done
}
processMachines() {
processMachineProfiles "$1" creawsome/base
for M in $3
#do processMachineProfiles "$1" $M; \
do processMachineVariants "$2" $M
done
}
MACHINES=`cat $SRC_MACHINES`
QUALITIES=`ls $SRC_QUALITIES`
VARIANTS=`ls $SRC_VARIANTS`
mkdir -p resources/variants
for C in $SRC_COPY
do mkdir -p resources/$C; cp -r src/$C resources
done
processMachines "$QUALITIES" "$VARIANTS" "$MACHINES"