summaryrefslogtreecommitdiff
path: root/librerelease
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-12-20 21:54:15 -0600
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-12-20 21:54:15 -0600
commit6a56fa9179e7ce08b5bbaf4407c0d1a10aabde08 (patch)
treeedf1ad5f14e8362dc25f998ca35935f2370960ec /librerelease
parent5f1ef1bd95e2aa1d5b596d929e12e55e8f00f3d2 (diff)
parentcccba27ea8ec823a9768ba2cd944edab53697bb1 (diff)
Merge branch 'master' of gitpar:libretools
Diffstat (limited to 'librerelease')
-rwxr-xr-xlibrerelease36
1 files changed, 36 insertions, 0 deletions
diff --git a/librerelease b/librerelease
index 56cf856..c4584e1 100755
--- a/librerelease
+++ b/librerelease
@@ -46,6 +46,30 @@ function list_packages {
unset repos
}
+function sign_packages {
+ if [ -z "${GPG_AGENT_INFO}" ]; then
+ warning "It's better to use gpg-agent to sign packages in batches"
+ fi
+
+ packages=($(find "${WORKDIR}/staging/" -type f -iname '*.pkg.tar.?z'))
+ for package in ${packages[@]}; do
+ if [ -f "${package}${SIGEXT}" ]; then
+
+ warning "Package signature found, verifying..."
+
+# Verify that the signature is correct, else remove for re-signing
+ if ! gpg --quiet --verify "${package}${SIGEXT}" >/dev/null 2>&1; then
+ error "Failed! Resigning..."
+ rm -f "${package}${SIGEXT}"
+ else
+ continue
+ fi
+ fi
+
+ gpg --default-key "${SIGID}" --output "${package}${SIGEXT}" --detach-sig "${package}"
+ done
+}
+
# Remove everything that's not a package or a signature
function clean_non_packages {
find $WORKDIR/staging/ -type f \
@@ -59,6 +83,11 @@ function clean {
find ${WORKDIR}/staging/ -type f -delete
}
+if [ -w / ]; then
+ error "Run $0 as normal user"
+ exit 1
+fi
+
while getopts 'hlcn' arg; do
case $arg in
h) usage; exit 0 ;;
@@ -73,6 +102,13 @@ done
[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}"
clean_non_packages
+if [ ! -z "${SIGID}" ]; then
+ sign_packages
+else
+ error "Package signing is *required*"
+ exit 1
+fi
+
msg "Uploading packages..."
rsync --recursive \
${dryrun} \