diff options
author | davidovski <david@davidovski.xyz> | 2023-01-21 13:48:04 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-01-21 13:48:04 +0000 |
commit | 0d1cc409caa9f94ebd6334a920a992e8a8ae233e (patch) | |
tree | e7b23ddad25f3c45451bc4363ea6fe56e5c84f77 /src/mirror.sh | |
parent | ee1692eaf63404cadafabb407c709a2d2f5c071b (diff) |
Add mirror feature
Diffstat (limited to 'src/mirror.sh')
-rw-r--r-- | src/mirror.sh | 29 |
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 - +} |