cookutils view init.d/cooker @ rev 607
The directories install taz & source may not exist
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 11 08:36:57 2013 +0000 (2013-08-11) |
parents | bfed443e62bd |
children | 1520231a65c2 |
line source
1 #!/bin/sh
2 # /etc/init.d/cooker: Start, stop or restart Cooker daemon.
3 #
5 # This is the only real path we need for the daemon and it makes it independent
6 # from cookutils itself.
7 SLITAZ="/home/slitaz"
9 case "$i" in
10 start)
11 # When 4.0: version: stable cooking undigest
12 for version in cooking
13 do
14 if [ -d "$SLITAZ/$version/chroot" ]; then
15 echo "Starting $version cooker..."
16 rootfs=$SLITAZ/$version/chroot
17 if [ ! -d $rootfs/proc/1 ]; then
18 mount -t proc proc $rootfs/proc
19 mount -t sysfs sysfs $rootfs/sys
20 mount -t devpts devpts $rootfs/dev/pts
21 mount -t tmpfs shm $rootfs/dev/shm
22 fi
23 if [ ! $(mount | grep -q ${rootfs}$SLITAZ/src) ]; then
24 mount -o bind $SLITAZ/src ${rootfs}$SLITAZ/src
25 mount -o bind $SLITAZ/$version/packages \
26 ${rootfs}$SLITAZ/packages
27 fi
28 # Start cron in chroot.
29 chroot $rootfs /etc/init.d/cron start
30 fi
31 done ;;
32 stop)
33 # When 4.0: version: stable cooking undigest
34 for version in cooking
35 do
36 rootfs=$SLITAZ/$version/chroot
37 if [ -d "$SLITAZ/$version/chroot" ]; then
38 echo "Stopping $version cooker..."
39 # Stop cron in chroot.
40 chroot $rootfs /etc/init.d/cron stop
41 for i in /dev/shm /dev/pts /sys /proc $SLITAZ/src $SLITAZ/packages
42 do
43 umount ${rootfs}$i
44 done
45 fi
46 done ;;
47 restart)
48 $0 stop && sleep 2 && $0 start ;;
49 *)
50 echo "Usage: $0 [start|stop|restart]" ;;
51 esac
53 exit 0