# HG changeset patch # User Pascal Bellard # Date 1300263192 -3600 # Node ID 118babc9679f6e6b5a28f7144227d9911552c6b2 # Parent 84e5f2e10ea60c85bd5a7cd7d0bba8795482251d Add backuppc diff -r 84e5f2e10ea6 -r 118babc9679f backuppc/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/backuppc/receipt Wed Mar 16 09:13:12 2011 +0100 @@ -0,0 +1,74 @@ +# SliTaz package receipt. + +PACKAGE="backuppc" +SOURCE="BackupPC" +VERSION="3.2.0" +CATEGORY="network" +SHORT_DESC="high-performance, enterprise-grade system for backing up Linux" +MAINTAINER="pascal.bellard@slitaz.org" +TARBALL="$SOURCE-$VERSION.tar.gz" +WEB_SITE="http://backuppc.sourceforge.net/" +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" +DEPENDS="tar perl-file-rsync perl perl-compress-raw-zlib perl-archive-zip \ +rsync bzip2 apache-mod-perl perl-xml-rss perl-net-ftp \ +perl-net-ftp-retrhandle perl-net-ftp-autoreconnect smbclient samba postfix \ +bzip2 openssh perl-lwp-useragent" +BUILD_DEPENDS="par2" +SUGGESTED="par2" +CONFIG_FILES="/etc/BackupPC/config.pl" + +# Rules to configure and make the package. +compile_rules() +{ + cd $src + mkdir -p $PWD/_pkg/etc/apache/conf.d + cp httpd/BackupPC.conf $PWD/_pkg/etc/apache/conf.d + perl configure.pl --batch --dest-dir=$PWD/_pkg --install-dir=/usr \ + --data-dir=/var/lib/BackupPC --config-dir=/etc/BackupPC \ + --log-dir=/var/log/BackupPC --backuppc-user=www \ + --hostname=localhost --html-dir=/usr/share/BackupPC/www \ + --html-dir-url=/BackupPC/img --cgi-dir=/usr/share/BackupPC/cgi +} + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + cp -a $_pkg/* $fs + cp -a stuff/* $fs + sed -i -e "s/''http/'http/;s/min''/min'/" \ + -e 's/-E -N -d/-E -d/' \ + -e "s/^\\\$Conf{CgiAdminUsers}.*/\$Conf{CgiAdminUsers} = 'root';/" \ + -e 's|sshPath -q -x|sshPath -i /etc/BackupPC/.ssh/id_rsa -q -x|' \ + $fs/etc/BackupPC/config.pl + chown www.www $fs/etc/BackupPC/config.pl + chmod 755 $fs/etc $fs/var $fs/var/* +} + +post_install() +{ + grep -qs backuppc $1/etc/rcS.conf || + sed -i 's/^RUN_DAEMONS="/RUN_DAEMONS="backuppc /' $1/etc/rcS.conf + loc=$LANG + [ -s $1/usr/lib/BackupPC/Lang/$loc.pm ] || loc=${loc:0:2} + [ -s $1/usr/lib/BackupPC/Lang/$loc.pm ] && + sed -i "s/'en'/'$loc'/" $1/etc/BackupPC/config.pl + [ -x /usr/bin/par2 ] && + sed -i 's/{ArchivePar} =.*/{ArchivePar} = 5;/' $1/etc/BackupPC/config.pl + if [ ! -d $1/etc/BackupPC/.ssh ]; then + mkdir $1/etc/BackupPC/.ssh + ssh-keygen -t rsa -f $1/etc/BackupPC/.ssh/id_rsa -C '' -N '' + fi + if [ -z "$1" ]; then + /etc/init.d/apache stop + sleep 2 + /etc/init.d/backuppc start + /etc/init.d/apache start + fi + cat </dev/null && break + sleep 10 +done diff -r 84e5f2e10ea6 -r 118babc9679f backuppc/stuff/etc/init.d/backuppc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/backuppc/stuff/etc/init.d/backuppc Wed Mar 16 09:13:12 2011 +0100 @@ -0,0 +1,64 @@ +#!/bin/sh +# /etc/init.d/backuppc: Start, stop and restart backuppc daemon on SliTaz, at boot +# time or with the command line. +# +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. +# +. /etc/init.d/rc.functions +. /etc/daemons.conf + +NAME=BackupPC +DESC="backuppc deamon" +DAEMON=/usr/bin/BackupPC +OPTIONS=$BACKUPPC_OPTIONS +[ -n "$OPTIONS" ] || OPTIONS="-d" +PIDFILE=/var/run/backuppc.pid + +case "$1" in + start) + if active_pidfile $PIDFILE $NAME ; then + echo "$NAME already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + su -s /bin/sh -c "$DAEMON $OPTIONS" www + pidof $NAME | awk '{ print $1 }' > $PIDFILE + status + ;; + stop) + if ! active_pidfile $PIDFILE $NAME ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill `cat $PIDFILE` + rm $PIDFILE + status + ;; + restart) + if ! active_pidfile $PIDFILE $NAME ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill `cat $PIDFILE` + rm $PIDFILE + sleep 2 + su -c "$DAEMON $OPTIONS" www + pidof $NAME | awk '{ print $1 }' > $PIDFILE + status + ;; + reload) + kill -1 `cat $PIDFILE` + status + ;; + *) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0