| 1 |
tomjbe |
1.1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
|
|
# $Header: /var/cvsroot/gentoo-x86/app-backup/bacula/bacula-5.2.6.ebuild,v 1.4 2012/05/24 04:36:18 vapier Exp $
|
| 4 |
|
|
|
| 5 |
|
|
EAPI="4"
|
| 6 |
|
|
PYTHON_DEPEND="python? 2"
|
| 7 |
|
|
PYTHON_USE_WITH="threads"
|
| 8 |
|
|
PYTHON_USE_WITH_OPT="python"
|
| 9 |
|
|
|
| 10 |
|
|
inherit eutils multilib python qt4-r2 user
|
| 11 |
|
|
|
| 12 |
|
|
MY_PV=${PV/_beta/-b}
|
| 13 |
|
|
MY_P=${PN}-${MY_PV}
|
| 14 |
|
|
|
| 15 |
|
|
DESCRIPTION="Featureful client/server network backup suite"
|
| 16 |
|
|
HOMEPAGE="http://www.bacula.org/"
|
| 17 |
|
|
SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
|
| 18 |
|
|
|
| 19 |
|
|
LICENSE="AGPL-3"
|
| 20 |
|
|
SLOT="0"
|
| 21 |
|
|
KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86"
|
| 22 |
|
|
IUSE="bacula-clientonly bacula-nodir bacula-nosd ipv6 logwatch mysql postgres python qt4 readline +sqlite3 ssl static tcpd vim-syntax X"
|
| 23 |
|
|
|
| 24 |
|
|
DEPEND="
|
| 25 |
|
|
>=sys-libs/zlib-1.1.4
|
| 26 |
|
|
dev-libs/gmp
|
| 27 |
|
|
!bacula-clientonly? (
|
| 28 |
|
|
postgres? ( dev-db/postgresql-base[threads] )
|
| 29 |
|
|
mysql? ( virtual/mysql )
|
| 30 |
|
|
sqlite3? ( dev-db/sqlite:3 )
|
| 31 |
|
|
!bacula-nodir? ( virtual/mta )
|
| 32 |
|
|
)
|
| 33 |
|
|
qt4? (
|
| 34 |
|
|
x11-libs/qt-svg:4
|
| 35 |
|
|
x11-libs/qwt:5
|
| 36 |
|
|
)
|
| 37 |
|
|
ssl? ( dev-libs/openssl )
|
| 38 |
|
|
logwatch? ( sys-apps/logwatch )
|
| 39 |
|
|
tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
|
| 40 |
|
|
readline? ( >=sys-libs/readline-4.1 )
|
| 41 |
|
|
dev-libs/lzo
|
| 42 |
|
|
sys-libs/ncurses"
|
| 43 |
|
|
RDEPEND="${DEPEND}
|
| 44 |
|
|
!bacula-clientonly? (
|
| 45 |
|
|
!bacula-nosd? (
|
| 46 |
|
|
sys-block/mtx
|
| 47 |
|
|
app-arch/mt-st
|
| 48 |
|
|
)
|
| 49 |
|
|
)
|
| 50 |
|
|
vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
|
| 51 |
|
|
|
| 52 |
|
|
REQUIRED_USE="|| ( ^^ ( mysql postgres sqlite3 ) bacula-clientonly )"
|
| 53 |
|
|
|
| 54 |
|
|
S=${WORKDIR}/${MY_P}
|
| 55 |
|
|
|
| 56 |
|
|
pkg_setup() {
|
| 57 |
|
|
# create the daemon group and user
|
| 58 |
|
|
if [ -z "$(egetent group bacula 2>/dev/null)" ]; then
|
| 59 |
|
|
enewgroup bacula
|
| 60 |
|
|
einfo
|
| 61 |
|
|
einfo "The group 'bacula' has been created. Any users you add to this"
|
| 62 |
|
|
einfo "group have access to files created by the daemons."
|
| 63 |
|
|
einfo
|
| 64 |
|
|
fi
|
| 65 |
|
|
|
| 66 |
|
|
if use bacula-clientonly && use static && use qt4; then
|
| 67 |
|
|
ewarn
|
| 68 |
|
|
ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt4' useflag."
|
| 69 |
|
|
ewarn
|
| 70 |
|
|
fi
|
| 71 |
|
|
|
| 72 |
|
|
if ! use bacula-clientonly; then
|
| 73 |
|
|
# USE=static only supported for bacula-clientonly
|
| 74 |
|
|
if use static; then
|
| 75 |
|
|
ewarn
|
| 76 |
|
|
ewarn "USE=static only supported together with USE=bacula-clientonly."
|
| 77 |
|
|
ewarn "Ignoring 'static' useflag."
|
| 78 |
|
|
ewarn
|
| 79 |
|
|
fi
|
| 80 |
|
|
if [ -z "$(egetent passwd bacula 2>/dev/null)" ]; then
|
| 81 |
|
|
enewuser bacula -1 -1 /var/lib/bacula bacula,disk,tape,cdrom,cdrw
|
| 82 |
|
|
einfo
|
| 83 |
|
|
einfo "The user 'bacula' has been created. Please see the bacula manual"
|
| 84 |
|
|
einfo "for information about running bacula as a non-root user."
|
| 85 |
|
|
einfo
|
| 86 |
|
|
fi
|
| 87 |
|
|
fi
|
| 88 |
|
|
|
| 89 |
|
|
if use python; then
|
| 90 |
|
|
python_set_active_version 2
|
| 91 |
|
|
python_pkg_setup
|
| 92 |
|
|
fi
|
| 93 |
|
|
}
|
| 94 |
|
|
|
| 95 |
|
|
src_prepare() {
|
| 96 |
|
|
# adjusts default configuration files for several binaries
|
| 97 |
|
|
# to /etc/bacula/<config> instead of ./<config>
|
| 98 |
|
|
pushd src >&/dev/null || die
|
| 99 |
|
|
for f in console/console.c dird/dird.c filed/filed.c \
|
| 100 |
|
|
stored/bcopy.c stored/bextract.c stored/bls.c \
|
| 101 |
|
|
stored/bscan.c stored/btape.c stored/stored.c \
|
| 102 |
|
|
qt-console/main.cpp; do
|
| 103 |
|
|
sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
|
| 104 |
|
|
|| die "sed on ${f} failed"
|
| 105 |
|
|
done
|
| 106 |
|
|
popd >&/dev/null || die
|
| 107 |
|
|
|
| 108 |
|
|
# drop automatic install of unneeded documentation (for bug 356499)
|
| 109 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-doc.patch
|
| 110 |
|
|
|
| 111 |
|
|
# bug #310087
|
| 112 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
|
| 113 |
|
|
|
| 114 |
|
|
# bug #311161
|
| 115 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-lib-search-path.patch
|
| 116 |
|
|
|
| 117 |
|
|
# stop build for errors in subdirs
|
| 118 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-Makefile.patch
|
| 119 |
|
|
|
| 120 |
|
|
# bat needs to respect LDFLAGS
|
| 121 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-ldflags.patch
|
| 122 |
|
|
|
| 123 |
|
|
# bug #328701
|
| 124 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
|
| 125 |
|
|
|
| 126 |
|
|
epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-fix-static.patch
|
| 127 |
|
|
}
|
| 128 |
|
|
|
| 129 |
|
|
src_configure() {
|
| 130 |
|
|
local myconf=''
|
| 131 |
|
|
|
| 132 |
|
|
if use bacula-clientonly; then
|
| 133 |
|
|
myconf="${myconf} \
|
| 134 |
|
|
$(use_enable bacula-clientonly client-only) \
|
| 135 |
|
|
$(use_enable !static libtool) \
|
| 136 |
|
|
$(use_enable static static-cons) \
|
| 137 |
|
|
$(use_enable static static-fd)"
|
| 138 |
|
|
else
|
| 139 |
|
|
myconf="${myconf} \
|
| 140 |
|
|
$(use_enable !bacula-nodir build-dird) \
|
| 141 |
|
|
$(use_enable !bacula-nosd build-stored)"
|
| 142 |
|
|
# bug #311099
|
| 143 |
|
|
# database support needed by dir-only *and* sd-only
|
| 144 |
|
|
# build as well (for building bscan, btape, etc.)
|
| 145 |
|
|
myconf="${myconf} \
|
| 146 |
|
|
$(use_with mysql) \
|
| 147 |
|
|
$(use_with sqlite3) \
|
| 148 |
|
|
$(use_with postgres postgresql) \
|
| 149 |
|
|
--enable-batch-insert"
|
| 150 |
|
|
fi
|
| 151 |
|
|
|
| 152 |
|
|
# do not build bat if 'static' clientonly
|
| 153 |
|
|
if ! use bacula-clientonly || ! use static; then
|
| 154 |
|
|
myconf="${myconf} \
|
| 155 |
|
|
$(use_enable qt4 bat)"
|
| 156 |
|
|
fi
|
| 157 |
|
|
|
| 158 |
|
|
myconf="${myconf} \
|
| 159 |
|
|
--disable-tray-monitor \
|
| 160 |
|
|
$(use_with X x) \
|
| 161 |
|
|
$(use_with python) \
|
| 162 |
|
|
$(use_enable !readline conio) \
|
| 163 |
|
|
$(use_enable readline) \
|
| 164 |
|
|
$(use_with readline readline /usr) \
|
| 165 |
|
|
$(use_with ssl openssl) \
|
| 166 |
|
|
$(use_enable ipv6) \
|
| 167 |
|
|
$(use_with tcpd tcp-wrappers)"
|
| 168 |
|
|
|
| 169 |
|
|
econf \
|
| 170 |
|
|
--libdir=/usr/$(get_libdir) \
|
| 171 |
|
|
--docdir=/usr/share/doc/${PF} \
|
| 172 |
|
|
--htmldir=/usr/share/doc/${PF}/html \
|
| 173 |
|
|
--with-pid-dir=/var/run \
|
| 174 |
|
|
--sysconfdir=/etc/bacula \
|
| 175 |
|
|
--with-subsys-dir=/var/lock/subsys \
|
| 176 |
|
|
--with-working-dir=/var/lib/bacula \
|
| 177 |
|
|
--with-scriptdir=/usr/libexec/bacula \
|
| 178 |
|
|
--with-dir-user=bacula \
|
| 179 |
|
|
--with-dir-group=bacula \
|
| 180 |
|
|
--with-sd-user=root \
|
| 181 |
|
|
--with-sd-group=bacula \
|
| 182 |
|
|
--with-fd-user=root \
|
| 183 |
|
|
--with-fd-group=bacula \
|
| 184 |
|
|
--enable-smartalloc \
|
| 185 |
|
|
--host=${CHOST} \
|
| 186 |
|
|
${myconf}
|
| 187 |
|
|
# correct configuration for QT based bat
|
| 188 |
|
|
if use qt4 ; then
|
| 189 |
|
|
pushd src/qt-console
|
| 190 |
|
|
eqmake4
|
| 191 |
|
|
popd
|
| 192 |
|
|
fi
|
| 193 |
|
|
}
|
| 194 |
|
|
|
| 195 |
|
|
src_install() {
|
| 196 |
|
|
emake DESTDIR="${D}" install
|
| 197 |
|
|
insinto /usr/share/pixmaps
|
| 198 |
|
|
doins scripts/bacula.png
|
| 199 |
|
|
|
| 200 |
|
|
# install bat icon and desktop file when enabled
|
| 201 |
|
|
# (for some reason ./configure doesn't pick this up)
|
| 202 |
|
|
if use qt4 && ! use static ; then
|
| 203 |
|
|
insinto /usr/share/pixmaps
|
| 204 |
|
|
doins src/qt-console/images/bat_icon.png
|
| 205 |
|
|
insinto /usr/share/applications
|
| 206 |
|
|
doins scripts/bat.desktop
|
| 207 |
|
|
fi
|
| 208 |
|
|
|
| 209 |
|
|
# remove some scripts we don't need at all
|
| 210 |
|
|
rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
|
| 211 |
|
|
|
| 212 |
|
|
# rename statically linked apps
|
| 213 |
|
|
if use bacula-clientonly && use static ; then
|
| 214 |
|
|
pushd "${D}"/usr/sbin || die
|
| 215 |
|
|
mv static-bacula-fd bacula-fd || die
|
| 216 |
|
|
mv static-bconsole bconsole || die
|
| 217 |
|
|
popd || die
|
| 218 |
|
|
fi
|
| 219 |
|
|
|
| 220 |
|
|
# extra files which 'make install' doesn't cover
|
| 221 |
|
|
if ! use bacula-clientonly; then
|
| 222 |
|
|
# the database update scripts
|
| 223 |
|
|
diropts -m0750
|
| 224 |
|
|
insinto /usr/libexec/bacula/updatedb
|
| 225 |
|
|
insopts -m0754
|
| 226 |
|
|
doins "${S}"/updatedb/*
|
| 227 |
|
|
fperms 0640 /usr/libexec/bacula/updatedb/README
|
| 228 |
|
|
|
| 229 |
|
|
# the logrotate configuration
|
| 230 |
|
|
# (now unconditional wrt bug #258187)
|
| 231 |
|
|
diropts -m0755
|
| 232 |
|
|
insinto /etc/logrotate.d
|
| 233 |
|
|
insopts -m0644
|
| 234 |
|
|
newins "${S}"/scripts/logrotate bacula
|
| 235 |
|
|
|
| 236 |
|
|
# the logwatch scripts
|
| 237 |
|
|
if use logwatch; then
|
| 238 |
|
|
diropts -m0750
|
| 239 |
|
|
dodir /etc/log.d/scripts/services
|
| 240 |
|
|
dodir /etc/log.d/scripts/shared
|
| 241 |
|
|
dodir /etc/log.d/conf/logfiles
|
| 242 |
|
|
dodir /etc/log.d/conf/services
|
| 243 |
|
|
pushd "${S}"/scripts/logwatch >&/dev/null || die
|
| 244 |
|
|
emake DESTDIR="${D}" install
|
| 245 |
|
|
popd >&/dev/null || die
|
| 246 |
|
|
fi
|
| 247 |
|
|
fi
|
| 248 |
|
|
|
| 249 |
|
|
rm -vf "${D}"/usr/share/man/man1/bacula-bwxconsole.1*
|
| 250 |
|
|
if ! use qt4; then
|
| 251 |
|
|
rm -vf "${D}"/usr/share/man/man1/bat.1*
|
| 252 |
|
|
fi
|
| 253 |
|
|
rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
|
| 254 |
|
|
if use bacula-clientonly || use bacula-nodir; then
|
| 255 |
|
|
rm -vf "${D}"/usr/share/man/man8/bacula-dir.8*
|
| 256 |
|
|
rm -vf "${D}"/usr/share/man/man8/dbcheck.8*
|
| 257 |
|
|
rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
|
| 258 |
|
|
rm -vf "${D}"/usr/libexec/bacula/create_*_database
|
| 259 |
|
|
rm -vf "${D}"/usr/libexec/bacula/drop_*_database
|
| 260 |
|
|
rm -vf "${D}"/usr/libexec/bacula/make_*_tables
|
| 261 |
|
|
rm -vf "${D}"/usr/libexec/bacula/update_*_tables
|
| 262 |
|
|
rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
|
| 263 |
|
|
rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
|
| 264 |
|
|
rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
|
| 265 |
|
|
fi
|
| 266 |
|
|
if use bacula-clientonly || use bacula-nosd; then
|
| 267 |
|
|
rm -vf "${D}"/usr/share/man/man8/bacula-sd.8*
|
| 268 |
|
|
rm -vf "${D}"/usr/share/man/man8/bcopy.8*
|
| 269 |
|
|
rm -vf "${D}"/usr/share/man/man8/bextract.8*
|
| 270 |
|
|
rm -vf "${D}"/usr/share/man/man8/bls.8*
|
| 271 |
|
|
rm -vf "${D}"/usr/share/man/man8/bscan.8*
|
| 272 |
|
|
rm -vf "${D}"/usr/share/man/man8/btape.8*
|
| 273 |
|
|
rm -vf "${D}"/usr/libexec/bacula/disk-changer
|
| 274 |
|
|
rm -vf "${D}"/usr/libexec/bacula/mtx-changer
|
| 275 |
|
|
rm -vf "${D}"/usr/libexec/bacula/dvd-handler
|
| 276 |
|
|
fi
|
| 277 |
|
|
|
| 278 |
|
|
# documentation
|
| 279 |
|
|
dodoc ChangeLog LICENSE ReleaseNotes SUPPORT technotes
|
| 280 |
|
|
|
| 281 |
|
|
# vim-files
|
| 282 |
|
|
if use vim-syntax; then
|
| 283 |
|
|
insinto /usr/share/vim/vimfiles/syntax
|
| 284 |
|
|
doins scripts/bacula.vim
|
| 285 |
|
|
insinto /usr/share/vim/vimfiles/ftdetect
|
| 286 |
|
|
newins scripts/filetype.vim bacula_ft.vim
|
| 287 |
|
|
fi
|
| 288 |
|
|
|
| 289 |
|
|
# setup init scripts
|
| 290 |
|
|
myscripts="bacula-fd"
|
| 291 |
|
|
if ! use bacula-clientonly; then
|
| 292 |
|
|
if ! use bacula-nodir; then
|
| 293 |
|
|
myscripts="${myscripts} bacula-dir"
|
| 294 |
|
|
fi
|
| 295 |
|
|
if ! use bacula-nosd; then
|
| 296 |
|
|
myscripts="${myscripts} bacula-sd"
|
| 297 |
|
|
fi
|
| 298 |
|
|
fi
|
| 299 |
|
|
for script in ${myscripts}; do
|
| 300 |
|
|
# copy over init script and config to a temporary location
|
| 301 |
|
|
# so we can modify them as needed
|
| 302 |
|
|
cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
|
| 303 |
|
|
cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
|
| 304 |
|
|
# set database dependancy for the director init script
|
| 305 |
|
|
case "${script}" in
|
| 306 |
|
|
bacula-dir)
|
| 307 |
|
|
case "${mydbtype}" in
|
| 308 |
|
|
sqlite3)
|
| 309 |
|
|
# sqlite3 databases don't have a daemon
|
| 310 |
|
|
sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
|
| 311 |
|
|
;;
|
| 312 |
|
|
*)
|
| 313 |
|
|
# all other databases have daemons
|
| 314 |
|
|
sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
|
| 315 |
|
|
;;
|
| 316 |
|
|
esac
|
| 317 |
|
|
;;
|
| 318 |
|
|
*)
|
| 319 |
|
|
;;
|
| 320 |
|
|
esac
|
| 321 |
|
|
# install init script and config
|
| 322 |
|
|
newinitd "${T}/${script}".initd "${script}"
|
| 323 |
|
|
newconfd "${T}/${script}".confd "${script}"
|
| 324 |
|
|
done
|
| 325 |
|
|
|
| 326 |
|
|
# make sure the working directory exists
|
| 327 |
|
|
diropts -m0750
|
| 328 |
|
|
keepdir /var/lib/bacula
|
| 329 |
|
|
|
| 330 |
|
|
# make sure bacula group can execute bacula libexec scripts
|
| 331 |
|
|
fowners -R root:bacula /usr/libexec/bacula
|
| 332 |
|
|
}
|
| 333 |
|
|
|
| 334 |
|
|
pkg_postinst() {
|
| 335 |
|
|
if use bacula-clientonly; then
|
| 336 |
|
|
fowners root:bacula /var/lib/bacula
|
| 337 |
|
|
else
|
| 338 |
|
|
fowners bacula:bacula /var/lib/bacula
|
| 339 |
|
|
fi
|
| 340 |
|
|
|
| 341 |
|
|
if ! use bacula-clientonly && ! use bacula-nodir; then
|
| 342 |
|
|
einfo
|
| 343 |
|
|
einfo "If this is a new install, you must create the ${mydbtype} databases with:"
|
| 344 |
|
|
einfo " /usr/libexec/bacula/create_${mydbtype}_database"
|
| 345 |
|
|
einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
|
| 346 |
|
|
einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
|
| 347 |
|
|
einfo
|
| 348 |
|
|
fi
|
| 349 |
|
|
|
| 350 |
|
|
einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
|
| 351 |
|
|
einfo "you have to enable 'USE=qt4'."
|
| 352 |
|
|
einfo
|
| 353 |
|
|
}
|