aboutsummaryrefslogtreecommitdiff
path: root/metadot
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-12-28 15:09:30 -0200
committerSilvio Rhatto <rhatto@riseup.net>2016-12-28 15:09:30 -0200
commite778fcaba5e88605f4e3adde4418fcac9abfd4c6 (patch)
treec163a40cd68a3c00524c6033b140ea7464c59eb6 /metadot
parent2fcbad9e3cde7537a9b7c400163bc64368b49fd4 (diff)
downloadmetadot-e778fcaba5e88605f4e3adde4418fcac9abfd4c6.tar.gz
metadot-e778fcaba5e88605f4e3adde4418fcac9abfd4c6.tar.bz2
Dependency handling support
Diffstat (limited to 'metadot')
-rwxr-xr-xmetadot28
1 files changed, 25 insertions, 3 deletions
diff --git a/metadot b/metadot
index 86a9504..db6551d 100755
--- a/metadot
+++ b/metadot
@@ -98,6 +98,25 @@ function metadot_load {
fi
}
+# Load a module
+function metadot_deps {
+ local module="$1"
+ local destname
+ local dirname
+
+ if [ -d "$MODULES/$module" ]; then
+ echo "Resolving dependencies for $module.."
+
+ if [ -e "/etc/debian_version" ] && [ -e "$MODULES/$module/dependencies/debian" ]; then
+ deps="`grep -v '^#' $MODULES/$module/dependencies/debian | xargs`"
+ sudo apt install $deps
+ fi
+
+ else
+ echo "No such module $module"
+ fi
+}
+
# Parsing.
if [ -z "$OPT" ]; then
echo "usage: $BASENAME <option> [arguments]"
@@ -157,7 +176,7 @@ elif [ "$OPT" == "create" ]; then
git add .
)
echo "Metadot skeleton module $1 created at $MODULES/$1"
-elif [ "$OPT" == "load" ]; then
+elif [ "$OPT" == "load" ] || [ "$OPT" == "deps" ]; then
shift
if [ -z "$1" ]; then
@@ -171,9 +190,12 @@ elif [ "$OPT" == "load" ]; then
fi
for module in $modules; do
- metadot_load $module
+ metadot_$OPT $module
done
- echo "Backups saved at $BACKUPS."
+
+ if [ "$OPT" == "load" ]; then
+ echo "Backups saved at $BACKUPS."
+ fi
elif [ "$OPT" == "list" ]; then
# Complete, slow version
#find $HOME -lname '*.dotfiles*' -exec ls -la {} | \