summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-28 19:46:06 +0200
committerErich Eckner <git@eckner.net>2018-09-28 19:46:06 +0200
commit3546003ca936dcaeb5182374842f94226f1794ae (patch)
tree43a1ad2ca2924b621961d9c3d984d3022249e85c
parent6a3dddfd3ebb4ce41c81c33b0e529c83c7db403c (diff)
downloadarchive-server-3546003ca936dcaeb5182374842f94226f1794ae.tar.xz
clone-repos,httpdocs/index.php: mark repo type in wish-list, too
-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');
}