From 7ce7ee03ad70cc246c5ccba549d8edfdc69c0ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Wed, 19 Oct 2011 15:18:07 -0300 Subject: Added clarification for makepkg flags use --- librerepkg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/librerepkg b/librerepkg index 647a7c0..706b603 100755 --- a/librerepkg +++ b/librerepkg @@ -36,7 +36,7 @@ source rePKGBUILD usage() { echo "cd to a dir with a rePKGBUILD and other file info and run" - echo "$0 " + echo "$0 [makepkg flags]" echo echo "This script will repackage an arch package without compiling" } @@ -44,6 +44,7 @@ usage() { while getopts 'h' arg; do case $arg in h) usage; exit 0 ;; + *) makepkgflags=$@ ;; esac done @@ -58,6 +59,6 @@ msg2 "Updating md5sums" makepkg -gp rePKGBUILD >> rePKGBUILD msg "Repackaging using makepkg" -makepkg -Lcdp rePKGBUILD $@ +makepkg -Lcdp rePKGBUILD ${makepkgflags} stdnull popd ${tempdir} -- cgit v1.2.3 From b7350ea957eda0f738bdbe7e74586c0c21fc3334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Wed, 14 Dec 2011 13:58:35 -0300 Subject: Make libremakepkg bind local makepkg dirs to chroot's --- libremakepkg | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libremakepkg b/libremakepkg index bac9e30..292e4b5 100755 --- a/libremakepkg +++ b/libremakepkg @@ -22,6 +22,13 @@ source /etc/libretools.conf source /etc/makepkg.conf +# Local vars may differ from chroot's +LOCALPKGDEST=${PKGDEST} +LOCALSRCDEST=${SRCDEST} +LOCALSRCPKGDEST=${SRCPKGDEST} + +source ${CHROOTDIR}/${CHROOT}/etc/makepkg.conf + function usage { # Display message and exit echo 'cd to a dir containing a PKGBUILD and run:' @@ -42,10 +49,14 @@ function usage { # Display message and exit function buildenv { # Mounts *DEST from makepkg.conf msg "Building env" - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do - msg2 "binding ${mp} to ${CHROOTDIR}/${CHROOT}${mp}" - mkdir -p "${CHROOTDIR}/${CHROOT}${mp}" - mount -o bind ${mp} "${CHROOTDIR}/${CHROOT}${mp}" || exit 1 + for mp in SRCDEST PKGDEST SRCPKGDEST; do +# The host system directory + lmp=LOCAL${mp} + + msg2 "Binding ${!lmp} to ${CHROOTDIR}/${CHROOT}${!mp}" + + mkdir -p "${CHROOTDIR}/${CHROOT}${!mp}" + mount -o bind ${!lmp} "${CHROOTDIR}/${CHROOT}${!mp}" || exit 1 done } -- cgit v1.2.3 From 54ba056b200a5ef141f8d589a2f45478c6bd8a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Wed, 14 Dec 2011 14:45:11 -0300 Subject: Do batch signing * Removed signing code from librestage * Make package signatures mandatory * Make librerelease sign all packages at once * Verify existing signatures before releasing --- librerelease | 31 +++++++++++++++++++++++++++++++ librestage | 29 +---------------------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/librerelease b/librerelease index 56cf856..64f8887 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 \ @@ -73,6 +97,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} \ diff --git a/librestage b/librestage index e851dd4..65ee19b 100755 --- a/librestage +++ b/librestage @@ -85,17 +85,7 @@ for _arch in ${ARCHES[@]}; do pkgfile=$(basename ${pkgpath}) - if [ ! -z "${SIGID}" ]; then - sigpath=${pkgpath}${SIGEXT} - sigfile=${pkgfile}${SIGEXT} - - msg "Signing package with ID ${SIGID}" - gpg --default-key "${SIGID}" --output ${sigpath} --detach-sig ${pkgpath} || { - error "Couldn't sign ${pkgfile}, aborting..." - exit 1 - } - fi - +# TODO refactor this if [ -e "${pkgpath}" ]; then msg "Found ${pkgfile}" @@ -113,15 +103,6 @@ for _arch in ${ARCHES[@]}; do staged=true } - if [ ! -z "${SIGID}" ]; then - canonical_sig="${WORKDIR}/staging/${_repo}/${pkgfile}${SIGEXT}" - cp "${sigpath}" "${WORKDIR}/staging/${_repo}/" || { - error "Can't put ${sigfile} on [staging]" - exit 1 - } && { - msg2 "${pkg} signature on [${_repo}]" - } - fi else ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { error "Can't put ${pkgfile} on [staging]" @@ -131,14 +112,6 @@ for _arch in ${ARCHES[@]}; do staged=true } - if [ ! -z "${SIGID}" ]; then - ln "${canonical_sig}" "${WORKDIR}/staging/${_repo}/${sigfile}" || { - error "Can't put ${sigfile} on [staging]" - exit 1 - } && { - msg2 "${pkg} signature on [${_repo}]" - } - fi fi done fi -- cgit v1.2.3 From 7e8764fb315b05068fe9d704734a2a4ec8588e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 18 Dec 2011 17:55:03 -0300 Subject: Check running as normal user --- librerelease | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/librerelease b/librerelease index 56cf856..bc765fe 100755 --- a/librerelease +++ b/librerelease @@ -59,6 +59,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 ;; -- cgit v1.2.3