Compare commits
No commits in common. "098f3a0962f3eb3d3cba3923cd324237ac1c9dc1" and "44afad72415171744f1ccbaf28709fe1463d1ad5" have entirely different histories.
098f3a0962
...
44afad7241
51
brick.sh
51
brick.sh
|
@ -78,21 +78,6 @@ tmpdir() {
|
|||
exec_brick() {
|
||||
echo -e "$(bricksenv)\n$*" | bash
|
||||
}
|
||||
print_long_list() {
|
||||
list=($@)
|
||||
i=0
|
||||
printf '%s' "$(inf)$(inf)"
|
||||
for el in ${list[@]}; do
|
||||
printf '%s ' $el
|
||||
if [ "$i" == "2" ]; then
|
||||
if ! [ "$(( "${#list[@]}" % 3 ))" == "0" ]; then
|
||||
printf '\n%s' "$(inf)$(inf)"
|
||||
fi
|
||||
fi
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# checking that brick's dependencies are installed
|
||||
BRICK_DEPS=(curl)
|
||||
|
@ -205,45 +190,11 @@ if [ "$ERRORED" == "true" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# lets resolve the dependencies huh
|
||||
find_deps_for() {
|
||||
brick=$1
|
||||
deps=()
|
||||
SCRIPT="
|
||||
source $(getbrick $brick)\n
|
||||
if ! [ \"\$dependencies\" == \"\" ]; then\n
|
||||
echo \"\${dependencies[@]}\"\n
|
||||
fi\n
|
||||
"
|
||||
deps=$(exec_brick $SCRIPT)
|
||||
deps=(${deps[@]})
|
||||
if ! [ "${#deps[@]}" == "0" ]; then
|
||||
for dep in "${deps[@]}"; do
|
||||
if ! [ -f "$(getbrick $dep)" ]; then
|
||||
err "$brick depends on $dep, which is not an available package"
|
||||
ERRORED=true
|
||||
fi
|
||||
ndeps=$(find_deps_for $dep)
|
||||
deps=(${deps[@]} ${ndeps[@]})
|
||||
done
|
||||
fi
|
||||
|
||||
echo ${deps[@]}
|
||||
}
|
||||
for pkg in "${PKGS[@]}"; do
|
||||
PKGS=(${PKGS[@]} $(find_deps_for $pkg))
|
||||
done
|
||||
|
||||
if [ "$ERRORED" == "true" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${#PKGS[@]}" == "0" ]; then
|
||||
inf "nothing to do"
|
||||
exit
|
||||
else
|
||||
inf "packages to install:"
|
||||
print_long_list "${PKGS[@]}"
|
||||
inf "packages to install: ${PKGS[@]}"
|
||||
if ! user_confirm; then
|
||||
inf "canceled"
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue