summaryrefslogtreecommitdiff
path: root/src/mirror.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mirror.sh')
-rw-r--r--src/mirror.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mirror.sh b/src/mirror.sh
new file mode 100644
index 0000000..ea23968
--- /dev/null
+++ b/src/mirror.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+create_deps_graph () {
+ for f in $DEP_DIR/*; do
+ printf "${f#$DEP_DIR/}:"
+ local deps=""
+ [ -f "$f" ] && while read line; do
+ for dep in $line; do
+ case "$deps" in
+ *"$dep"*);;
+ *) deps="$deps $dep";;
+ esac
+ done
+ done < $f
+ printf "%s\n" "$deps"
+ done
+}
+
+mirror () {
+ local MIRROR_DIR=${1:-$MIRROR_DIR}
+ mkdir -p $MIRROR_DIR
+ create_deps_graph > $MIRROR_DIR/deps.graph
+
+ local packages=$(list)
+
+ cd $MIRROR_DIR
+ fetch $packages
+ cd -
+}