[Box Backup] BoxBackup 0,08 SUSE Linux packages

Chris Smith boxbackup@fluffy.co.uk
Fri, 1 Oct 2004 13:20:57 +1200


--Boundary-00=_5DLXB8LRwzQczG6
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Please see comments inline...

On Saturday 25 September 2004 00:37, Martin Ebourne wrote:
> Cool. I've incorporated all of your changes back into the stuff I had
> and made the rpm spec automatically work out what distro it is building
> on and behave accordingly. The Grand Unified RPM Patch is included. ;)

Works fine, I've made a few changes to iron out a few remote cases. Please 
check the attached patch to see if it's all go.

> Ah, yes, some late cleanup broke that. Doh! I've changed it to
> /var/empty. If SUSE doesn't have that can you pick something suitable.

Done.

> One question though, from
> my reading of http://www.suse.de/~mmj/Package-Conventions/ it would
> appear that there should be some calls to insserv, and that the
> rcbbackupd etc scripts need to be symlinked by the package. Is this
> correct or is that out of date?

Okay, I've changed that. I've added the symlink for the /usr/sbin/rc* . About 
the insserv calls, as far as I can tell chkconfig in SUSE is a frontend to 
insserv and it seems to work fine here so we can probably leave it as it is.

Attached is the .spec patch (-u) and the updated SUSE init scripts a bit 
cleaned up and working.

BUG: I get this when uninstalling the client: 
"warning: /etc/init.d/bbackupd saved as /etc/init.d/bbackupd.rpmsave"
It's leaving junk in the filesystem, but I'm quite inexperienced with RPM, is 
there another directive you can use for  that file?

Cheers,
Chris.

--Boundary-00=_5DLXB8LRwzQczG6
Content-Type: application/x-shellscript;
  name="bbackupd"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="bbackupd"

#!/bin/sh
#
# Copyright (c)2004, Nothing But Net Limited
#	<chris.smith@nothingbutnet.co.nz>
#
######################################################################
# RELEASED AND PROVIDED TO YOU UNDER THE SAME LICENCE AS THE BOXBACKUP
# SUITE OF PROGRAMS. LICENCE MAY BE VIEWED HERE:
#
# http://www.fluffy.co.uk/boxbackup/license.html
######################################################################
#
# /etc/init.d/bbackupd
#   and its symbolic link
# /(usr/)sbin/rcbbackupd
#
### BEGIN INIT INFO
# Provides:          bbackupd
# Required-Start:    $named $network $local_fs $syslog
# X-UnitedLinux-Should-Start: $time ypbind sendmail
# Required-Stop:     $named $network $localfs $syslog
# X-UnitedLinux-Should-Stop: $time ypbind sendmail
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: BoxBackup client side daemon
# Description: Client daemon for the BoxBackup software       
#	that allows you to communicate with a bbstored server.
### END INIT INFO

# Check for missing binaries (stale symlinks should not happen)
BBACKUPD_BIN=/usr/bin/bbackupd
if [ ! -x $BBACKUPD_BIN ] ; then
	echo "$BBACKUPD_BIN not installed"
	exit 5
fi

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
	start)
		echo -n "Starting bbackupd "
		startproc $BBACKUPD_BIN
		rc_status -v
		;;
		
    stop)
		echo -n "Shutting down bbackupd "
		killproc -TERM $BBACKUPD_BIN
		rc_status -v
		;;

    try-restart|condrestart)
		if test "$1" = "condrestart"; then
			echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
		fi
		$0 status
		if test $? = 0; then
			$0 restart
		else
			rc_reset	# Not running is not a failure.
		fi
		rc_status
		;;
	
    restart)
		$0 stop
		$0 start
		rc_status
		;;

    force-reload)
		echo -n "Reload service bbackupd "
		killproc -HUP $BBACKUPD_BIN
		rc_status -v
		;;

    reload)
		echo -n "Reload service bbackupd  "
		killproc -HUP $BBACKUPD_BIN
		rc_status -v
		;;

    status)
		echo -n "Checking for service bbackupd "
		checkproc $BBACKUPD_BIN
		rc_status -v
		;;

    probe)
		test /etc/box/bbackupd.conf -nt /var/run/bbackupd.pid && echo reload
		;;
	
    *)
		echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
		exit 1

esac
rc_exit

--Boundary-00=_5DLXB8LRwzQczG6
Content-Type: text/x-diff;
  charset="utf-8";
  name="spec.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="spec.diff"

--- boxbackup.spec.old	2004-09-30 15:08:03.000000000 +1200
+++ boxbackup.spec	2004-10-01 13:10:25.187046016 +1200
@@ -99,6 +99,10 @@
 # Client
 touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbackupd.conf
 install -m 755 contrib/%{dist}/bbackupd $RPM_BUILD_ROOT%{init_dir}
+%if %{is_suse}
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+ln -s ../../%{init_dir}/bbackupd $RPM_BUILD_ROOT/usr/sbin/rcbbackupd
+%endif
 %define client_dir parcels/%{ident}-backup-client-Linux
 install %{client_dir}/bbackupd $RPM_BUILD_ROOT%{_bindir}
 install %{client_dir}/bbackupquery $RPM_BUILD_ROOT%{_bindir}
@@ -109,6 +113,10 @@
 touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbstored.conf
 touch $RPM_BUILD_ROOT%{_sysconfdir}/box/raidfile.conf
 install -m 755 contrib/%{dist}/bbstored $RPM_BUILD_ROOT%{init_dir}
+%if %{is_suse}
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+ln -s ../../%{init_dir}/bbstored $RPM_BUILD_ROOT/usr/sbin/rcbbstored
+%endif
 %define server_dir parcels/%{ident}-backup-server-Linux
 install %{server_dir}/bbstored $RPM_BUILD_ROOT%{_bindir}
 install %{server_dir}/bbstoreaccounts $RPM_BUILD_ROOT%{_bindir}
@@ -117,6 +125,7 @@
 install %{server_dir}/raidfile-config $RPM_BUILD_ROOT%{_bindir}
 
 %pre server
+mkdir -p /var/empty
 /usr/sbin/useradd -c "Box Backup" -u %{bb_user_id} \
 	-s /sbin/nologin -r -d %{_var}/empty box 2> /dev/null || :
 
@@ -162,6 +171,9 @@
 %dir %attr(755,root,root) %{_var}/lib/box
 %doc %{_docdir}/%{ident}/*.txt
 %config %{init_dir}/bbackupd
+%if %{is_suse}
+/usr/sbin/rcbbackupd
+%endif
 %config %ghost %{_sysconfdir}/box/bbackupd.conf
 %{_bindir}/bbackupd
 %{_bindir}/bbackupquery
@@ -172,6 +184,9 @@
 %defattr(-,root,root,-)
 %dir %attr(700,box,root) %{_sysconfdir}/box/bbstored
 %config %{init_dir}/bbstored
+%if %{is_suse}
+/usr/sbin/rcbbstored
+%endif
 %config %ghost %{_sysconfdir}/box/bbstored.conf
 %config %ghost %{_sysconfdir}/box/raidfile.conf
 %{_bindir}/bbstored

--Boundary-00=_5DLXB8LRwzQczG6
Content-Type: application/x-shellscript;
  name="bbstored"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="bbstored"

#!/bin/sh
#
# Copyright (c)2004, Nothing But Net Limited
#   <chris.smith@nothingbutnet.co.nz>
#
######################################################################
# RELEASED AND PROVIDED TO YOU UNDER THE SAME LICENCE AS THE BOXBACKUP
# SUITE OF PROGRAMS. LICENCE MAY BE VIEWED HERE:
#
# http://www.fluffy.co.uk/boxbackup/license.html
######################################################################
#
# /etc/init.d/bbackupd
#   and its symbolic link
# /(usr/)sbin/rcbbackupd
#
### BEGIN INIT INFO
# Provides:          bbackupd
# Required-Start:    $named $network $local_fs $syslog
# X-UnitedLinux-Should-Start: $time ypbind sendmail
# Required-Stop:     $named $network $localfs $syslog
# X-UnitedLinux-Should-Stop: $time ypbind sendmail
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: BoxBackup server side daemon
# Description: Client daemon for the BoxBackup software       
#	that allows you to communicate with a bbstored server.
### END INIT INFO
# 

# Check for missing binaries (stale symlinks should not happen)
BBACKUPD_BIN=/usr/bin/bbstored
if [ ! -x $BBACKUPD_BIN ] ; then
	echo "$BBACKUPD_BIN not installed"
	exit 5
fi

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
	start)
	echo -n "Starting bbstored "
	startproc $BBACKUPD_BIN
	rc_status -v
	;;
	
    stop)
	echo -n "Shutting down bstored "
	killproc -TERM $BBACKUPD_BIN
	rc_status -v
	;;

    try-restart|condrestart)
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset	# Not running is not a failure.
	fi
	rc_status
	;;
	
    restart)
	$0 stop
	$0 start
	rc_status
	;;

    force-reload)
	echo -n "Reload service bbstored "
	killproc -HUP $BBACKUPD_BIN
	rc_status -v
	;;

    reload)
	echo -n "Reload service bbstored  "
	killproc -HUP $BBACKUPD_BIN
	rc_status -v
	;;

    status)
	echo -n "Checking for service bbstored "
	checkproc $BBACKUPD_BIN
	rc_status -v
	;;

    probe)
	test /etc/box/bbstored.conf -nt /var/run/bbstored.pid && echo reload
	;;
	
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;

esac
rc_exit

--Boundary-00=_5DLXB8LRwzQczG6--