move the repo scripts out

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2021-03-06 08:03:54 +03:00
parent 4a548d05e1
commit dcac04661b
3 changed files with 0 additions and 147 deletions

View File

@ -1,83 +0,0 @@
#!/usr/bin/bash
shopt -s nullglob
parse_pkg_filename() {
declare filename=$1
declare -a filename_array
IFS='-' read -r -a filename_array <<< "$filename"
for (( i=${#filename_array[@]}; i>=0; i-- )); do
printf '%s ' "${filename_array[$i]}"
done
}
is_latest() {
declare filename=$1 p
for p in "${latest[@]}"; do
if [[ "$filename" == "$p" ]]; then
return 0
fi
done
return 1
}
_pacsort() {
declare i
for i in *.pkg.tar.xz *.pkg.tar.zst; do
printf '%s\n' "$i"
done | pacsort -f
}
while (( $# )); do
case "$1" in
-r) flag_rm=1;;
-d) flag_debug=1;;
esac
shift
done
if ! (( flag_rm )); then
if ! [[ -d old ]]; then
mkdir -p old || {
return 1
}
fi
fi
read -d '' -r -a package_files < <( _pacsort )
for f in "${package_files[@]}"; do
unset revision version end package_name
read -r end revision version _ < <(parse_pkg_filename "$f")
package_name=${f%%-$version-$revision*}
declare -g -A latest["$package_name"]="$package_name-$version-$revision-$end"
done
for f in ${package_files[@]}; do
if is_latest "$f"; then
(( flag_debug )) && printf '%s is the latest version available\n' "$f"
else
printf 'Removing: %s\n' "$f"
if (( flag_rm )); then
rm -f "$f" "${f}.sig"
else
mv "$f" old/
if [[ -f "${f}.sig" ]]; then
mv "${f}.sig" old/
fi
fi
fi
done
if [[ -d old ]]; then
cd old
exec bash "$0" -r
fi

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
shopt -s nullglob
lockfile='.mainenance.lock'
usage() { echo "$0 <repo_name>"; }
spark_repo=$1
[[ "$spark_repo" ]] || {
usage
exit 1
}
cleanup() { rm -f "$lockfile"; }
lock() {
[[ -f "$lockfile" ]] && {
printf 'Lockfile found: %s\n' "$lockfile" >&2
return 1
}
echo $$ > "$lockfile"
lock_pid=$(<"$lockfile")
[[ $$ == "$lock_pid" ]] || return 1
}
cd "$HOME/public/$spark_repo" || exit $?
lock || exit 1
trap cleanup EXIT
for f in import/*; do
f_name="${f##*/}"
if [[ -f "$f_name" ]]; then
printf 'Package already exists: %s, not overwriting\n' "$f_name" >&2
rm -vf "$f"
else
mv -vf "$f" ./
new_pkgs+=( "$f_name" )
fi
done
repo-sign
repo-clean
for p in "${new_pkgs[@]}"; do
repo-add -n "$spark_repo.db.tar.gz" "$p"
done

View File

@ -1,15 +0,0 @@
#!/usr/bin/bash
shopt -s nullglob
for i in *.pkg.*; do
if ! [[ "$i" == "${i%.*}.sig" ]]; then
if ! [[ -f "${i}.sig" ]]; then
unsigned_pkgs+=( "$i" )
fi
fi
done
for i in "${unsigned_pkgs[@]}"; do
echo $i
gpg --pinentry-mode loopback --passphrase-fd 0 --batch --no-tty --detach-sign --no-armor "$i" < ~/.gnupg/passphrase
done