Added old backuppc 3.1.0 ebuild, and new -r1 ebuild taken from gentoo bug #287133

This commit is contained in:
2009-10-14 10:44:39 +00:00
parent 18a17551de
commit c14259a563
9 changed files with 1073 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
AUX Manifest 1563 RMD160 ef49fd1fb7531c66534825e72e775ac27732d22f SHA1 9d16c1aaae219cf0e0d612c7ed9b6a438b5412c6 SHA256 943bf82ee6e368ae6c35762555f8ffc701a7c3fe1e6779ce7a3092cb1efac314
AUX apache2-backuppc.conf 3064 RMD160 5eba0c1b294c67d421dedf325b81e86eb07080e3 SHA1 319be2c7f270e56d553fa2cf3fa873d15e3a0c67 SHA256 3f92aa053a411889faccc2cfd9ea65864de446cc28bcb32f0056ab37bb18fa4c
AUX apache2-backuppc.init 3800 RMD160 9a4a4c55671738447ef131480ca41506baf947b8 SHA1 6ffef133a0b523e4e0d428b8a5282632303d61a2 SHA256 a8b29805a82315f47e0b8e8583c530ba0e4c0b0393001bed4cd2759c2a0c6bb9
AUX fixperms 346 RMD160 39d6e106a3bfa2a4334669d6805a9957b89568e5 SHA1 2640b3a4051329c1d26338b4249a8f745600c2b6 SHA256 e02650bbc126e89aa3abd3a6ecb0300ccbab9e730472f9c4821e47e8139c4c5d
AUX httpd.conf 12111 RMD160 f0634267afcc5e3246699e8e9235b3c64a19c3e4 SHA1 efd4fa124bae05ec4c4f7c181add7ccd70156e16 SHA256 5c19a8faa28a0a2e28a281a4131eb99987720e1120678803bbe99c0ca08c3658
AUX postinstall-en.txt 854 RMD160 8dc6eb81f9519b820baa2b63a59fc2362607045a SHA1 db15cfd9c3ed8b4f9c534495e28a293866af33f6 SHA256 2ce9a8cc59c3331875e34415f2d8b1a72927596622f35fe8f18dbacc17b8fd65
DIST BackupPC-3.1.0.tar.gz 474981 RMD160 22d4cb6dd76f846fde489a301852f50e8db1ae1d SHA1 3bd6d637f4f08f2fda44a12668b91d47c4abb0a7 SHA256 49a2744cb9aaf27b298ec3d2e83e46fdb86fb3596922beb3904cb6ae552c148a
EBUILD backuppc-3.1.0-r1.ebuild 5983 RMD160 0eff96a9b8851a0400fca98941ca4f91b5b22fe2 SHA1 a06db0829e4679c7e6dbe54cfd281c4194cccd7f SHA256 3e4263b6f688efaff1d6109fa4b809ef0820c1bc76b9577b3fdb5eee70c8d560
EBUILD backuppc-3.1.0.ebuild 6522 RMD160 36347b875b9e7fad234cb75a85da5123bd08d786 SHA1 34d98ac932afc21c19bf095fe6ee6c31eb5a7ad0 SHA256 d208b3f9fdc6d216ca083f7096b7271a89b37b7965135ffa0835d077dda649f3

View File

@@ -0,0 +1,219 @@
# 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/${P}+" "lib/BackupPC/CGI/View.pm"
}
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/${P}/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
}

View File

@@ -0,0 +1,221 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils webapp
MY_P="BackupPC-${PV}"
DESCRIPTION="backup system for desktops to a servers disk"
HOMEPAGE="http://backuppc.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
LICENSE="GPL-2"
KEYWORDS="~amd64 x86"
IUSE="doc rsync samba"
DEPEND="dev-lang/perl"
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-servers/apache
rsync? ( >=dev-perl/File-RsyncP-0.68 )
rss? ( dev-perl/XML-RSS )
samba? ( net-fs/samba )"
# we really should install into a fixed slot otherwise upgrades will fail due to file collisions.
WEBAPP_MANUAL_SLOT="yes"
SLOT="0"
# detect if a previous installation exists and install into that slot to avoid file collisions.
oldslot=$( equery -C -N -q list -i backuppc )
oldslot=${oldslot##*(}
oldslot=${oldslot%%)*}
if [ "X$oldslot" != "X" ]; then
SLOT="$oldslot"
UPGRADE="true"
fi
S=${WORKDIR}/${MY_P}
migratedata="false"
DATADIR="/var/lib/BackupPC" #important: no trailing slash here!
pkg_setup() {
enewgroup backuppc
enewuser backuppc -1 -1 /dev/null backuppc
webapp_pkg_setup
}
src_unpack() {
unpack ${A}
cd "${S}"
sed -i -e "1s_/bin/perl_/usr/bin/perl_" configure.pl
}
src_test() {
einfo "Can not test"
}
src_install() {
local myconf
myconf=""
if use samba ; then
myconf="--bin-path smbclient=$(type -p smbclient)"
myconf="${myconf} --bin-path nmblookup=$(type -p nmblookup)"
fi
if [ $UPGRADE=="true" ]; then
oldconfdir=$( find /etc/ -name config.pl -ipath "*backuppc*" )
if [ "X$oldconfdir" != "X" ]; then
#stop the server, just in case
/etc/init.d/backuppc stop
oldconfdir="${oldconfdir%/*}"
#now make the old config files available for the new server
insopts -m 644
insinto /etc/BackupPC
doins "${oldconfdir}/config.pl"
doins "${oldconfdir}/hosts"
ewarn "This is an upgrade. The config dir is now /etc/BackupPC."
ewarn "If you are upgrading from a version prior to 3.x, you will have to carefully"
ewarn "Check the new config file and then delete /etc/backuppc"
fi
fi
webapp_src_preinst
einfo ${MY_HTDOCSDIR}
dodir ${MY_HTDOCSDIR}/${PN}
./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) \
--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"
pod2man \
--section=8 \
--center="BackupPC manual" \
"${S}"/doc/BackupPC.pod backuppc.8 || die "failed to generate man page"
doman backuppc.8
diropts -m 750
keepdir /var/log/BackupPC
keepdir /var/lib/BackupPC
diropts -m 755
keepdir /etc/BackupPC
newinitd "${S}"/init.d/gentoo-backuppc backuppc
newconfd "${S}"/init.d/gentoo-backuppc.conf backuppc
ebegin "setting up an apache instance for backuppc"
cp "${FILESDIR}/httpd.conf" "${WORKDIR}/httpd.conf"
cd "$WORKDIR"
sed -i -e "s+HTDOCSDIR+${MY_HTDOCSDIR}+g" "${WORKDIR}/httpd.conf"
sed -i -e "s+AUTHFILE+/etc/BackupPC/authUser+g" "${WORKDIR}/httpd.conf"
if [ -e /etc/init.d/apache2 ]; then
newconfd "${FILESDIR}/apache2-backuppc.conf" apache2-backuppc
newinitd /etc/init.d/apache2 apache2-backuppc
elif [ -e /etc/init.d/apache ]; then #not sure if this works, could someone please test?
newconfd "${FILESDIR}/apache2-backuppc.conf" apache-backuppc
newinitd /etc/init.d/apache apache-backuppc
else
newconfd "${FILESDIR}/apache2-backuppc.conf" apache2-backuppc
newinitd "${FILESDIR}/apache2-backuppc.init" apache2-backuppc
fi
insopts -m 644
insinto /etc/BackupPC
doins "${FILESDIR}"/authUser
doins "${WORKDIR}/httpd.conf"
eend $?
webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt || die "webapp_postinst_txt"
if [ $UPGRADE=="true" ]; then
ebegin "Trying to migrate datadir..."
if [ -e ${DATADIR} ] && [ ! -e /var/lib/backuppc ]; then
elog "Upgrading: seems like the datadir is already in the correct position."
i=0
elif [ -e ${DATADIR} ] && [ -e /var/lib/backuppc ]; then
ewarn "Upgrading: seems like you have both the old and the new datadir in your filesystem:"
ewarn "${DATADIR} and /var/lib/backuppc. Please make sure BackupPC finds its data in ${DATADIR}."
i=1
elif [ ! -e ${DATADIR} ] && [ -e /var/lib/backuppc ]; then
elog "Upgrading: will migrate /var/lib/backuppc to ${DATADIR} after installation"
migratedata="true"
i=0
fi
eend $i
fi
webapp_src_install || die "webapp_src_install"
}
pkg_postinst() {
webapp_pkg_postinst
if [ $UPGRADE=="true" ]; then
ebegin "executing data migration..."
if [ $migratedata == "true" ]; then
rm -rf "${DATADIR}"
mv /var/lib/backuppc "${DATADIR}"
elog "sucessfully migrated old data to ${DATADIR}"
fi
oldifs=$IFS
IFS='
'
for oldhostconfig in $( find "${DATADIR}/pc" -maxdepth 2 -name config.pl ); do
host=${oldhostconfig%/config.pl}; host=${host##*/}
newhostconfig="/etc/BackupPC/pc/${host}.pl"
if [ ! -e $newhostconfig ]; then
mv "$oldhostconfig" "$newhostconfig"
elog "Sucessfully moved config for ${host}"
else
elog "Config files for ${host} exist in both ${oldhostconfig} and ${newhostconfig}."
elog "Not migrating configs for ${host}"
fi
done
IFS=$oldifs
eend $?
fi
ebegin "Adjusting ownership of various things..."
chown -Rf backuppc:backuppc /etc/BackupPC
#chown -f root:apache /etc/BackupPC/authUser
chown -Rf backuppc:backuppc /var/log/BackupPC
chown -Rf backuppc:backuppc ${DATADIR}
chown -Rf backuppc:backuppc "${MY_HTDOCSDIR}"
eend $?
ebegin "making sure to not interfere with the standard apache installation"
rm -rf "${G_HTDOCSDIR}/${PN}"
eend $?
elog "Please read the documentation"
elog "you can start the server by typing:"
elog "/etc/init.d/backuppc start && /etc/init.d/apache2-backuppc start"
elog "afterwards you will be able to reach the web-frontend under the following address:"
elog "https://your-servers-ip-address:28000/BackupPC_Admin"
}

View File

@@ -0,0 +1,8 @@
DIST BackupPC-3.1.0.tar.gz 474981 RMD160 22d4cb6dd76f846fde489a301852f50e8db1ae1d SHA1 3bd6d637f4f08f2fda44a12668b91d47c4abb0a7 SHA256 49a2744cb9aaf27b298ec3d2e83e46fdb86fb3596922beb3904cb6ae552c148a
EBUILD backuppc-3.1.0.ebuild 6522 RMD160 36347b875b9e7fad234cb75a85da5123bd08d786 SHA1 34d98ac932afc21c19bf095fe6ee6c31eb5a7ad0 SHA256 d208b3f9fdc6d216ca083f7096b7271a89b37b7965135ffa0835d077dda649f3
MISC apache2-backuppc.conf 3064 RMD160 5eba0c1b294c67d421dedf325b81e86eb07080e3 SHA1 319be2c7f270e56d553fa2cf3fa873d15e3a0c67 SHA256 3f92aa053a411889faccc2cfd9ea65864de446cc28bcb32f0056ab37bb18fa4c
MISC apache2-backuppc.init 3800 RMD160 9a4a4c55671738447ef131480ca41506baf947b8 SHA1 6ffef133a0b523e4e0d428b8a5282632303d61a2 SHA256 a8b29805a82315f47e0b8e8583c530ba0e4c0b0393001bed4cd2759c2a0c6bb9
MISC attachment.cgi?id=194075 3064 RMD160 5eba0c1b294c67d421dedf325b81e86eb07080e3 SHA1 319be2c7f270e56d553fa2cf3fa873d15e3a0c67 SHA256 3f92aa053a411889faccc2cfd9ea65864de446cc28bcb32f0056ab37bb18fa4c
MISC fixperms 346 RMD160 39d6e106a3bfa2a4334669d6805a9957b89568e5 SHA1 2640b3a4051329c1d26338b4249a8f745600c2b6 SHA256 e02650bbc126e89aa3abd3a6ecb0300ccbab9e730472f9c4821e47e8139c4c5d
MISC httpd.conf 12111 RMD160 f0634267afcc5e3246699e8e9235b3c64a19c3e4 SHA1 efd4fa124bae05ec4c4f7c181add7ccd70156e16 SHA256 5c19a8faa28a0a2e28a281a4131eb99987720e1120678803bbe99c0ca08c3658
MISC postinstall-en.txt 854 RMD160 8dc6eb81f9519b820baa2b63a59fc2362607045a SHA1 db15cfd9c3ed8b4f9c534495e28a293866af33f6 SHA256 2ce9a8cc59c3331875e34415f2d8b1a72927596622f35fe8f18dbacc17b8fd65

View File

@@ -0,0 +1,73 @@
# /etc/conf.d/apache2: config file for /etc/init.d/apache2
# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
# AUTH_DIGEST Enables mod_auth_digest
# AUTHNZ_LDAP Enables authentication through mod_ldap (available if USE=ldap)
# CACHE Enables mod_cache
# DAV Enables mod_dav
# ERRORDOCS Enables default error documents for many languages.
# INFO Enables mod_info, a useful module for debugging
# LANGUAGE Enables content-negotiation based on language and charset.
# LDAP Enables mod_ldap (available if USE=ldap)
# MANUAL Enables /manual/ to be the apache manual (available if USE=docs)
# MEM_CACHE Enables default configuration mod_mem_cache
# PROXY Enables mod_proxy
# SSL Enables SSL (available if USE=ssl)
# SUEXEC Enables running CGI scripts (in USERDIR) through suexec.
# USERDIR Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
# DEFAULT_VHOST Enables name-based virtual hosts, with the default
# virtual host being in /var/www/localhost/htdocs
# SSL_DEFAULT_VHOST Enables default vhost for SSL (you should enable this
# when you enable SSL)
#
APACHE2_OPTS="-D LANGUAGE -D SSL -D SUEXEC -D PERL -D BACKUPPC_VHOST"
# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.
# PID file
PIDFILE=/var/run/apache2-backuppc.pid
# timeout for startup/shutdown checks
#TIMEOUT=10
# ServerRoot setting
SERVERROOT=/usr/lib/apache2
# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
CONFIGFILE=/etc/BackupPC/httpd.conf
# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"
# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"
# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"

View File

@@ -0,0 +1,170 @@
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="configdump configtest fullstatus graceful gracefulstop modules reload virtualhosts"
depend() {
need net
use mysql dns logger netmount postgresql
after sshd
}
configtest() {
ebegin "Checking ${SVCNAME} configuration"
checkconfig
eend $?
}
checkconfd() {
PIDFILE="${PIDFILE:-/var/run/apache2-backuppc.pid}"
TIMEOUT=${TIMEOUT:-10}
SERVERROOT="${SERVERROOT:-/usr/lib/apache2}"
if [ ! -d ${SERVERROOT} ]; then
eerror "SERVERROOT does not exist: ${SERVERROOT}"
return 1
fi
CONFIGFILE="${CONFIGFILE:-/etc/BackupPC/httpd.conf}"
[ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
if [ ! -r "${CONFIGFILE}" ]; then
eerror "Unable to read configuration file: ${CONFIGFILE}"
return 1
fi
APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}"
APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"
[ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}"
APACHE2="/usr/sbin/apache2"
}
checkconfig() {
checkconfd || return 1
${APACHE2} ${APACHE2_OPTS} -t 1>/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
eerror "${SVCNAME} has detected a syntax error in your configuration files:"
${APACHE2} ${APACHE2_OPTS} -t
fi
return $ret
}
start() {
checkconfig || return 1
[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
ebegin "Starting ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k start
let i=0
while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do
sleep 1 && i=$(expr $i + 1)
done
test $i -le ${TIMEOUT}
eend $?
}
stop() {
checkconfd || return 1
ebegin "Stopping ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k stop
let i=0
while pidof "${APACHE2}" >/dev/null && [ $i -lt ${TIMEOUT} ]; do
sleep 1 && i=$(expr $i + 1)
done
test $i -le ${TIMEOUT}
eend $?
}
reload() {
RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
checkconfig || return 1
service_started "${SVCNAME}" || return
if [ "${RELOAD_TYPE}" = "restart" ]; then
ebegin "Restarting ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k restart
eend $?
elif [ "${RELOAD_TYPE}" = "graceful" ]; then
ebegin "Gracefully restarting ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k graceful
eend $?
else
eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}"
fi
}
graceful() {
checkconfig || return 1
service_started "${SVCNAME}" || return
ebegin "Gracefully restarting ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k graceful
eend $?
}
gracefulstop() {
checkconfig || return 1
# zap!
if service_started "${SVCNAME}"; then
mark_service_stopped "${SVCNAME}"
fi
ebegin "Gracefully stopping ${SVCNAME}"
${APACHE2} ${APACHE2_OPTS} -k graceful-stop
eend $?
}
modules() {
checkconfig || return 1
${APACHE2} ${APACHE2_OPTS} -M 2>&1
}
fullstatus() {
LYNX="${LYNX:-lynx -dump}"
STATUSURL="${STATUSURL:-http://localhost/server-status}"
if ! service_started "${SVCNAME}"; then
eerror "${SVCNAME} not started"
elif ! type -p ${LYNX} 2>&1 >/dev/null; then
eerror "lynx not found! you need to emerge www-client/lynx"
else
${LYNX} ${STATUSURL}
fi
}
virtualhosts() {
checkconfd || return 1
${APACHE2} ${APACHE2_OPTS} -S
}
configdump() {
LYNX="${LYNX:-lynx -dump}"
INFOURL="${INFOURL:-http://localhost/server-info}"
checkconfd || return 1
if ! service_started "${SVCNAME}"; then
eerror "${SVCNAME} not started"
elif ! type -p ${LYNX} 2>&1 >/dev/null; then
eerror "lynx not found! you need to emerge www-client/lynx"
else
echo "${APACHE2} started with '${APACHE2_OPTS}'"
for i in config server list; do
${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
done
fi
}
# vim: ts=4 filetype=gentoo-init-d

View File

@@ -0,0 +1,19 @@
Options +execCGI
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
AuthType Basic
AuthName "BackupPC cgi interface"
AuthUserFile /etc/BackupPC/authUser
Require valid-user
Allow from all
<Files BackupPC_Admin>
Order allow,deny
Deny from all
</Files>
<Files .htaccess>
Order allow,deny
Deny from all
</Files>

View File

@@ -0,0 +1,332 @@
# This is a modification of the default Apache 2.2 configuration file
# for Gentoo Linux.
#
# Support:
# http://www.gentoo.org/main/en/lists.xml [mailing lists]
# http://forums.gentoo.org/ [web forums]
# irc://irc.freenode.net#gentoo-apache [irc chat]
#
# Bug Reports:
# http://bugs.gentoo.org [gentoo related bugs]
# http://httpd.apache.org/bug_report.html [apache httpd related bugs]
#
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "var/log/apache2/foo_log"
# with ServerRoot set to "/usr" will be interpreted by the
# server as "/usr/var/log/apache2/foo.log".
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
ServerRoot "/usr/lib/apache2"
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
# GENTOO: Automatically defined based on APACHE2_MODULES USE_EXPAND variable.
# Do not change manually, it will be overwritten on upgrade.
#
# The following modules are considered as the default configuration.
# If you wish to disable one of them, you may have to alter other
# configuration directives.
#
# Change these at your own risk!
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
<IfDefine AUTH_DIGEST>
LoadModule auth_digest_module modules/mod_auth_digest.so
</IfDefine>
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
<IfDefine CACHE>
LoadModule cache_module modules/mod_cache.so
</IfDefine>
LoadModule cgi_module modules/mod_cgi.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
<IfDefine CACHE>
LoadModule disk_cache_module modules/mod_disk_cache.so
</IfDefine>
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
<IfDefine CACHE>
LoadModule file_cache_module modules/mod_file_cache.so
</IfDefine>
LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
<IfDefine INFO>
LoadModule info_module modules/mod_info.so
</IfDefine>
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
<IfDefine CACHE>
LoadModule mem_cache_module modules/mod_mem_cache.so
</IfDefine>
LoadModule mime_module modules/mod_mime.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
<IfDefine PROXY>
LoadModule proxy_module modules/mod_proxy.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_connect_module modules/mod_proxy_connect.so
</IfDefine>
<IfDefine PROXY>
LoadModule proxy_http_module modules/mod_proxy_http.so
</IfDefine>
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule speling_module modules/mod_speling.so
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
<IfDefine STATUS>
LoadModule status_module modules/mod_status.so
</IfDefine>
<IfDefine SUEXEC>
LoadModule suexec_module modules/mod_suexec.so
</IfDefine>
LoadModule unique_id_module modules/mod_unique_id.so
<IfDefine USERDIR>
LoadModule userdir_module modules/mod_userdir.so
</IfDefine>
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User backuppc
Group backuppc
# Supplemental configuration
#
# Most of the configuration files in the /etc/apache2/modules.d/ directory can
# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features
# or to modify the default configuration of the server.
#
# To know which flag to add to APACHE2_OPTS, look at the first line of the
# the file, which will usually be an <IfDefine OPTION> where OPTION is the
# flag to use.
Include /etc/apache2/modules.d.backuppc/*.conf
# Unique lock file
LockFile /var/lock/apache-backuppc.lock
# Very important for init script
# Unique process ID file
PidFile /var/run/apache-backuppc.pid
# Unique scoreboard file
ScoreBoardFile /var/run/apache-backuppc.scoreboard
# Common document root
<IfDefine BACKUPPC_VHOST>
# Common document root
DocumentRoot HTDOCSDIR
# see bug #178966 why this is in here
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 28000
# Use name-based virtual hosting.
NameVirtualHost *:28000
# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
<VirtualHost *:28000>
ServerName backuppc
<IfDefine SSL>
<IfModule ssl_module>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
## SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLOptions +StrictRequire
## SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
## Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If the certificate
# is encrypted, then you will be prompted for a pass phrase. Note that a
# kill -HUP will prompt again. Keep in mind that if you have both an RSA
# and a DSA certificate you can configure both in parallel (to also allow
# the use of DSA ciphers, etc.)
SSLCertificateFile /etc/apache2/ssl/server.crt
#SSLCertificateFile /etc/apache2/ssl/server-dsa.crt
## Server Private Key:
# If the key is not combined with the certificate, use this directive to
# point at the key file. Keep in mind that if you've both a RSA and a DSA
# private key you can configure both in parallel (to also allow the use of
# DSA ciphers, etc.)
SSLCertificateKeyFile /etc/apache2/ssl/server.key
#SSLCertificateKeyFile /etc/apache2/ssl/server-dsa.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
## ssl-accurate-shutdown:
# This forces an accurate shutdown when the connection is closed, i.e. a
# SSL close notify alert is send and mod_ssl waits for the close notify
# alert of the client. This is 100% SSL/TLS standard compliant, but in
# practice often causes hanging connections with brain-dead browsers. Use
# this only for browsers where you know that their SSL implementation works
# correctly.
# Notice: Most problems of broken clients are also related to the HTTP
# keep-alive facility, so you usually additionally want to disable
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
# "force-response-1.0" for this.
<IfModule setenvif_module>
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</IfModule>
## Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a compact
# non-error SSL logfile on a virtual host basis.
<IfModule log_config_module>
CustomLog /var/log/apache2/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>
</IfModule>
</IfDefine>
<Directory "HTDOCSDIR">
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
Options Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride None
<IfDefine SSL>
<IfModule ssl_module>
SSLOptions +StdEnvVars
</IfModule>
</IfDefine>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order deny,allow
Deny from all
Allow from 192.168.0
AuthName "Backup Admin"
AuthType Basic
AuthUserFile AUTHFILE
Require valid-user
</Directory>
<Directory "HTDOCSDIR/image">
SetHandler None
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment backuppc backuppc
</IfModule>
</VirtualHost>
</IfDefine>
# vim: ts=4 filetype=apache

View File

@@ -0,0 +1,22 @@
The default username and password are both backuppc. Edit
/etc/BackupPC/authUser to change these to your preferred values using the
htpasswd2 utility, such as:
# htpasswd2 -c /etc/BackupPC/authUser admin
This will prompt you for a new password and change the username to admin.
\`man htpasswd' for more options.
Please make sure to edit /etc/BackupPC/config.pl to suit your needs. If you
change the username or want the backuppc user to have admin rights in the web
interface be sure to change \$Conf{CgiAdminUsers} to the correct value.
To add backuppc to your default startup scripts run:
# rc-update add backuppc default
# rc-update add apache2-backuppc default
Then start it with:
# /etc/init.d/backuppc start
# /etc/init.d/apache2-backuppc start
Navigate using your webbrowser to http://localhost:28000/BackupPC_Admin
for the web interface.