-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmb
executable file
·69 lines (58 loc) · 1.86 KB
/
vmb
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
#!/bin/bash
pushd `dirname $0` > /dev/null
dir=`pwd`
popd > /dev/null
export VERSION="0.1.1"
export HOME_PATH=$dir
export BUNDLES_PATH=$dir/bundles
export CORE_PATH=$dir/core_scripts
export CONFIG_PATH=$dir/config
export DOC_PATH=$dir/doc
export PACKAGES_PATH=$dir/packages
export TEMPLATE_PATH=$dir/templates
if [[ `echo "$1" | egrep 'config|conf|configure'` ]]; then
if [ -z "$2" ]; then echo "Please provide a configuration file"; exit -1; else cfgfile=$2; fi
source $cfgfile
export BUND_PATH=$BUNDLES_PATH/$bundle
export BASE_PATH=$BUND_PATH/bases
export BASE_FILE=$BASE_PATH/$base_name
export PRESEED_TEMPLATE=$BUND_PATH/preseed.template
export PROVISIONERS_PATH=$BUND_PATH/provisioners
touch preseed.cfg
touch buildscript.json
bash core_scripts/create_config.sh
fi
if [[ `echo "$1" | grep 'build'` ]]; then
eval "$dir"'/packer/packer build '"$dir"'/buildscript.json'
fi
if [[ `echo "$1" | grep 'clean'` ]]; then
rm -rf packer_*
rm preseed.cfg
rm buildscript.json
fi
if [[ `echo "$1" | egrep 'doc|documentation|docs'` ]]; then
if [[ $@ =~ "-tree" ]]; then export printtree="true"; fi
export docfile="$DOC_PATH/Documentation.md"
mkdir -p $DOC_PATH
bash core_scripts/write_documentation.sh
if [ -z `command -v markdown` ]; then
echo "
It seems that you do not have markdown installed. It is a nice tool that
converts md files to html. In order to experience the full beauty of this
monkey-generated document, install it e.g. on Debian distributions:
sudo apt-get install markdown
Generated $DOC_PATH/Documentation.md
"
exit 1
fi
markdown $DOC_PATH/Documentation.md > $DOC_PATH/Documentation.html
echo "Generated:
* $DOC_PATH/Documentation.md
* $DOC_PATH/Documentation.html"
fi
if [[ `echo "$1" | egrep 'new-bundle'` ]]; then
if [ -z "$2" ]; then echo "Please provide a name for the new bundle"
else
bash core_scripts/new_bundle.sh $2
fi
fi