Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
Added a new patch for fixing the pidfile dir (/var/log/ -> /var/run/)
Browse files Browse the repository at this point in the history
  • Loading branch information
lnagel committed Nov 16, 2009
1 parent 8a2c028 commit c8c055d
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app-backup/backuppc/ChangeLog
@@ -1,5 +1,8 @@
*backuppc-3.1.0 (29 Sep 2009)

16 Nov 2009; Lenno Nagel <lenno@nagel.ee> +backuppc-3.1.0-r2.ebuild:
Added a new patch for fixing the pidfile dir (/var/log -> /var/run)

29 Sep 2009; Lenno Nagel <lenno@nagel.ee> +backuppc-3.1.0.ebuild:
Wrote a new ebuild for 3.1.0 based on the old versions.
I really hope this is much cleaner and more reliable than the
Expand Down
4 changes: 3 additions & 1 deletion app-backup/backuppc/Manifest
Expand Up @@ -3,10 +3,12 @@ AUX 02-fix-config.pl-formatting.patch 23106 RMD160 4ef821db3c34416badc8efedd1426
AUX 03-reasonable-config.pl-defaults.patch 1168 RMD160 46321a71c0b3f4c0a49c82fc923edbb82e48e218 SHA1 ef26ef0d3c7c5e91576a22f751747a5e31308496 SHA256 437e7606387e5142550d25aadd1358a2995ef7da1b6d19f66e423a8ad50d51f4
AUX 04-add-docdir-marker.patch 470 RMD160 c077c32a5de7600d0906742510be5bc4612a0d50 SHA1 1117a29c10c00f4456f658be131b4d5c9e31f617 SHA256 9236caf66f1d5cd607ced53173cd127d49bfacb08212e93e0beff37ad80cc4bb
AUX 05-nicelevel.patch 756 RMD160 a26c588c0936f2d3f129aed4c5bbfbada3fef075 SHA1 e1db6fc9c2f450df08162218cb3680da407f3d47 SHA256 a707a592754fadc92a769a488518b355468afa8d57a280e29adff4e8c4384566
AUX 06-pidfile-dir.patch 338 RMD160 f81574a333eb1e59ce984a7b08501d522efcae59 SHA1 62792a5b530e26ee84c8e084e6156710f9587b1c SHA256 afbb7afbd48a9093a541d2c8f30a9875e98b9ba717ee647a4903c82960c5a4b6
AUX apache2-backuppc.conf 3057 RMD160 c9ad1329302296cc1cbce8c0d48989719872da65 SHA1 36d95931bb6dff59712b7511bf34b6b18486fa11 SHA256 7d832145226cc64386338001709e7fa9da9073b0788d6bf31f25b7d1b4e95a4b
AUX apache2-backuppc.init 3800 RMD160 9a4a4c55671738447ef131480ca41506baf947b8 SHA1 6ffef133a0b523e4e0d428b8a5282632303d61a2 SHA256 a8b29805a82315f47e0b8e8583c530ba0e4c0b0393001bed4cd2759c2a0c6bb9
AUX httpd.conf 11970 RMD160 cf78a935be057d2319b597415f0dbfd7b702aaaf SHA1 ebd180f921003dc196d2add9fa024ab6ca21b44c SHA256 3f6b7a3fa90b76ffafd6e2b2c4119c31429c27b836092b69d8b3a2da0e5e5aee
DIST BackupPC-3.1.0.tar.gz 474981 RMD160 22d4cb6dd76f846fde489a301852f50e8db1ae1d SHA1 3bd6d637f4f08f2fda44a12668b91d47c4abb0a7 SHA256 49a2744cb9aaf27b298ec3d2e83e46fdb86fb3596922beb3904cb6ae552c148a
EBUILD backuppc-3.1.0-r1.ebuild 6027 RMD160 dd4a84c3f87162d1e032ac704f7578734dea056a SHA1 f85d693157b3ddc29e7a5171ced999033d299da2 SHA256 ba61cf6afd40113b66c8bca0751ed8631bce52bec3d1560b044fe6b277539062
MISC ChangeLog 342 RMD160 e519fdeee910c6600b246ee7e70003643e639036 SHA1 591541d1b4f85bb49e917c9885e5c1c67c02fee2 SHA256 406d2132b8c3fe7a49eff9f8e3a05f80e04fb08ced6790218a95e39dbaf7881f
EBUILD backuppc-3.1.0-r2.ebuild 6070 RMD160 c959bbf2f4269f4f22c58fbdc2d6a5eae418688e SHA1 3d685ae5ed0657065836d22f414b7daf4018b287 SHA256 7818caee26a6cd25c876e0e84fd5501012dcfb235e11c4d9e2032459f40e05ca
MISC ChangeLog 481 RMD160 26c1ea5a625689e39a7d224ad74a153c271f7f17 SHA1 b08558facd109a8cd45d80f77c0506c6c9076466 SHA256 fe765fe0049377a9dc207fa29eb3d755592ef903bfd82be5ced0f18cb1e10eb0
MISC metadata.xml 505 RMD160 080f7450920b9079a7436a05fb03c1a626c938fc SHA1 d42059212c110b63ee0590a3cc50c86adea635f4 SHA256 2c461cd601ed00f142b5994f2998df2308a47f79c46c1016e83b4109fb9d044e
222 changes: 222 additions & 0 deletions app-backup/backuppc/backuppc-3.1.0-r2.ebuild
@@ -0,0 +1,222 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils webapp

MY_P="BackupPC-${PV}"

DESCRIPTION="A high-performance system for backing up computers to a server's disk."
HOMEPAGE="http://backuppc.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"

LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"

IUSE="samba"

DEPEND="dev-lang/perl
app-admin/apache-tools
app-admin/makepasswd"
RDEPEND="${DEPEND}
perl-core/IO-Compress
dev-perl/Archive-Zip
>=app-arch/tar-1.13.20
app-arch/par2cmdline
app-arch/gzip
app-arch/bzip2
virtual/mta
www-apache/mod_perl
www-servers/apache[suexec]
net-misc/rsync
>=dev-perl/File-RsyncP-0.68
rss? ( dev-perl/XML-RSS )
samba? ( net-fs/samba )"

WEBAPP_MANUAL_SLOT="yes"
SLOT="0"

S=${WORKDIR}/${MY_P}

CONFDIR="/etc/BackupPC"
DATADIR="/var/lib/backuppc"
LOGDIR="/var/log/BackupPC"

pkg_setup() {
webapp_pkg_setup
enewgroup backuppc
enewuser backuppc -1 -1 /dev/null backuppc
}

src_unpack() {
unpack ${A}
cd "${S}"
}

src_prepare() {
epatch "${FILESDIR}/01-fix-configure.pl.patch"
epatch "${FILESDIR}/02-fix-config.pl-formatting.patch"
epatch "${FILESDIR}/03-reasonable-config.pl-defaults.patch"

# Fix the documentation location in the CGI interface
epatch "${FILESDIR}/04-add-docdir-marker.patch"
sed -i "s+__DOCDIR__+/usr/share/doc/${PF}+" "lib/BackupPC/CGI/View.pm"

epatch "${FILESDIR}/05-nicelevel.patch"
epatch "${FILESDIR}/06-pidfile-dir.patch"
}

src_test() {
true
}

src_install() {
webapp_src_preinst

local myconf
myconf=""
if use samba ; then
myconf="--bin-path smbclient=$(type -p smbclient)"
myconf="${myconf} --bin-path nmblookup=$(type -p nmblookup)"
fi

./configure.pl \
--batch \
--bin-path perl=$(type -p perl) \
--bin-path tar=$(type -p tar) \
--bin-path rsync=$(type -p rsync) \
--bin-path ping=$(type -p ping) \
--bin-path df=$(type -p df) \
--bin-path ssh=$(type -p ssh) \
--bin-path sendmail=$(type -p sendmail) \
--bin-path hostname=$(type -p hostname) \
--bin-path gzip=$(type -p gzip) \
--bin-path bzip2=$(type -p bzip2) \
--config-dir ${CONFDIR} \
--install-dir /usr \
--data-dir ${DATADIR} \
--hostname $(hostname) \
--uid-ignore \
--dest-dir "${D%/}" \
--html-dir ${MY_HTDOCSDIR}/image \
--html-dir-url /image \
--cgi-dir ${MY_HTDOCSDIR} \
--fhs \
${myconf} || die "failed the configure.pl script"

ebegin "Installing documentation"

pod2man \
--section=8 \
--center="BackupPC manual" \
"${S}"/doc/BackupPC.pod backuppc.8 || die "failed to generate man page"

doman backuppc.8

# Place the documentation in the correct location
dodoc "${D}/usr/doc/BackupPC.html"
dodoc "${D}/usr/doc/BackupPC.pod"
rm -rf "${D}/usr/doc"

eend 0

# Setup directories
dodir ${CONFDIR}/pc

keepdir ${CONFDIR}
keepdir ${CONFDIR}/pc
keepdir ${DATADIR}/{trash,pool,pc,cpool}
keepdir ${LOGDIR}

ebegin "Setting up init.d/conf.d scripts"
newinitd "${S}"/init.d/gentoo-backuppc backuppc
newconfd "${S}"/init.d/gentoo-backuppc.conf backuppc
eend 0

ebegin "Setting up an apache instance for backuppc"

cp "${FILESDIR}/apache2-backuppc."{conf,init} "${WORKDIR}/"
cp "${FILESDIR}/httpd.conf" "${WORKDIR}/httpd.conf"
sed -i -e "s+HTDOCSDIR+${MY_HTDOCSDIR}+g" "${WORKDIR}/httpd.conf"
sed -i -e "s+AUTHFILE+${CONFDIR}/users.htpasswd+g" "${WORKDIR}/httpd.conf"

moduledir="/usr/lib/apache2/modules"

# Check if the Apache ServerRoot is real.
# This is sometimes broken on older amd64 systems.
# In this case we just patch our config file appropriately.
if [[ ! -d "/usr/lib/apache2" ]]; then
if [[ -d "/usr/lib64/apache2" ]]; then
sed -i -e "s+/usr/lib/apache2+/usr/lib64/apache2+g" "${WORKDIR}/httpd.conf"
sed -i -e "s+/usr/lib/apache2+/usr/lib64/apache2+g" "${WORKDIR}/apache2-backuppc.conf"
moduledir="/usr/lib64/apache2/modules"
fi
fi

# Check if we're using mod_cgid instead of mod_cgi
# This happens if you install apache with USE="threads"
if [[ -f "${moduledir}/mod_cgid.so" ]]; then
sed -i -e "s+mod_cgi+mod_cgid+g" "${WORKDIR}/httpd.conf"
sed -i -e "s+cgi_module+cgid_module+g" "${WORKDIR}/httpd.conf"
fi

# Install conf.d/init.d files for apache2-backuppc
if [ -e /etc/init.d/apache2 ]; then
newconfd "${WORKDIR}/apache2-backuppc.conf" apache2-backuppc
newinitd /etc/init.d/apache2 apache2-backuppc
else
newconfd "${WORKDIR}/apache2-backuppc.conf" apache2-backuppc
newinitd "${WORKDIR}/apache2-backuppc.init" apache2-backuppc
fi

insopts -m 0644
insinto ${CONFDIR}
doins "${WORKDIR}/httpd.conf"

eend $?

webapp_src_install || die "webapp_src_install"

# Make sure that the ownership is correct
chown -R backuppc:backuppc "${D}${CONFDIR}"
chown -R backuppc:backuppc "${D}${DATADIR}"
chown -R backuppc:backuppc "${D}${LOGDIR}"
}

pkg_postinst() {
# This is disabled since BackupPC doesn't need it
# webapp_pkg_postinst

elog "Installation finished, now may now start using BackupPC."
elog ""
elog "- Read the documentation in /usr/share/doc/${PF}/BackupPC.html"
elog " Please pay special attention to the security section."
elog ""
elog "- You can launch backuppc and it's apache web interface by running:"
elog " # /etc/init.d/backuppc start"
elog " # /etc/init.d/apache2-backuppc start"
elog ""
elog "- You also might want to add these scripts to your default runlevel:"
elog " # rc-update add backuppc default"
elog " # rc-update add apache2-backuppc default"

# Generate a new password if there's no auth file
if [[ ! -f "${CONFDIR}/users.htpasswd" ]]; then
adminuser="backuppc"
adminpass=$( makepasswd --chars=12 )
htpasswd -bc "${CONFDIR}/users.htpasswd" $adminuser $adminpass

elog ""
elog "- Created admin user $adminuser with password $adminpass"
elog " To add new users, run: "
elog " # htpasswd ${CONFDIR}/users.htpasswd newUser"
fi

if [[ -d "/etc/backuppc" ]]; then
ewarn ""
ewarn "Detected old config directory in /etc/backuppc"
ewarn "Please migrate relevant config files to ${CONFDIR} before starting backuppc"
fi
}
9 changes: 9 additions & 0 deletions app-backup/backuppc/files/06-pidfile-dir.patch
@@ -0,0 +1,9 @@
--- init.d/src/gentoo-backuppc.conf.orig 2009-10-18 00:14:52.513347638 +0300
+++ init.d/src/gentoo-backuppc.conf 2009-11-16 17:54:59.021348107 +0200
@@ -1,5 +1,5 @@
CONF_FILE=__CONFDIR__/config.pl
USER=__BACKUPPCUSER__
-PID_FILE=__LOGDIR__/BackupPC.pid
+PID_FILE=/var/run/BackupPC.pid
EXEC=__INSTALLDIR__/bin/BackupPC
EXEC_OPTIONS=-d

0 comments on commit c8c055d

Please sign in to comment.