* add partimage

This commit is contained in:
Alexander Baldeck 2019-03-27 07:22:35 +00:00
parent 5b62c31c9b
commit 6da5351d2a
7 changed files with 225 additions and 0 deletions

71
partimage/PKGBUILD Normal file
View File

@ -0,0 +1,71 @@
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Roman Kyrylych <roman@archlinux.org>
# Contributor: Sven Kauber <celeon@gmail.com>
# Contributor: tardo <tardo@nagi-fanboi.net>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
pkgname=partimage
pkgver=0.6.9
pkgrel=12
pkgdesc='Partition Image saves partitions in many formats to an image file.'
arch=(x86_64 powerpc64le)
url='http://www.partimage.org/'
license=('GPL')
depends=('libnewt' 'bzip2' 'openssl')
backup=('etc/partimaged/partimagedusers')
source=("https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2"
'partimage-0.6.9-zlib-1.2.6.patch'
'use-SSLv3-by-default.patch'
'partimaged-gencrt'
'partimaged.service'
'partimage.sysusers'
'partimage-sysmacros-fix.patch')
md5sums=('1bc046fd915c5debbafc85729464e513'
'202c4334766041d98c5f67c9d62c3063'
'77c33f779186cd25e7c6543348ca5009'
'2316b116227b07efb48266e660ca1ba1'
'5f8dae511cdfbf097409a45e9642a372'
'b0773e9d666e06301c2dcbec80ff25ac'
'216d35f8e96e03dad4c565117c8c6a2c')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -Np1 -i ../partimage-0.6.9-zlib-1.2.6.patch
patch -Np1 -i ../use-SSLv3-by-default.patch
patch -Np1 -i ../partimage-sysmacros-fix.patch
autoreconf -fiv
sed -e 's/CRYPTO_lock/X509_new/g' -i configure
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
./configure \
--build=${CHOST} \
--prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/bin \
--enable-pam
make
make pamfile
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
install -Dm0644 partimaged.pam "${pkgdir}/etc/pam.d/partimaged"
install -Dm0755 "${srcdir}/partimaged-gencrt" "${pkgdir}/usr/bin/partimaged-gencrt"
chmod 644 "${pkgdir}/etc/partimaged/partimagedusers"
chown 110:110 "${pkgdir}/etc/partimaged/partimagedusers"
install -Dm0644 ../partimaged.service "${pkgdir}/usr/lib/systemd/system/partimaged.service"
install -Dm0644 ../partimage.sysusers "${pkgdir}/usr/lib/sysusers.d/partimage.conf"
}

View File

@ -0,0 +1,35 @@
diff --git a/src/client/imagefile.cpp b/src/client/imagefile.cpp
index dd83411..62d0f72 100644
--- a/src/client/imagefile.cpp
+++ b/src/client/imagefile.cpp
@@ -783,7 +783,7 @@ void CImage::openWriting()
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 @@ void CImage::openReading(CVolumeHeader *vh /* = NULL */)
}
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
diff --git a/src/client/imagefile.h b/src/client/imagefile.h
index 4ba8910..6adb098 100644
--- a/src/client/imagefile.h
+++ b/src/client/imagefile.h
@@ -41,7 +41,7 @@ class CImage
COptions m_options;
FILE *m_fImageFile;
- gzFile *m_gzImageFile;
+ gzFile m_gzImageFile;
BZFILE *m_bzImageFile;
int m_nFdImage;

View File

@ -0,0 +1,10 @@
--- partimage-0.6.9/src/client/misc.cpp.orig 2019-03-27 07:16:59.148311905 +0000
+++ partimage-0.6.9/src/client/misc.cpp 2019-03-27 07:17:17.146728496 +0000
@@ -39,6 +39,7 @@
#endif
#include <ctype.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mount.h>

View File

@ -0,0 +1 @@
u partimag 110 "Partimage user" -

View File

@ -0,0 +1,18 @@
#!/bin/sh
if [ `whoami` != "root" ]; then
echo "You must be root to generate certificates."
exit
fi
echo -n "==> Generating certificate for Partimage/PartimageD SSL... "
cd /etc/partimaged
openssl req -new -x509 -outform PEM > partimaged.csr
openssl rsa -in privkey.pem -out partimaged.key
rm privkey.pem
openssl x509 -in partimaged.csr -out partimaged.cert -signkey partimaged.key
rm partimaged.csr
chmod 600 partimaged.key
chmod 600 partimaged.cert
chown partimag:partimag partimaged.key
chown partimag:partimag partimaged.cert

View File

@ -0,0 +1,10 @@
[Unit]
Description=A partition imaging daemon
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/bin/partimaged --daemon
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,80 @@
From 8b05af027723ff3a64040275d4050ff0e992d629 Mon Sep 17 00:00:00 2001
From: Marko Kohtala <marko.kohtala@gmail.com>
Date: Sun, 9 Feb 2014 22:54:11 +0200
Subject: [PATCH] Use SSLv3 by default
SSLv2_client_method may be hidden. Use the SSLv23_client_method instead.
This is a fix from Debian package partimage-0.6.8-2.2.
Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
---
src/client/netclient.cpp | 3 +--
src/client/netclient.h | 6 ------
src/server/netserver.cpp | 3 +--
src/server/netserver.h | 6 ------
4 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/client/netclient.cpp b/src/client/netclient.cpp
index 30b8d5c..43b2672 100644
--- a/src/client/netclient.cpp
+++ b/src/client/netclient.cpp
@@ -43,9 +43,8 @@ CNetClient::CNetClient(bool bMustLogin, bool bUseSSL):CNet()
{
showDebug(3, "initializing client ssl\n");
SSLeay_add_ssl_algorithms();
- meth = SSLv2_client_method();
SSL_load_error_strings();
- ctx = SSL_CTX_new(meth);
+ ctx = SSL_CTX_new(SSLv23_client_method());
if (!ctx)
THROW(ERR_SSL_CTX);
m_bUseSSL = (ctx != NULL);
diff --git a/src/client/netclient.h b/src/client/netclient.h
index 8423798..9d98b39 100644
--- a/src/client/netclient.h
+++ b/src/client/netclient.h
@@ -35,12 +35,6 @@ class CNetClient : public CNet
#ifdef HAVE_SSL
SSL_CTX * ctx;
X509 * server_cert;
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- SSL_METHOD const * meth;
-#else
- SSL_METHOD * meth;
-#endif // OPENSSL_VERSION_NUMBER
-
#endif
bool m_bUseSSL;
bool m_bMustLogin;
diff --git a/src/server/netserver.cpp b/src/server/netserver.cpp
index a542760..28c43cc 100644
--- a/src/server/netserver.cpp
+++ b/src/server/netserver.cpp
@@ -39,8 +39,7 @@ CNetServer::CNetServer( uint32_t ip4_addr, unsigned short int port):CNet()
{
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();
- meth = SSLv23_server_method();
- ctx = SSL_CTX_new(meth);
+ ctx = SSL_CTX_new(SSLv23_server_method());
if (!ctx)
{
ERR_print_errors_fp(stderr);
diff --git a/src/server/netserver.h b/src/server/netserver.h
index 01f6b6c..29d2a32 100644
--- a/src/server/netserver.h
+++ b/src/server/netserver.h
@@ -41,12 +41,6 @@ class CNetServer : public CNet
#ifdef HAVE_SSL
SSL_CTX * ctx;
X509 * client_cert;
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- SSL_METHOD const * meth;
-#else
- SSL_METHOD * meth;
-#endif // OPENSSL_VERSION_NUMBER
-
int err;
#endif