summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclone-repos17
-rw-r--r--httpdocs/index.php2
2 files changed, 15 insertions, 4 deletions
diff --git a/clone-repos b/clone-repos
index 6991380..89dcb24 100755
--- a/clone-repos
+++ b/clone-repos
@@ -6,7 +6,7 @@ if [ ! -s "${base_dir}/work/wish-list" ]; then
exit
fi
-while read -r source_base64; do
+while read -r type source_base64; do
if [ -d "${base_dir}/work/repositories/${source_base64}" ]; then
continue
fi
@@ -14,9 +14,20 @@ while read -r source_base64; do
printf '%s' "${source_base64}" | \
base64 -d
)
- git -C "${base_dir}/work/repositories" clone --mirror "${source}" "${source_base64}"
+ case "${type}" in
+ 'git')
+ git -C "${base_dir}/work/repositories" clone --mirror "${source}" "${source_base64}"
+ ;;
+ *)
+ >&2 printf 'unknown type "%s"\n' \
+ "${type}"
+ ;;
+ )
done < \
"${base_dir}/work/wish-list"
-grep -vxF "$(ls "${base_dir}/work/repositories")" "${base_dir}/work/wish-list" | \
+grep -vxF "$(
+ find "${base_dir}/work/repositories" -mindepth 2 -maxdepth 2 | \
+ sed 's,^.*/\([^/]\+\)/\([^/]\+\)$,\1 \2,'
+)" "${base_dir}/work/wish-list" | \
sponge "${base_dir}/work/wish-list"
diff --git a/httpdocs/index.php b/httpdocs/index.php
index 478db2d..e6874fe 100644
--- a/httpdocs/index.php
+++ b/httpdocs/index.php
@@ -17,7 +17,7 @@ if (isset($_GET['r'])) {
$wish_list = fopen($work_dir . 'wish-list','a');
if ($wish_list === false)
die('Cannot open wish-list');
- fwrite($wish_list, $_GET['r'] . "\n");
+ fwrite($wish_list, $_GET['t'] . " " . $_GET['r'] . "\n");
fclose($wish_list);
die('I put repository onto wish-list');
}