commit: ac7763cfd629bdf3f90ed5c38f4f2cfe38db14f8 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> AuthorDate: Tue Jun 28 17:41:18 2016 +0000 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> CommitDate: Tue Jun 28 17:41:18 2016 +0000 URL: https://gitweb.gentoo.org/repo/proj/ppc64le.git/commit/?id=ac7763cf
sys-block/partimage: copy from tree sys-block/partimage/Manifest | 1 + .../partimage/files/partimage-0.6.8-destdir.patch | 11 ++ .../files/partimage-0.6.8-openssl-1.patch | 30 +++++ .../files/partimage-0.6.9-minor-typo.patch | 13 ++ .../files/partimage-0.6.9-zlib-1.2.5.2.patch | 33 +++++ sys-block/partimage/files/partimaged.conf | 10 ++ sys-block/partimage/files/partimaged.init | 29 +++++ sys-block/partimage/files/partimaged.init.2 | 29 +++++ sys-block/partimage/files/partimaged.pam | 11 ++ sys-block/partimage/files/partimaged.pam.2 | 7 ++ sys-block/partimage/files/servercert.cnf | 37 ++++++ sys-block/partimage/metadata.xml | 14 +++ sys-block/partimage/partimage-0.6.9.ebuild | 140 +++++++++++++++++++++ 13 files changed, 365 insertions(+) diff --git a/sys-block/partimage/Manifest b/sys-block/partimage/Manifest new file mode 100644 index 0000000..4d387ce --- /dev/null +++ b/sys-block/partimage/Manifest @@ -0,0 +1 @@ +DIST partimage-0.6.9.tar.bz2 666522 SHA256 753a6c81f4be18033faed365320dc540fe5e58183eaadcd7a5b69b096fec6635 SHA512 252885921b23933fdcdf0bb6efa4b82066b08ca95cc653296912d384ae875b421c1d39f347a90115315139176d4eab4a930c24919c2d38cf00ed29c764cd14d9 WHIRLPOOL a4e30ea6240c89b568fd5959f4d72130e3737a409270d9336e45f2c4f85c2e6c1c66b5b60abdf47aa238ec4159010cbbcc75c02c6e5a1cb309e2fceee1df7750 diff --git a/sys-block/partimage/files/partimage-0.6.8-destdir.patch b/sys-block/partimage/files/partimage-0.6.8-destdir.patch new file mode 100644 index 0000000..12eb8c4 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.8-destdir.patch @@ -0,0 +1,11 @@ +--- Makefile.am ++++ Makefile.am +@@ -48,7 +48,7 @@ + $(DESTDIR)${sysconfdir}/partimaged/partimagedusers ;\ + echo -n "#add only users allowed to " >> \ + $(DESTDIR)${sysconfdir}/partimaged/partimagedusers ;\ +- echo "connect partimaged" >> ${sysconfdir}/partimaged/partimagedusers ;\ ++ echo "connect partimaged" >> $(DESTDIR)${sysconfdir}/partimaged/partimagedusers ;\ + echo "# (only one login per line)" >> \ + $(DESTDIR)${sysconfdir}/partimaged/partimagedusers ;\ + echo "" >> $(DESTDIR)${sysconfdir}/partimaged/partimagedusers ;\ diff --git a/sys-block/partimage/files/partimage-0.6.8-openssl-1.patch b/sys-block/partimage/files/partimage-0.6.8-openssl-1.patch new file mode 100644 index 0000000..69268a9 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.8-openssl-1.patch @@ -0,0 +1,30 @@ +http://bugs.gentoo.org/326879 + +--- src/client/netclient.h ++++ src/client/netclient.h +@@ -35,7 +35,11 @@ + #ifdef HAVE_SSL + SSL_CTX * ctx; + X509 * server_cert; ++ #if OPENSSL_VERSION_NUMBER >= 0x10000000L ++ const SSL_METHOD * meth; ++ #else + SSL_METHOD * meth; ++ #endif + #endif + bool m_bUseSSL; + bool m_bMustLogin; +--- src/server/netserver.h ++++ src/server/netserver.h +@@ -41,7 +41,11 @@ + #ifdef HAVE_SSL + SSL_CTX * ctx; + X509 * client_cert; ++ #if OPENSSL_VERSION_NUMBER >= 0x10000000L ++ const SSL_METHOD * meth; ++ #else + SSL_METHOD * meth; ++ #endif + int err; + #endif + diff --git a/sys-block/partimage/files/partimage-0.6.9-minor-typo.patch b/sys-block/partimage/files/partimage-0.6.9-minor-typo.patch new file mode 100644 index 0000000..8e0e00e --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.9-minor-typo.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/580290 + +--- a/src/client/misc.h ++++ b/src/client/misc.h +@@ -36,7 +36,7 @@ struct COptions; + #endif + + #ifndef makedev +- #define makedev(maj,min) (((maj) << 8) | min)) ++ #define makedev(maj,min) (((maj) << 8) | (min)) + #endif + + // ======================================================= diff --git a/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2.patch b/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2.patch new file mode 100644 index 0000000..57f87a5 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2.patch @@ -0,0 +1,33 @@ +http://bugs.gentoo.org/405323 + +--- src/client/imagefile.cpp ++++ src/client/imagefile.cpp +@@ -783,7 +783,7 @@ + else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression + { + showDebug(1, "open gzip\n"); +- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "wb"); //"wb1h"); ++ m_gzImageFile = gzdopen(m_nFdImage, "wb"); //"wb1h"); + if (m_gzImageFile == NULL) + { + showDebug(1, "error:%d %s\n", errno, strerror(errno)); +@@ -1098,7 +1098,7 @@ + } + else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression + { +- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "rb"); ++ m_gzImageFile = gzdopen(m_nFdImage, "rb"); + if (m_gzImageFile == NULL) + THROW(ERR_ERRNO, errno); + else +--- src/client/imagefile.h ++++ src/client/imagefile.h +@@ -41,7 +41,7 @@ + COptions m_options; + + FILE *m_fImageFile; +- gzFile *m_gzImageFile; ++ gzFile m_gzImageFile; + BZFILE *m_bzImageFile; + + int m_nFdImage; diff --git a/sys-block/partimage/files/partimaged.conf b/sys-block/partimage/files/partimaged.conf new file mode 100644 index 0000000..032b1cb --- /dev/null +++ b/sys-block/partimage/files/partimaged.conf @@ -0,0 +1,10 @@ +# Copyright 2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# You can define the following optional arguments: +# -d <dest> Destination directory for the backup images +# -pX Server port +# -r <dest> Chroot directory for improved security + +#PARTIMAGED_OPTS="" diff --git a/sys-block/partimage/files/partimaged.init b/sys-block/partimage/files/partimaged.init new file mode 100644 index 0000000..b3b1499 --- /dev/null +++ b/sys-block/partimage/files/partimaged.init @@ -0,0 +1,29 @@ +#!/sbin/openrc-run +# Copyright 2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Id$ + +PARTIMAGED="/usr/sbin/partimaged" + +failed_startup() { + eerror "The PartImage daemon did not start up correctly." + eerror "Perhaps you compiled it with SSL support but forgot to run the ebuild config?" + return 1 +} + +depend() { + need net +} + +start() { + ebegin "Starting partimaged" + start-stop-daemon --start --quiet --exec ${PARTIMAGED} \ + -- ${PARTIMAGED_OPTS} --daemon > /dev/null 2>&1 + eend $? || failed_startup +} + +stop() { + ebegin "Stopping partimaged" + start-stop-daemon --stop --exec ${PARTIMAGED} + eend $? +} diff --git a/sys-block/partimage/files/partimaged.init.2 b/sys-block/partimage/files/partimaged.init.2 new file mode 100644 index 0000000..61e6e64 --- /dev/null +++ b/sys-block/partimage/files/partimaged.init.2 @@ -0,0 +1,29 @@ +#!/sbin/openrc-run +# Copyright 2005-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Id$ + +PARTIMAGED="/usr/sbin/partimaged" + +failed_startup() { + eerror "The PartImage daemon did not start up correctly." + eerror "Perhaps you compiled it with SSL support but forgot to run the ebuild config?" + return 1 +} + +depend() { + need net +} + +start() { + ebegin "Starting partimaged" + start-stop-daemon --start --exec ${PARTIMAGED} \ + -- ${PARTIMAGED_OPTS} --daemon + eend $? || failed_startup +} + +stop() { + ebegin "Stopping partimaged" + start-stop-daemon --stop --exec ${PARTIMAGED} + eend $? +} diff --git a/sys-block/partimage/files/partimaged.pam b/sys-block/partimage/files/partimaged.pam new file mode 100644 index 0000000..6ffb16f --- /dev/null +++ b/sys-block/partimage/files/partimaged.pam @@ -0,0 +1,11 @@ +# PAM config file for Partimaged + +auth required pam_unix.so +auth required pam_warn.so +auth required pam_listfile.so \ + onerr=fail item=user sense=allow \ + file=/etc/partimaged/partimagedusers + +account include system-auth +session include system-auth + diff --git a/sys-block/partimage/files/partimaged.pam.2 b/sys-block/partimage/files/partimaged.pam.2 new file mode 100644 index 0000000..9ed5507 --- /dev/null +++ b/sys-block/partimage/files/partimaged.pam.2 @@ -0,0 +1,7 @@ +# PAM config file for Partimaged + +auth required pam_listfile.so onerr=fail item=user sense=allow file=/etc/partimaged/partimagedusers +auth optional pam_warn.so +auth include system-auth +account include system-auth +session include system-auth diff --git a/sys-block/partimage/files/servercert.cnf b/sys-block/partimage/files/servercert.cnf new file mode 100644 index 0000000..cf6af7e --- /dev/null +++ b/sys-block/partimage/files/servercert.cnf @@ -0,0 +1,37 @@ +# $Id$ +# Robin H. Johnson <robb...@gentoo.org> - October 17, 2003 +# This is the openssl config file to generate keys for partimage +# It is read by mkservercert + +[ req ] +# you can increase this value, but be aware that it will make things much slower +# this should be a power of 2! +default_bits = 1024 +# leave the rest of these alone! +encrypt_key = yes +distinguished_name = req_dn +x509_extensions = cert_type +prompt = no + +[ req_dn ] +# 2-Letter ISO country code +C=US +# FULL name of state/province/district +# NO abbreviations! +ST=Alabama +# FULL name of city +# NO abbreviations! +L=Mobile +# Full Name of your organization +# NO abbreviations! +O=Foobar Systems +# Leave this alone unless specifically need to change it! +OU=Automatically-generated PartImage SSL key +# This should be a FQDN that resolves to the IP of your server +CN=localhost +# This should be the email address for the administrator of the server +emailAddress=root@localhost + +# Leave this alone! +[ cert_type ] +nsCertType = server diff --git a/sys-block/partimage/metadata.xml b/sys-block/partimage/metadata.xml new file mode 100644 index 0000000..0862b06 --- /dev/null +++ b/sys-block/partimage/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-sys...@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<use> + <flag name="nologin">Do not include login support when connecting partimaged</flag> +</use> +<upstream> + <remote-id type="sourceforge">partimage</remote-id> +</upstream> +</pkgmetadata> diff --git a/sys-block/partimage/partimage-0.6.9.ebuild b/sys-block/partimage/partimage-0.6.9.ebuild new file mode 100644 index 0000000..10f9545 --- /dev/null +++ b/sys-block/partimage/partimage-0.6.9.ebuild @@ -0,0 +1,140 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=4 +inherit eutils flag-o-matic pam user + +DESCRIPTION="Console-based application to efficiently save raw partition data to an image file" +HOMEPAGE="http://www.partimage.org/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ppc ~sparc x86" +IUSE="nls nologin pam ssl static" + +LIBS_DEPEND="app-arch/bzip2 + >=dev-libs/newt-0.52 + >=sys-libs/slang-2 + sys-libs/zlib + ssl? ( dev-libs/openssl )" +PAM_DEPEND="!static? ( pam? ( virtual/pam ) )" +RDEPEND="${PAM_DEPEND} + !static? ( ${LIBS_DEPEND} )" +DEPEND="${PAM_DEPEND} + ${LIBS_DEPEND} + nls? ( sys-devel/gettext )" + +pkg_setup() { + enewgroup partimag 91 + enewuser partimag 91 -1 /var/lib/partimage partimag +} + +src_prepare() { + epatch "${FILESDIR}"/${P}-zlib-1.2.5.2.patch #405323 + epatch "${FILESDIR}"/${P}-minor-typo.patch #580290 +} + +src_configure() { + # XXX: Do we still need these? + filter-flags -fno-exceptions + use ppc && append-flags -fsigned-char + + local myconf + + use nologin && myconf="${myconf} --disable-login" + + if use pam && ! use static; then + myconf="${myconf} --enable-pam" + fi + + econf \ + --docdir="${EPREFIX}"/usr/share/doc/${PF} \ + --sysconfdir="${EPREFIX}"/etc \ + $(use_enable nls) \ + $(use_enable ssl) \ + --disable-pam \ + $(use_enable static all-static) \ + --with-log-dir="${EPREFIX}"/var/log/partimage \ + ${myconf} +} + +src_install() { + default + + keepdir /var/lib/partimage + keepdir /var/log/partimage + + newinitd "${FILESDIR}"/partimaged.init.2 partimaged + newconfd "${FILESDIR}"/partimaged.conf partimaged + + if use ssl; then + insinto /etc/partimaged + doins "${FILESDIR}"/servercert.cnf + fi + + if use pam; then + newpamd "${FILESDIR}"/partimaged.pam.2 partimaged + fi +} + +confdir=${EROOT}/etc/partimaged +privkey=${confdir}/partimaged.key +cnf=${confdir}/servercert.cnf +csr=${confdir}/partimaged.csr +cert=${confdir}/partimaged.cert + +pkg_config() { + if use ssl; then + ewarn "Please customize /etc/partimaged/servercert.cnf before you continue!" + ewarn "Press Ctrl-C to break now for it, or press enter to continue." + read + if [ ! -f ${privkey} ]; then + einfo "Generating unencrypted private key: ${privkey}" + openssl genrsa -out ${privkey} 1024 || die + else + einfo "Private key already exists: ${privkey}" + fi + if [ ! -f ${csr} ]; then + einfo "Generating certificate request: ${csr}" + openssl req -new -x509 -outform PEM -out ${csr} -key ${privkey} -config ${cnf} || die + else + einfo "Certificate request already exists: ${csr}" + fi + if [ ! -f ${cert} ]; then + einfo "Generating self-signed certificate: ${cert}" + openssl x509 -in ${csr} -out ${cert} -signkey ${privkey} || die + else + einfo "Self-signed certifcate already exists: ${cert}" + fi + einfo "Setting permissions" + partimagesslperms || die + einfo "Done" + else + einfo "SSL is disabled, not building certificates" + fi +} + +partimagesslperms() { + local ret=0 + chmod 600 ${privkey} 2>/dev/null + ret=$((${ret}+$?)) + chown partimag:0 ${privkey} 2>/dev/null + ret=$((${ret}+$?)) + chmod 644 ${cert} ${csr} 2>/dev/null + ret=$((${ret}+$?)) + chown root:0 ${cert} ${csr} 2>/dev/null + ret=$((${ret}+$?)) + return $ret +} + +pkg_postinst() { + if use ssl; then + einfo "To create the required SSL certificates, please do:" + einfo "emerge --config =${PF}" + partimagesslperms + return 0 + fi + chown partimag:0 "${EROOT}"/etc/partimaged/partimagedusers || die +}