(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
|
||||
set -e
|
||||
start_time=$(date +%s)
|
||||
|
||||
# functions
|
||||
errcho() {
|
||||
|
@ -73,6 +74,21 @@ tmpdir() {
|
|||
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
|
||||
BRICKS_DIR=${BRICKS_DIR:-}
|
||||
PKGS=()
|
||||
|
@ -151,7 +167,7 @@ if [ "${#PKGS[@]}" == "0" ]; then
|
|||
inf "nothing to do"
|
||||
exit
|
||||
else
|
||||
echo "Packages to install: ${PKGS[@]}"
|
||||
inf "Packages to install: ${PKGS[@]}"
|
||||
user_confirm
|
||||
fi
|
||||
|
||||
|
@ -209,8 +225,6 @@ DOWNLOADED_FILES=()
|
|||
i=1
|
||||
# pacman deps installed, lets install the actual shit
|
||||
for pkg in "${PKGS[@]}"; do
|
||||
inf "installing $pkg [$i/${#PKGS[@]}]"
|
||||
|
||||
|
||||
exec_brick() {
|
||||
echo -e "$(bricksenv)$1" | bash
|
||||
|
@ -230,11 +244,11 @@ for pkg in "${PKGS[@]}"; do
|
|||
if ! [ "$DOWNLOADS" == "" ]; then
|
||||
DOWNLOADS=($DOWNLOADS)
|
||||
inf "$(inf "downloading files for $pkg...")"
|
||||
i=1
|
||||
ii=1
|
||||
for download in $DOWNLOADS; do
|
||||
curl -s $download > $(tmpdir)/$pkg-file-$i &
|
||||
DOWNLOADS_MAP=(${DOWNLOADS_MAP[@]} $(tmpdir)/$pkg-file-$i)
|
||||
i=$(($i + 1))
|
||||
ii=$(($ii + 1))
|
||||
done
|
||||
wait
|
||||
inf "$(inf "downloaded")"
|
||||
|
@ -248,17 +262,18 @@ for pkg in "${PKGS[@]}"; do
|
|||
install
|
||||
"
|
||||
|
||||
inf "installing $pkg [$i/${#PKGS[@]}]"
|
||||
exec_brick "$SCRIPT" > $BRICKS_DB/.$pkg-install-log
|
||||
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
if ! [ "${#DOWNLOADED_FILES[@]}" == "0" ]; then
|
||||
inf "$(inf 'cleaning up downloaded files')"
|
||||
inf 'cleaning up downloaded files'
|
||||
for file in $DOWNLOADED_FILES; do
|
||||
rm $file &
|
||||
done
|
||||
wait
|
||||
fi
|
||||
|
||||
inf "done"
|
||||
inf "done in $(($(date +%s) - $start_time)) seconds"
|
||||
|
|
Loading…
Reference in New Issue