blob: 855d6491e464ca1d50f74809a65b3d4beda71e8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-backup/afbackup-server/afbackup-server-3.3.8.1.ebuild,v 1.1 2006/05/10 14:26:48 lisa Exp $
inherit eutils
# is this the server ebuild, otherwise client
if [ "${PN/afbackup-/}" = "server" ];then
MY_PN=${PN/-server/}
MY_MODE=server
else
MY_PN=${PN/-client/}
MY_MODE=client
fi
MY_P=${MY_PN}-${PV}
DESCRIPTION="AFBackup is a client/server backup tool"
HOMEPAGE="http://afbackup.sourceforge.net/"
SRC_URI="mirror://sourceforge/${MY_PN}/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="zlib"
DEPEND="zlib? ( sys-libs/zlib )"
RDEPEND="zlib? ( sys-libs/zlib )"
S=${WORKDIR}/${MY_P}
src_unpack() {
unpack ${A}
cd ${S}
sed -i -e 's:subdir="/backup":subdir="/afbackup":' configure
# Setting up authentication key
einfo "Searching for your afbackup.key..."
if [ -f /etc/afbackup/afbackup.key ]; then
AFBACKUPKEY=`echo /etc/afbackup/afbackup.key`
einfo "...found."
fi
# if none, generate a random key
if [ "x${AFBACKUPKEY}" = "x" ]; then
ewarn "AFBACKUPKEY environment variable not set, generating new key..."
AFBACKUPKEY=`head -c4 /dev/urandom | od -N4 -tu4 | sed -ne '1s/.* //p'`
fi
einfo "Using ${AFBACKUPKEY} as your backup key."
sed -i -e "s:k=\" \":k=\"${AFBACKUPKEY}\":" ask_for_key
echo ${AFBACKUPKEY} > ${S}/afbackup.key
}
src_compile() {
local myconf=""
use zlib && myconf="${myconf} --with-zlib"
./configure \
--host=${CHOST} \
--prefix=/opt \
--with-serverconfdir=/etc/afbackup \
--with-serverconf=server.conf \
--with-servermandir=/usr/share/man \
--with-clientconfdir=/etc/afbackup \
--with-clientconf=client.conf \
--with-clientmandir=/usr/share/man \
--mandir=/usr/share/man \
${myconf} || die "./configure failed"
einfo "Building: afbackup-${MY_MODE}"
emake ${MY_MODE} || die "emake failed"
}
src_install() {
local myconf=""
use zlib && myconf="${myconf} --with-zlib"
einfo "Reconfiguring ${MY_MODE} installation path..."
./configure \
--host=${CHOST} \
--prefix=${D}/opt \
--with-serverconfdir=${D}/etc/afbackup \
--with-serverconf=server.conf \
--with-servermandir=${D}/usr/share/man \
--with-clientconfdir=${D}/etc/afbackup \
--with-clientconf=client.conf \
--with-clientmandir=${D}/usr/share/man \
--mandir=${D}/usr/share/man \
${myconf} || die "./configure failed"
einfo "Installing: afbackup-${MY_MODE}"
make DESTDIR=${D} install.${MY_MODE} || die
# fix path in config files
einfo "Fixing paths in ${MY_MODE}.conf"
if [ "x${MY_MODE}" = "xserver" ]; then
sed -i -e "s:${D}::g" ${D}/etc/afbackup/server.conf
fi
if [ "x${MY_MODE}" = "xclient" ]; then
sed -i -e "s:${D}::g" ${D}/etc/afbackup/client.conf
fi
# if new, install key and set permissions
if [ ! -f /etc/afbackup/afbackup.key ]; then
einfo "Installing backup key..."
insinto /etc/afbackup
doins afbackup.key
einfo "Restricting permissions on keyfile..."
fperms 600 /etc/afbackup/afbackup.key
fi
}
pkg_postinst() {
ewarn "The key of afbackup server and client have to match."
einfo "Be sure to use the same environment variable or keyfile."
}
|