#!/bin/sh # Copyright © 2005-2007 Roger Leigh # # schroot is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # schroot is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see # . # ##################################################################### #set -e #exec 2>>/tmp/log #set -x if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then . "$CHROOT_SCRIPT_CONFIG" elif [ "$2" = "ok" ]; then echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist" exit 1 fi if [ "$AUTH_VERBOSITY" = "verbose" ]; then VERBOSE="--verbose" fi if [ -z "$AUTO_MASTER" ]; then AUTO_MASTER=/etc/auto.master fi if [ ! -r "$AUTO_MASTER" ]; then echo "automaster file '$AUTO_MASTER' not readable, exiting" exit 0 fi if [ ! -x "/usr/sbin/automount" ]; then echo "No /usr/sbin/automount, exiting" exit 0 fi CHROOT_AUTO_MASTER="$CHROOT_PATH$AUTO_MASTER.schroot" CHROOT_AUTOFS_PID="$CHROOT_PATH/var/run/autofs.schroot.pid" automount_on() { echo "$0 $1 automount_on" >> /tmp/log while read mntpt map options; do case "$mntpt" in /*) echo "$CHROOT_PATH$mntpt $map $options" ;; *) echo "$mntpt $map $options" ;; esac done < "$AUTO_MASTER" > "$CHROOT_AUTO_MASTER" if [ -r /etc/default/autofs ]; then . /etc/default/autofs /usr/sbin/automount -v -d -C -p "$CHROOT_AUTOFS_PID" "$CHROOT_AUTO_MASTER" fi } automount_off() { if [ -r "$CHROOT_AUTOFS_PID" ]; then kill -USR2 $(< "$CHROOT_AUTOFS_PID") || : fi } case "$1" in setup-start|setup-recover) automount_on ;; setup-stop) automount_off ;; esac