-
Notifications
You must be signed in to change notification settings - Fork 4
/
msys2-dbremove
executable file
·74 lines (65 loc) · 1.99 KB
/
msys2-dbremove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
export ZSTD_CLEVEL=19
export ZSTD_NBTHREADS="$(nproc)"
pub=/srv/msys2repo
staging=/home/repo/staging
SIGNWITHKEY=()
if [ -n "${GPGKEY}" ]
then
SIGNWITHKEY=(-u "${GPGKEY}")
gpg --recv-key "0x${GPGKEY}"
fi
gpg --detach-sign "${SIGNWITHKEY[@]}" "${0}"
rm "${0}.sig"
update_packages() {
local repo="${1}"
shift
local path="${1}"
shift
local pkgs=("${@}")
if [ "${#pkgs[@]}" -gt 0 ]
then
echo "==> ${path}"
mkdir -p "${staging}/${path}/"
cp "${pub}/${path}/${repo}".{db,files}{,.tar.zst}{,.sig} "${staging}/${path}/"
repo-remove -s -v "${staging}/${path}/${repo}.db.tar.zst" "${pkgs[@]}"
zstd --quiet --test "${staging}/${path}/${repo}.db.tar.zst"
zstd --quiet --test "${staging}/${path}/${repo}.files.tar.zst"
gpg --verify "${staging}/${path}/${repo}.db.tar.zst.sig" "${staging}/${path}/${repo}.db.tar.zst"
gpg --verify "${staging}/${path}/${repo}.files.tar.zst.sig" "${staging}/${path}/${repo}.files.tar.zst"
mv "${staging}/${path}/${repo}".{db,files}{,.tar.zst}{,.sig} "${pub}/${path}/"
echo
fi
}
repo="${1}"
shift
if [ "${repo}" = "mingw64" ]
then
update_packages mingw64 "mingw/mingw64" "${@}"
elif [ "${repo}" = "mingw32" ]
then
update_packages mingw32 "mingw/mingw32" "${@}"
elif [ "${repo}" = "ucrt64" ]
then
update_packages ucrt64 "mingw/ucrt64" "${@}"
elif [ "${repo}" = "clang64" ]
then
update_packages clang64 "mingw/clang64" "${@}"
elif [ "${repo}" = "clang32" ]
then
update_packages clang32 "mingw/clang32" "${@}"
elif [ "${repo}" = "clangarm64" ]
then
update_packages clangarm64 "mingw/clangarm64" "${@}"
elif [ "${repo}" = "mingwarm64" ]
then
update_packages mingwarm64 "mingw/mingwarm64" "${@}"
elif [ "${repo}" = "msys" ]
then
update_packages msys "msys/x86_64" "${@}"
else
echo "Missing or unrecognized first argument: msys|mingw32|mingw64|ucrt64|clang64|clang32|clangarm64|mingwarm64" >&2
exit 1
fi
date +%s > "${pub}/lastupdate"