(fix) fix some obscure problems
This commit is contained in:
parent
cd3ecd81c4
commit
622dec4827
29
brick.sh
29
brick.sh
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
set -e
|
set -e
|
||||||
|
start_time=$(date +%s)
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
errcho() {
|
errcho() {
|
||||||
|
@ -73,6 +74,21 @@ tmpdir() {
|
||||||
echo $BRICKS_DB/.tmp
|
echo $BRICKS_DB/.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# checking that brick's dependencies are installed
|
||||||
|
BRICK_DEPS=(curl)
|
||||||
|
NO_DEPS=()
|
||||||
|
for dep in ${BRICK_DEPS[@]}; do
|
||||||
|
if ! command -v $dep > /dev/null; then
|
||||||
|
NO_DEPS=(${NO_DEPS[@]} $dep)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! [ "${#NO_DEPS[@]}" == "0" ]; then
|
||||||
|
errcho 'Error!'
|
||||||
|
errcho 'brick itself depends on some stuff, which you dont have installed:'
|
||||||
|
errcho "${NO_DEPS[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# some vars
|
# some vars
|
||||||
BRICKS_DIR=${BRICKS_DIR:-}
|
BRICKS_DIR=${BRICKS_DIR:-}
|
||||||
PKGS=()
|
PKGS=()
|
||||||
|
@ -151,7 +167,7 @@ if [ "${#PKGS[@]}" == "0" ]; then
|
||||||
inf "nothing to do"
|
inf "nothing to do"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo "Packages to install: ${PKGS[@]}"
|
inf "Packages to install: ${PKGS[@]}"
|
||||||
user_confirm
|
user_confirm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -209,8 +225,6 @@ DOWNLOADED_FILES=()
|
||||||
i=1
|
i=1
|
||||||
# pacman deps installed, lets install the actual shit
|
# pacman deps installed, lets install the actual shit
|
||||||
for pkg in "${PKGS[@]}"; do
|
for pkg in "${PKGS[@]}"; do
|
||||||
inf "installing $pkg [$i/${#PKGS[@]}]"
|
|
||||||
|
|
||||||
|
|
||||||
exec_brick() {
|
exec_brick() {
|
||||||
echo -e "$(bricksenv)$1" | bash
|
echo -e "$(bricksenv)$1" | bash
|
||||||
|
@ -230,11 +244,11 @@ for pkg in "${PKGS[@]}"; do
|
||||||
if ! [ "$DOWNLOADS" == "" ]; then
|
if ! [ "$DOWNLOADS" == "" ]; then
|
||||||
DOWNLOADS=($DOWNLOADS)
|
DOWNLOADS=($DOWNLOADS)
|
||||||
inf "$(inf "downloading files for $pkg...")"
|
inf "$(inf "downloading files for $pkg...")"
|
||||||
i=1
|
ii=1
|
||||||
for download in $DOWNLOADS; do
|
for download in $DOWNLOADS; do
|
||||||
curl -s $download > $(tmpdir)/$pkg-file-$i &
|
curl -s $download > $(tmpdir)/$pkg-file-$i &
|
||||||
DOWNLOADS_MAP=(${DOWNLOADS_MAP[@]} $(tmpdir)/$pkg-file-$i)
|
DOWNLOADS_MAP=(${DOWNLOADS_MAP[@]} $(tmpdir)/$pkg-file-$i)
|
||||||
i=$(($i + 1))
|
ii=$(($ii + 1))
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
inf "$(inf "downloaded")"
|
inf "$(inf "downloaded")"
|
||||||
|
@ -248,17 +262,18 @@ for pkg in "${PKGS[@]}"; do
|
||||||
install
|
install
|
||||||
"
|
"
|
||||||
|
|
||||||
|
inf "installing $pkg [$i/${#PKGS[@]}]"
|
||||||
exec_brick "$SCRIPT" > $BRICKS_DB/.$pkg-install-log
|
exec_brick "$SCRIPT" > $BRICKS_DB/.$pkg-install-log
|
||||||
|
|
||||||
i=$(($i + 1))
|
i=$(($i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! [ "${#DOWNLOADED_FILES[@]}" == "0" ]; then
|
if ! [ "${#DOWNLOADED_FILES[@]}" == "0" ]; then
|
||||||
inf "$(inf 'cleaning up downloaded files')"
|
inf 'cleaning up downloaded files'
|
||||||
for file in $DOWNLOADED_FILES; do
|
for file in $DOWNLOADED_FILES; do
|
||||||
rm $file &
|
rm $file &
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inf "done"
|
inf "done in $(($(date +%s) - $start_time)) seconds"
|
||||||
|
|
Loading…
Reference in New Issue