From f0ad4bdf7ea3e7b3ac2c64d27a57a9bbf4f693c9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 24 Apr 2017 19:42:19 -0400 Subject: Update: modern dbscripts mandates chroot building --- .config/pacman/makepkg.conf | 17 +++++++++-------- .gitignore | 4 ++++ .local/bin/autobuild.sh | 17 ++++++++++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.config/pacman/makepkg.conf b/.config/pacman/makepkg.conf index caad51b..98b1536 100644 --- a/.config/pacman/makepkg.conf +++ b/.config/pacman/makepkg.conf @@ -1,11 +1,12 @@ -PKGDEST="${HOME}/packages/pkgdest" -SRCDEST="${HOME}/packages/srcdest" -SRCPKGDEST="${HOME}/packages/srcpkgdest" -LOGDEST="${HOME}/packages/logdest" -BUILDDIR="${HOME}/packages/builddir" +PKGDEST="${LIBREHOME:-$HOME}/packages/pkgdest" +SRCDEST="${LIBREHOME:-$HOME}/packages/srcdest" +SRCPKGDEST="${LIBREHOME:-$HOME}/packages/srcpkgdest" +LOGDEST="${LIBREHOME:-$HOME}/packages/logdest" +BUILDDIR="${LIBREHOME:-$HOME}/packages/builddir" GPGKEY="$({ - sed -nr 's/^\s*default-key\s+//p' "${HOME}/.gnupg/gpg.conf" - gpg --list-secret-keys --with-colons | grep ^sec: | cut -d: -f5 | sed -r 's/.*(........)$/\1/' + [ -z "$GPGKEY" ] || echo "$GPGKEY" + sed -nr 's/^\s*default-key\s+//p' "${LIBREHOME:-$HOME}/.gnupg/gpg.conf" + sudo -u "${LIBREUSER:-$USER}" gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print substr($5,9)}' } | sed 1q)" -PACKAGER="$(gpg --with-colons --fingerprint "$GPGKEY"|grep ^uid:|cut -d: -f10)" +PACKAGER="$(sudo -u "${LIBREUSER:-$USER}" gpg --with-colons --fingerprint "$GPGKEY" | awk -F: '/^uid:/{print $10}')" diff --git a/.gitignore b/.gitignore index 22ab658..974a3a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ /packages/ *~ + +# because of libreblacklist +/.wget-hsts +/.cache/ diff --git a/.local/bin/autobuild.sh b/.local/bin/autobuild.sh index 009cbf7..c5a9bad 100755 --- a/.local/bin/autobuild.sh +++ b/.local/bin/autobuild.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2014 Luke Shumaker +# Copyright (C) 2014, 2016-2017 Luke Shumaker # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,11 @@ export PATH # because of setuid safety, path may be currently un-exported +withtty() { + local cmd + printf -v cmd '%q ' "$@" + script --return --quiet --command "$cmd" /dev/null +} usage() { print "Usage: %q REPO/PKGBASE [FILES...]" "${0##*/}" @@ -51,7 +56,7 @@ main() { if [[ $# -lt 1 ]]; then error "%q takes at least 1 argument" "$0" usage >&2 - exit 1 + return 1 fi package=$1 @@ -59,7 +64,7 @@ main() { if ! [[ $package =~ $package_re ]]; then error "The first argument must be in the format REPO/PKGBASE: %s" "$package" usage >&2 - exit 1 + return 1 fi unset package_re @@ -87,7 +92,7 @@ main() { # Make sure we actually have changes if [[ "$newgitver" == "$oldgitver" ]]; then msg 'No new changes were committed, nothing to do' - exit 0 + return 0 fi # Handle doing multiple versions in the same day @@ -108,7 +113,9 @@ main() { git commit -m "Update ${package}" # Build the new package - makepkg -c + withtty sudo librechroot -n autobuilder -l root update + withtty sudo librechroot -n autobuilder sync + withtty sudo libremakepkg -n autobuilder librestage # Publish the updates -- cgit v1.2.2