diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-12-20 21:54:15 -0600 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-12-20 21:54:15 -0600 |
commit | 6a56fa9179e7ce08b5bbaf4407c0d1a10aabde08 (patch) | |
tree | edf1ad5f14e8362dc25f998ca35935f2370960ec | |
parent | 5f1ef1bd95e2aa1d5b596d929e12e55e8f00f3d2 (diff) | |
parent | cccba27ea8ec823a9768ba2cd944edab53697bb1 (diff) |
Merge branch 'master' of gitpar:libretools
-rwxr-xr-x | libremakepkg | 19 | ||||
-rwxr-xr-x | librerelease | 36 | ||||
-rwxr-xr-x | librerepkg | 5 | ||||
-rwxr-xr-x | librestage | 29 |
4 files changed, 55 insertions, 34 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 } 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} \ @@ -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} @@ -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 |