2014-02-20 15:53:24 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2015-09-26 03:46:57 +00:00
|
|
|
module_loading=$(cat <<\MODULE
|
|
|
|
current_dir=$(pwd)
|
2014-02-23 15:48:33 +00:00
|
|
|
cd modules/kickstart
|
|
|
|
source install.sh
|
2015-09-26 03:46:57 +00:00
|
|
|
cd "$current_dir"
|
2014-02-23 15:48:33 +00:00
|
|
|
|
2014-02-20 15:53:24 +00:00
|
|
|
for module in modules/*; do
|
2015-09-26 03:46:57 +00:00
|
|
|
if [ ! "$module" = module/kickstart ]; then
|
|
|
|
cd "$module"
|
2014-02-23 15:48:33 +00:00
|
|
|
source install.sh
|
2015-09-26 03:46:57 +00:00
|
|
|
cd "$current_dir"
|
2014-02-23 15:48:33 +00:00
|
|
|
fi
|
2014-02-20 15:53:24 +00:00
|
|
|
done
|
|
|
|
MODULE
|
|
|
|
)
|
|
|
|
|
|
|
|
clean_up_compile_folder() {
|
|
|
|
[ -d compile ] && rm -rf compile
|
|
|
|
mkdir -p compile
|
|
|
|
}
|
|
|
|
|
|
|
|
link_folder() {
|
2015-05-20 20:16:16 +00:00
|
|
|
[[ -h compile/"$1" ]] || ln -s ../"$1" compile/"$1"
|
2014-02-20 15:53:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
link_modules() {
|
|
|
|
mkdir -p compile/modules
|
|
|
|
|
2015-05-20 20:16:16 +00:00
|
|
|
ln -s "$(kickstart root-dir)"/kickstart compile/modules/kickstart
|
2014-02-20 15:53:24 +00:00
|
|
|
|
|
|
|
if [ -d modules ]; then
|
|
|
|
for module in modules/*; do
|
2015-05-20 20:16:16 +00:00
|
|
|
ln -s "$(pwd)"/"$module" compile/"$module"
|
2014-02-20 15:53:24 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
compile_install() {
|
|
|
|
cat <( echo -e "$module_loading" ) install.sh > compile/install.sh
|
2015-05-20 20:16:16 +00:00
|
|
|
for role in "$@"; do
|
2014-02-20 15:53:24 +00:00
|
|
|
echo "source roles/${role}.sh" >> compile/install.sh
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
clean_up_compile_folder
|
|
|
|
link_folder files
|
|
|
|
link_folder recipes
|
|
|
|
link_folder roles
|
|
|
|
link_modules
|
2015-05-20 20:16:16 +00:00
|
|
|
compile_install "$@"
|
2014-02-20 15:53:24 +00:00
|
|
|
echo -e "\necho Done" >> compile/install.sh
|