diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2019-07-14 10:16:31 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2019-07-14 13:58:14 +0200 |
commit | 9506c1f4149863dfd1f121d862ec69eeeb65b4a5 (patch) | |
tree | d7a153161ec6055594c6d64d141eb33b1670b465 | |
parent | Rework --busybox support (diff) | |
download | genkernel-9506c1f4149863dfd1f121d862ec69eeeb65b4a5.tar.gz genkernel-9506c1f4149863dfd1f121d862ec69eeeb65b4a5.tar.bz2 genkernel-9506c1f4149863dfd1f121d862ec69eeeb65b4a5.zip |
Rework --gpg support
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rw-r--r-- | defaults/software.sh | 10 | ||||
-rwxr-xr-x | gen_compile.sh | 46 | ||||
-rwxr-xr-x | gen_initramfs.sh | 28 | ||||
-rw-r--r-- | gkbuilds/gnupg.gkbuild | 65 |
4 files changed, 85 insertions, 64 deletions
diff --git a/defaults/software.sh b/defaults/software.sh index 0368cafa..b56ec926 100644 --- a/defaults/software.sh +++ b/defaults/software.sh @@ -56,7 +56,9 @@ UNIONFS_FUSE_DIR="${UNIONFS_FUSE_DIR:-unionfs-fuse-${UNIONFS_FUSE_VER}}" UNIONFS_FUSE_SRCTAR="${UNIONFS_FUSE_SRCTAR:-${DISTDIR}/unionfs-fuse-${UNIONFS_FUSE_VER}.tar.gz}" UNIONFS_FUSE_BINCACHE="${UNIONFS_FUSE_BINCACHE:-%%CACHE%%/unionfs-fuse-${UNIONFS_FUSE_VER}-%%ARCH%%.bz2}" -GPG_VER="${GPG_VER:-VERSION_GPG}" -GPG_DIR="${GPG_DIR:-gnupg-${GPG_VER}}" -GPG_SRCTAR="${GPG_SRCTAR:-${DISTDIR}/gnupg-${GPG_VER}.tar.bz2}" -GPG_BINCACHE="${GPG_BINCACHE:-%%CACHE%%/gnupg-${GPG_VER}-%%ARCH%%.bz2}" +GKPKG_GPG_PN="gnupg" +GKPKG_GPG_PV="${GKPKG_GPG_PV:-VERSION_GPG}" +GKPKG_GPG_DEPS="" +GKPKG_GPG_SRCDIR="${GKPKG_GPG_SRCDIR:-gnupg-${GKPKG_GPG_PV}}" +GKPKG_GPG_SRCTAR="${GKPKG_GPG_SRCTAR:-${DISTDIR}/gnupg-${GKPKG_GPG_PV}.tar.bz2}" +GKPKG_GPG_BINPKG="${GKPKG_GPG_BINPKG:-%%CACHE%%/gnupg-${GKPKG_GPG_PV}-%%ARCH%%.tar.xz}" diff --git a/gen_compile.sh b/gen_compile.sh index 6db08dd9..590c26f9 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -915,52 +915,6 @@ compile_iscsi_isns() { fi } -compile_gpg() { - if [ -f "${GPG_BINCACHE}" ] - then - print_info 1 "$(getIndent 2)gnupg: >> Using cache ..." - else - [ ! -f "${GPG_SRCTAR}" ] && - gen_die "Could not find gnupg source tarball: ${GPG_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" - cd "${TEMP}" - rm -rf "${GPG_DIR}" - tar -xf "${GPG_SRCTAR}" - [ ! -d "${GPG_DIR}" ] && - gen_die "gnupg directory ${GPG_DIR} invalid" - cd "${GPG_DIR}" - apply_patches gnupg ${GPG_VER} - print_info 1 "$(getIndent 2)gnupg: >> Configuring ..." - # --enable-minimal works, but it doesn't reduce the command length much. - # Given its history and the precision this needs, explicit is cleaner. - LDFLAGS='-static' CFLAGS='-Os' ./configure --prefix=/ \ - --enable-static-rnd=linux --disable-dev-random --disable-asm \ - --disable-selinux-support --disable-gnupg-iconv --disable-card-support \ - --disable-agent-support --disable-bzip2 --disable-exec \ - --disable-photo-viewers --disable-keyserver-helpers --disable-ldap \ - --disable-hkp --disable-finger --disable-generic --disable-mailto \ - --disable-keyserver-path --disable-dns-srv --disable-dns-pka \ - --disable-dns-cert --disable-nls --disable-threads --disable-regex \ - --disable-optimization --with-included-zlib --without-capabilities \ - --without-tar --without-ldap --without-libcurl --without-mailprog \ - --without-libpth-prefix --without-libiconv-prefix --without-libintl-prefix\ - --without-zlib --without-bzip2 --without-libusb --without-readline \ - >> ${LOGFILE} 2>&1 || gen_die 'Configuring gnupg failed!' - print_info 1 "$(getIndent 2)gnupg: >> Compiling ..." - compile_generic "" "utils" - print_info 1 "$(getIndent 2)gnupg: >> Copying to bincache ..." - [ -f "${TEMP}/${GPG_DIR}/g10/gpg" ] || - gen_die 'gnupg executable does not exist!' - ${UTILS_CROSS_COMPILE}strip "${TEMP}/${GPG_DIR}/g10/gpg" || - gen_die 'Could not strip gpg binary!' - bzip2 -z -c "${TEMP}/${GPG_DIR}/g10/gpg" > "${GPG_BINCACHE}" || - gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?' - - cd "${TEMP}" - isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${GPG_DIR}" > /dev/null - return 0 - fi -} - determine_busybox_config_file() { print_info 2 "$(get_indent 3)busybox: >> Checking for suitable busybox configuration ..." diff --git a/gen_initramfs.sh b/gen_initramfs.sh index e7bc08c3..ef9d0951 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -860,23 +860,23 @@ append_firmware() { } append_gpg() { - if [ -d "${TEMP}/initramfs-gpg-temp" ] + local PN=gnupg + local TDIR="${TEMP}/initramfs-${PN}-temp" + if [ -d "${TDIR}" ] then - rm -r "${TEMP}/initramfs-gpg-temp" + rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!" fi - cd ${TEMP} - mkdir -p "${TEMP}/initramfs-gpg-temp/sbin/" - if [ ! -e ${GPG_BINCACHE} ] ; then - print_info 1 "$(getIndent 2)GPG: Adding support (compiling binaries)..." - compile_gpg - fi - bzip2 -dc "${GPG_BINCACHE}" > "${TEMP}/initramfs-gpg-temp/sbin/gpg" || - gen_die 'Could not extract gpg binary cache!' - chmod a+x "${TEMP}/initramfs-gpg-temp/sbin/gpg" - cd "${TEMP}/initramfs-gpg-temp/" + + populate_binpkg ${PN} + + mkdir -p "${TDIR}" || gen_die "Failed to create '${TDIR}'!" + + unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}" + + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" log_future_cpio_content - find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" - rm -rf "${TEMP}/initramfs-gpg-temp" > /dev/null + find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ + || gen_die "Failed to append ${PN} to cpio!" } print_list() diff --git a/gkbuilds/gnupg.gkbuild b/gkbuilds/gnupg.gkbuild new file mode 100644 index 00000000..d99836a4 --- /dev/null +++ b/gkbuilds/gnupg.gkbuild @@ -0,0 +1,65 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +src_configure() { + append-ldflags -static + + local myconf=( + --enable-static-rnd=linux + --disable-dev-random + --disable-asm + --disable-selinux-support + --disable-gnupg-iconv + --disable-card-support + --disable-agent-support + --disable-bzip2 + --disable-exec + --disable-photo-viewers + --disable-keyserver-helpers + --disable-ldap + --disable-hkp + --disable-finger + --disable-generic + --disable-mailto + --disable-keyserver-path + --disable-dns-srv + --disable-dns-cert + --disable-nls + --disable-threads + --disable-regex + --disable-optimization + --with-included-zlib + --without-capabilities + --without-tar + --without-ldap + --without-libcurl + --without-mailprog + --without-libpth-prefix + --without-libiconv-prefix + --without-libintl-prefix + --without-zlib + --without-bzip2 + --without-libusb + --without-readline + ) + + gkconf "${myconf[@]}" +} + +src_install() { + default + + rm -rf \ + "${D}"/usr/bin/gpgsplit \ + "${D}"/usr/bin/gpgv \ + "${D}"/usr/share + + "${STRIP}" --strip-all "${D}"/usr/bin/gpg \ + || die "Failed to strip '${D}/usr/bin/gpg'!" + + # For backward compatibility + mkdir "${D}"/bin || die "Failed to create '${D}/bin'!" + + ln -s ../usr/bin/gpg "${D}"/bin/gpg \ + || die "Failed to create symlink '${D}/bin/gpg' to '${D}/usr/bin/gpg'!" +} |