source: trunk/debathena/third/schroot/debian/schroot.init @ 24167

Revision 24167, 2.3 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
  • Property svn:executable set to *
RevLine 
[24167]1#! /bin/sh
2#
3### BEGIN INIT INFO
4# Provides:          schroot
5# Required-Start:    $local_fs $network $remote_fs
6# Required-Stop:
7# Should-Start:      lvm
8# Should-Stop:
9# Default-Start:     S
10# Default-Stop:
11# Short-Description: Recover schroot sessions.
12# Description:       Activate any persistent sessions after a reboot.
13#                    Setup scripts will be run to mount filesystems and
14#                    bring the chroot back to a working state.
15### END INIT INFO
16#
17# Copyright © 2006-2007  Roger Leigh <rleigh@debian.org>
18# Copyright © 2007       Federico Di Gregorio <fog@debian.org>
19#
20# schroot is free software: you can redistribute it and/or modify it
21# under the terms of the GNU General Public License as published by
22# the Free Software Foundation, either version 3 of the License, or
23# (at your option) any later version.
24#
25# schroot is distributed in the hope that it will be useful, but
26# WITHOUT ANY WARRANTY; without even the implied warranty of
27# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
28# General Public License for more details.
29#
30# You should have received a copy of the GNU General Public License
31# along with this program.  If not, see
32# <http://www.gnu.org/licenses/>.
33
34SCHROOT=/usr/bin/schroot
35PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
36NAME=schroot
37
38. /lib/lsb/init-functions
39
40test -x $SCHROOT || exit 0
41
42# Include schroot defaults if available
43if [ -f "/etc/default/$NAME" ] ; then
44    . "/etc/default/$NAME"
45fi
46
47set -e
48
49recover_sessions()
50{
51    log_daemon_msg "Recovering schroot sessions"
52    for chroot in `$SCHROOT --all-sessions --list --quiet`
53      do
54      $SCHROOT --chroot=$chroot --recover-session || true
55      log_progress_msg "$chroot"
56    done
57    log_end_msg 0
58}
59
60end_sessions()
61{
62    log_daemon_msg "Ending schroot sessions"
63    for chroot in `$SCHROOT --all-sessions --list --quiet`
64      do
65      $SCHROOT --chroot=$chroot --end-session || true
66      log_progress_msg "$chroot"
67    done
68    log_end_msg 0
69}
70
71case "$1" in
72    start|restart|force-reload)
73        if [ "$SESSIONS_RECOVER" = "end" ] ; then
74            end_sessions
75        else
76            recover_sessions
77        fi
78        ;;
79    stop)
80        ;;
81    status)
82        ;;
83    *)
84        N=/etc/init.d/$NAME
85        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
86        exit 1
87        ;;
88esac
89
90exit 0
Note: See TracBrowser for help on using the repository browser.