summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-02-20 14:52:30 +0000
committerdavidovski <david@davidovski.xyz>2022-02-20 14:52:30 +0000
commitddc160469a6b870f225a78ce579029cf1ef90e03 (patch)
tree6e9799caf309353884372ade13c623211fd78cf2
parent5e64673025351660b27ad61e215ef38a8f033c85 (diff)
added laoding bar for resolving deps
-rw-r--r--Makefile3
-rwxr-xr-xsrc/get.sh21
2 files changed, 18 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6e41ce3..8803333 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,8 @@ PREFIX=/usr
CONFDIR=/etc
install: install-config
- mkdir -p ${DESTDIR}${PREFIX}/{lib/xipkg,bin}
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ mkdir -p ${DESTDIR}${PREFIX}/lib/xipkg
install -m755 ${SOURCE}/*.sh ${DESTDIR}${PREFIX}/lib/xipkg/
install -m755 ${SOURCE}/xi.sh ${DESTDIR}${PREFIX}/bin/xi
diff --git a/src/get.sh b/src/get.sh
index 05b2860..951b2ab 100755
--- a/src/get.sh
+++ b/src/get.sh
@@ -15,16 +15,20 @@ list_deps() {
# list all dependencies and sub dependencies of a package
#
resolve_deps () {
+ local out="${CACHE_DIR}/deps"
local deps=""
+ local i=0
if ${RESOLVE_DEPS}; then
while [ "$#" != "0" ]; do
# pop a value from the args
local package=$1
- shift
#only add if not already added
- echo ${deps} | grep -q "\b$package\b" || deps="$deps $package"
+ if ! echo ${deps} | grep -q "\b$package\b"; then
+ deps="$deps $package"
+ i=$((i+1))
+ fi
for dep in $(list_deps $package); do
# if not already checked
@@ -32,10 +36,13 @@ resolve_deps () {
set -- $@ $dep
fi
done
+ shift
+ ${QUIET} || hbar -T "${CHECKMARK} resolving dependencies" $i $((i + $#))
done
- echo ${deps}
+ ${QUIET} || hbar -t ${HBAR_COMPLETE} -T "${CHECKMARK} resolved dependencies" $i $((i + $#))
+ echo ${deps} > $out
else
- echo $@
+ echo $@ > $out
fi
}
@@ -126,7 +133,11 @@ fetch () {
local total_download=0
- for package in $(resolve_deps $@); do
+ local out="${CACHE_DIR}/deps"
+ touch $out
+ resolve_deps $@
+
+ for package in $(cat $out); do
if package_exists $package; then
set -- $(get_package_download_info $package)
url=$1