diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/partimage |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/partimage')
-rw-r--r-- | community/partimage/PKGBUILD | 42 | ||||
-rw-r--r-- | community/partimage/partimage.install | 22 | ||||
-rw-r--r-- | community/partimage/partimaged | 64 | ||||
-rw-r--r-- | community/partimage/partimaged-gencrt | 18 |
4 files changed, 146 insertions, 0 deletions
diff --git a/community/partimage/PKGBUILD b/community/partimage/PKGBUILD new file mode 100644 index 000000000..d3923a9a3 --- /dev/null +++ b/community/partimage/PKGBUILD @@ -0,0 +1,42 @@ +# $Id: PKGBUILD 42823 2011-03-21 09:06:51Z lfleischer $ +# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de> +# 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=1 +pkgdesc='Partition Image saves partitions in many formats to an image file.' +arch=('i686' 'x86_64') +url='http://www.partimage.org/' +license=('GPL') +depends=('libnewt' 'lzo' 'bzip2' 'openssl') +backup=('etc/partimaged/partimagedusers') +install='partimage.install' +source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2" + 'partimaged' + 'partimaged-gencrt') +md5sums=('1bc046fd915c5debbafc85729464e513' + 'f3b517a62de5540f3b1a8b7edf65b7ec' + '2316b116227b07efb48266e660ca1ba1') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + + ./configure --prefix=/usr --sysconfdir=/etc --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" "${pkgdir}/etc/rc.d/partimaged" + install -Dm0755 "${srcdir}/partimaged-gencrt" "${pkgdir}/usr/bin/partimaged-gencrt" + chmod 644 "${pkgdir}/etc/partimaged/partimagedusers" +} diff --git a/community/partimage/partimage.install b/community/partimage/partimage.install new file mode 100644 index 000000000..4d403b177 --- /dev/null +++ b/community/partimage/partimage.install @@ -0,0 +1,22 @@ +pre_install() { + groupadd -g 110 partimag &> /dev/null + useradd -u 110 -g partimag -c "Partimage user" -d /dev/null -s /bin/false partimag &> /dev/null +} + +post_install() { + chown partimag:partimag /etc/partimaged/partimagedusers +} + +post_upgrade() { + if [ "$(getent group partimag | cut -d ':' -f 3)" != '110' ]; then + post_remove + pre_install + echo ">> partimage UID/GID has been changed" + echo ">> if you have some directories owned by partimage - please chown them again" + fi +} + +post_remove() { + userdel partimag > /dev/null + groupdel partimag > /dev/null +} diff --git a/community/partimage/partimaged b/community/partimage/partimaged new file mode 100644 index 000000000..da810cbb1 --- /dev/null +++ b/community/partimage/partimaged @@ -0,0 +1,64 @@ +#!/bin/bash +# This file belongs in /etc/rc.d +# +############################################################################### + +#inserting certain functions (like stat_busy) +. /etc/rc.conf +. /etc/rc.d/functions + +PARTIMAGE=/usr/sbin/ + +# Check the file is there and is executable. +[ -x $PARTIMAGE/partimaged ] || exit 0 + +PID=`pidof -o %PPID /usr/sbin/partimaged` + +# See how we were called. +case "$1" in + start) + stat_busy "Starting Partimage Daemon " + if [ -z "$PID" ]; then + /usr/sbin/partimaged -D &>/dev/null + RETVAL=$? #storing the status of the last command to RETVAL + if [ $? -gt 0 ]; then #if the status was other than 0, the command failed + stat_fail + exit 1 + else + add_daemon partimaged + stat_done + fi + else + stat_fail + echo ":: Daemon already started as pid $PID" + exit 1 + fi + ;; + stop) + stat_busy "Stopping Partimage Daemon " + if [ "$PID" != "" ]; then #if PID exists + kill -KILL $PID &>/dev/null + stat_done + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + RETVAL=$? + rm_daemon partimaged + fi + else + stat_fail + echo ":: Daemon already stopped" + exit 1 + fi + ;; + restart|reload) + $0 stop + $0 start + RETVAL=$? + ;; + *) + echo "Usage: partimaged {start|stop|restart|reload}" + exit 1 +esac +exit $RETVAL diff --git a/community/partimage/partimaged-gencrt b/community/partimage/partimaged-gencrt new file mode 100644 index 000000000..16fe5ff16 --- /dev/null +++ b/community/partimage/partimaged-gencrt @@ -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 |