# HG changeset patch # User Christophe Lincoln # Date 1305465678 -7200 # Node ID 9ee293e7935924d0f322ddca9207d1f1598192b2 # Parent f1c83137e788c70fa42e5873468d9933259e3caa Add init script and doc hwoto used it diff -r f1c83137e788 -r 9ee293e79359 Makefile --- a/Makefile Sun May 15 00:19:54 2011 +0200 +++ b/Makefile Sun May 15 15:21:18 2011 +0200 @@ -7,14 +7,17 @@ all: install: + install -m 0777 -d $(DESTDIR)/etc/slitaz + install -m 0777 -d $(DESTDIR)$(PREFIX)/bin + install -m 0777 -d $(DESTDIR)/var/www/cgi-bin/cooker + install -m 0777 -d $(DESTDIR)$(PREFIX)/share/cook install -m 0777 cook $(DESTDIR)$(PREFIX)/bin install -m 0777 cooker $(DESTDIR)$(PREFIX)/bin install -m 0644 cook.conf $(DESTDIR)/etc/slitaz install -m 0644 cook.site $(DESTDIR)/etc/slitaz - install -m 0777 -d $(DESTDIR)/var/www/cgi-bin/cooker - install -m 0777 -d $(DESTDIR)$(PREFIX)/share/cook install -m 0644 web/* $(DESTDIR)/var/www/cgi-bin/cooker cp -r data/* $(DESTDIR)$(PREFIX)/share/cook + cp -r init.d $(DESTDIR)/etc uninstall: rm -rf \ diff -r f1c83137e788 -r 9ee293e79359 doc/cookutils.en.html --- a/doc/cookutils.en.html Sun May 15 00:19:54 2011 +0200 +++ b/doc/cookutils.en.html Sun May 15 15:21:18 2011 +0200 @@ -352,7 +352,22 @@ to run the Cooker every 2 hours:

-*/2 * * * * /usr/bin/cooker
+* */2 * * * /usr/bin/cooker
+
+ +

Cooker BB started at boot

+

+ The Cooker environment and deamon can automaticaly started at boot time. You + must have cookutils installed on the host and use standard SliTaz to make it + work properly (cooking goes in /home/slitaz/cooking). The deamon script will + mount virtual filesystems if needed as well as source and packages. Sources + files are in /home/slitaz/src and binded into the chroot so you can share + packages source between several version (stable, cooking, undiguest). To + start the daemon you must have a cron file definition for root in the chroot, + the deamon script work like all other system daemon and can be handled with: +

+
+# /etc/init.d/cooker [start|stop|restart]
 
diff -r f1c83137e788 -r 9ee293e79359 init.d/cooker --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/init.d/cooker Sun May 15 15:21:18 2011 +0200 @@ -0,0 +1,49 @@ +#!/bin/sh +# /etc/init.d/cooker: Start, stop or restart Cooker daemon. +# +. /etc/slitaz/cook.conf + +case "$i" in + start) + # When 4.0: for version in stable cooking undigest + for version in cooking + do + if [ -d "$SLITAZ/$version/chroot" ]; then + echo "Starting $version cooker..." + rootfs=$SLITAZ/$version/chroot + if [ ! -d $rootfs/proc/1 ]; then + mount -t proc proc $rootfs/proc + mount -t sysfs sysfs $rootfs/sys + mount -t devpts devpts $rootfs/dev/pts + mount -t tmpfs shm $rootfs/dev/shm + fi + if [ ! $(mount | grep -q ${roots}$SLITAZ/src) ] + mount -o bind $SLITAZ/src ${rootfs}$SLITAZ/src + mount -o bind $SLITAZ/$version/packages \ + ${rootfs}$SLITAZ/packages + fi + # Start cron in chroot. + chroot $rootfs /etc/init.d/cron start + fi + done ;; + stop) + for version in cooking + do + rootfs=$SLITAZ/$version/chroot + if [ -d "$SLITAZ/$version/chroot" ]; then + echo "Stoping $version cooker..." + # Stop cron in chroot. + chroot $rootfs /etc/init.d/cron stop + for i in /dev/shm /dev/pts /sys /proc $SLITAZ/src $SLITAZ/packages + do + umount ${rootfs}$i + done + fi + done ;; + restart) + $0 stop && sleep 2 && $0 start ;; + *) + echo "Usage: $0 [start|stop|restart]" ;; +esac + +exit 0