-
Notifications
You must be signed in to change notification settings - Fork 3
/
remake-manager
executable file
·111 lines (96 loc) · 2.03 KB
/
remake-manager
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -e
SCRIPT_PATH="${BASH_SOURCE[0]}";
if([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname "${SCRIPT_PATH}"` > /dev/null
SCRIPT_PATH=`pwd`;
popd > /dev/null
MODULES_PATH=$SCRIPT_PATH/modules
if [ ! -d "$MODULES_PATH" ]; then
#fix path for local installation
MODULES_PATH="$SCRIPT_PATH/../lib/remake/modules"
pushd "$MODULES_PATH" > /dev/null
MODULES_PATH="`pwd`"
popd > /dev/null
fi
DATA_PATH=$SCRIPT_PATH
if [ ! -d "$DATA_PATH/project" ]; then
#fix path for local installation
DATA_PATH="$SCRIPT_PATH/../share/remake"
pushd "$DATA_PATH" > /dev/null
DATA_PATH="`pwd`"
popd > /dev/null
fi
export DATA_PATH
TESTDATA_PATH=$SCRIPT_PATH/tests
if [ ! -d "$TESTDATA_PATH" ]; then
#fix path for local installation
TESTDATA_PATH="$SCRIPT_PATH/../share/remake/tests"
pushd "$TESTDATA_PATH" > /dev/null
TESTDATA_PATH="`pwd`"
popd > /dev/null
fi
export TESTDATA_PATH
usage()
{
cat << EOF
remake-manager:
Simple utility to create and modify Remake projects.
USAGE:
$0 create <project-name>
Creates new project from default template.
EOF
}
create()
{
if [ -z "$1" ]; then
echo
echo "ERROR: Please specify name of the project you want to create." >&2
echo
usage
exit 1
fi
if [ -e "$1" ]; then
echo
echo "ERROR: \"$1\" already exist. Can't continue." >&2
echo
exit 1
fi
cp -rf $DATA_PATH/project "$1"
# Check blender version and adapt project files
echo
echo "Checking dependencies..."
cd "$1"
export PROJECTROOT="`pwd`"
export BLENDER_VERSION=""
bash "$MODULES_PATH/mod_blend" check || ( cd .. ; rm -rf "$1"; exit 1 )
BLENDER_VERSION_FOUND=`blender --version`
BLENDER_VERSION_FOUND=${BLENDER_VERSION_FOUND:8:4}
if [[ ${BLENDER_VERSION_FOUND:0:3} == '2.4' ]]; then
rm project.blend
mv project-2.4x.blend project.blend
else
rm project-2.4x.blend
fi
echo
echo "Project created."
echo
}
if [ -z "$1" ]; then
usage
exit 1
fi
case $1 in
create)
create $2
;;
*)
echo
echo "ERROR: Unknown command." >&2
usage
exit 1
;;
esac