From da991bac5de8c6de61fa35194791a979408218db Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 23 Dec 2021 11:17:57 +0000
Subject: [PATCH] Added package dependencies

---
 INSTALL.sh |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/INSTALL.sh b/INSTALL.sh
index 0aaa4a2..90ee445 100755
--- a/INSTALL.sh
+++ b/INSTALL.sh
@@ -55,12 +55,19 @@
 }
 
 handle_package() {
-if [ -d "$1" ]; then
+    echo $1
+    if [ -d "$1" ]; then
+	unset DEPS
+	eval $(grep "DEPS=" $1/DICT)
+	for i in $DEPS; do
+	    (handle_package $i $2)
+	done
 	(cd "$1"; $2)
     else
 	echo "No configuration found for $i"
     fi
 }
+
 usage() {
     echo "Install dotfiles with symlinks"
     echo "Usage with -h|--help"
@@ -87,31 +94,6 @@
       shift
 done
 
-# case "$1" in
-#     -*) echo "Only one argument allowed"; exit;;
-# esac
-
-# while [ -n "$1" ]; do
-#     PACKAGES="$PACKAGES $1"
-#     shift
-# done
-
-# if [ "$INSTALL" = "1" ] && [ "$REMOVE" = "0" ]; then
-#     FUNCTION="install_links"
-# elif [ "$INSTALL" = "0" ] && [ "$REMOVE" = "1" ]; then
-#     FUNCTION="remove_links"
-# else
-#     echo "Need to specify install or removal of configs"
-#     exit 1
-# fi
-
-# for i in $PACKAGES; do
-#     if [ -d "$i" ]; then
-# 	(cd "$i"; $FUNCTION)
-#     else
-# 	echo "No configuration found for $i"
-#     fi
-# done
-
-# (cd $1; install_links)
-# (cd $1; remove_links)
+while [ -n "$1" ]; do
+    handle_package "$1" "$([ \"$INSTALL\" = \"1\" ] && echo install || echo remove)_links"
+done

--
Gitblit v1.9.3