Index: trunk/dbzip2/dbzip2d.spec |
— | — | @@ -0,0 +1,49 @@ |
| 2 | +Summary: Distributed bzip2 file compression daemon. |
| 3 | +Name: dbzip2d |
| 4 | +Version: 0.0.1 |
| 5 | +Release: 1 |
| 6 | +Copyright: BSD |
| 7 | +Group: Applications/File |
| 8 | +Source: dbzip2-%{version}.tar.gz |
| 9 | +BuildRoot: /var/tmp/%{name}-buildroot |
| 10 | +BuildArch: noarch |
| 11 | +Requires: bzip2, python |
| 12 | + |
| 13 | +%description |
| 14 | +dbzip2d is the network daemon component of dbzip2, a utility for |
| 15 | +compressing files in bzip2 format using multiple local and network |
| 16 | +threads. |
| 17 | + |
| 18 | +%prep |
| 19 | +%setup -q -n dbzip2-%{version} |
| 20 | + |
| 21 | +%build |
| 22 | +echo "Nothing to build." |
| 23 | + |
| 24 | +%install |
| 25 | +rm -rf $RPM_BUILD_ROOT |
| 26 | +install -d "$RPM_BUILD_ROOT/usr/lib/dbzip2d" |
| 27 | +install -m 0644 DistBits.py "$RPM_BUILD_ROOT/usr/lib/dbzip2d/DistBits.py" |
| 28 | +install -m 0644 dbzip2d "$RPM_BUILD_ROOT/usr/lib/dbzip2d/dbzip2d" |
| 29 | +install -d "$RPM_BUILD_ROOT/usr/bin" |
| 30 | +echo 'exec /usr/bin/python /usr/lib/dbzip2d/dbzip2d "$@"' > "$RPM_BUILD_ROOT/usr/bin/dbzip2d" |
| 31 | +chmod 0755 "$RPM_BUILD_ROOT/usr/bin/dbzip2d" |
| 32 | +install -d "$RPM_BUILD_ROOT/etc/init.d" |
| 33 | +install -m 0755 dbzip2d.service "$RPM_BUILD_ROOT/etc/init.d/dbzip2d" |
| 34 | + |
| 35 | +%clean |
| 36 | +rm -rf $RPM_BUILD_ROOT |
| 37 | + |
| 38 | +%files |
| 39 | +%defattr(-,root,root) |
| 40 | +%dir /usr/lib/dbzip2d |
| 41 | + |
| 42 | +/etc/init.d/dbzip2d |
| 43 | +/usr/bin/dbzip2d |
| 44 | +/usr/lib/dbzip2d |
| 45 | +/usr/lib/dbzip2d/dbzip2d |
| 46 | +/usr/lib/dbzip2d/DistBits.py |
| 47 | + |
| 48 | +%changelog |
| 49 | +* Tue May 30 2006 Brion Vibber <brion@pobox.com> |
| 50 | +- Initial packaging. |
Index: trunk/dbzip2/Makefile |
— | — | @@ -1,9 +1,26 @@ |
2 | | -.PHONY: all clean test |
| 2 | +.PHONY: all clean test rpm |
3 | 3 | |
| 4 | +VERSION=0.0.1 |
| 5 | + |
| 6 | +DISTFILES=\ |
| 7 | +BitShifter.py\ |
| 8 | +DistBits.py\ |
| 9 | +Makefile\ |
| 10 | +README\ |
| 11 | +dbzip2\ |
| 12 | +dbzip2d\ |
| 13 | +dbzip2d.service\ |
| 14 | +dbzip2d.spec\ |
| 15 | +dbzutil-module.c\ |
| 16 | +dbzutil-setup.py\ |
| 17 | +dbzutil-test.py\ |
| 18 | +sigcheck.py |
| 19 | + |
4 | 20 | all: dbzutil.so |
5 | 21 | |
6 | 22 | clean: |
7 | 23 | rm -f dbzutil.so |
| 24 | + rm -f dbzip2-$(VERSION).tar.gz |
8 | 25 | |
9 | 26 | test: dbzutil.so |
10 | 27 | python dbzutil-test.py |
— | — | @@ -11,3 +28,17 @@ |
12 | 29 | |
13 | 30 | dbzutil.so: dbzutil-module.c dbzutil-setup.py |
14 | 31 | python dbzutil-setup.py build_ext -i |
| 32 | + |
| 33 | +dist: dbzip2-$(VERSION).tar.gz |
| 34 | + |
| 35 | +dbzip2-$(VERSION).tar.gz: $(DISTFILES) |
| 36 | + rm -rf tarbuild |
| 37 | + mkdir tarbuild |
| 38 | + mkdir tarbuild/dbzip2-$(VERSION) |
| 39 | + cp -p $(DISTFILES) tarbuild/dbzip2-$(VERSION) |
| 40 | + cd tarbuild && tar zcvf ../dbzip2-$(VERSION).tar.gz dbzip2-$(VERSION)/ |
| 41 | + rm -rf tarbuild |
| 42 | + |
| 43 | +rpm: dist dbzip2d.spec |
| 44 | + cp -p dbzip2-$(VERSION).tar.gz /usr/src/redhat/SOURCES/ |
| 45 | + rpmbuild -ba dbzip2d.spec |
Index: trunk/dbzip2/dbzip2d.service |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +#!/bin/sh |
| 3 | + |
| 4 | +SERVICE_NAME="dbzip2d" |
| 5 | +SERVICE_LOCK="/var/run/dbzip2d.pid" |
| 6 | + |
| 7 | +RUN_SCRIPT="/usr/bin/dbzip2d" |
| 8 | + |
| 9 | +export PATH=$PATH:/usr/local/bin |
| 10 | + |
| 11 | +case "$1" in |
| 12 | + start) |
| 13 | + echo -n "Starting $SERVICE_NAME... " |
| 14 | + if [ -f $SERVICE_LOCK ]; then |
| 15 | + echo "Already running on" `cat $SERVICE_LOCK` |
| 16 | + else |
| 17 | + ($RUN_SCRIPT -d --pid-file="$SERVICE_LOCK" && echo "Done") || rm -f "$SERVICE_LOCK" |
| 18 | + fi |
| 19 | + ;; |
| 20 | + stop) |
| 21 | + echo -n "Shutting down $SERVICE_NAME... " |
| 22 | + if [ -f $SERVICE_LOCK ]; then |
| 23 | + kill `cat $SERVICE_LOCK` && sleep 1 && echo "Done" |
| 24 | + rm -f "$SERVICE_LOCK" |
| 25 | + else |
| 26 | + echo "Not running." |
| 27 | + fi |
| 28 | + ;; |
| 29 | + restart) |
| 30 | + "$0" stop |
| 31 | + sleep 1 |
| 32 | + "$0" start |
| 33 | + ;; |
| 34 | + status) |
| 35 | + echo -n "Checking for $SERVICE_NAME... " |
| 36 | + test -f $SERVICE_LOCK && echo Running on `cat $SERVICE_LOCK` || echo |
| 37 | + "Not running." |
| 38 | + ;; |
| 39 | + *) |
| 40 | + echo "Usage: $0 {start|stop|status|restart}" |
| 41 | + exit 1 |
| 42 | + ;; |
| 43 | +esac |