2008-06-09 02:23:17 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 02005 sense.lab <senselab@systemausfall.org>
|
|
|
|
#
|
|
|
|
# License: This script is distributed under the terms of version 2
|
|
|
|
# of the GNU GPL. See the LICENSE file included with the package.
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# this script is part of the boot process of a developer's cryptobox
|
|
|
|
#
|
|
|
|
# it should really NEVER be found on a release CD
|
|
|
|
#
|
2008-09-13 02:00:58 +02:00
|
|
|
##NOT currently called automatically in deb-live version
|
2008-06-09 02:23:17 +02:00
|
|
|
# called by:
|
2008-09-13 02:00:58 +02:00
|
|
|
# - /etc/init.d/S99cnas-devel-features
|
2008-06-09 02:23:17 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# read the default setting file, if it exists
|
|
|
|
[ -e /etc/default/cryptobox ] && . /etc/default/cryptobox
|
|
|
|
|
|
|
|
MIRROR_DIR=/tmp/mirror
|
|
|
|
MIRROR_ORIG_DIR=/tmp/mirror.orig
|
2008-09-13 02:00:58 +02:00
|
|
|
WRITE_DIRS="/var/www /usr/share/cryptobox-server /usr/share/cryptonas-live"
|
2008-06-09 02:23:17 +02:00
|
|
|
|
|
|
|
ACTION="--help"
|
|
|
|
[ $# -gt 0 ] && ACTION="$1"
|
|
|
|
|
|
|
|
case "$ACTION" in
|
|
|
|
start )
|
|
|
|
# copy cryptobox files to tmpfs
|
|
|
|
for a in $WRITE_DIRS
|
|
|
|
do mkdir -p "$MIRROR_DIR/$a"
|
|
|
|
cp -a "$a/." "$MIRROR_DIR/$a"
|
|
|
|
mount --bind "$MIRROR_DIR/$a" "$a"
|
|
|
|
done
|
|
|
|
$0 set_diff_base
|
|
|
|
|
|
|
|
# cryptobox-server needs to be restarted to reopen its files
|
|
|
|
invoke-rc.d cryptobox-server restart
|
|
|
|
|
|
|
|
# start ssh daemon
|
|
|
|
[ -x /etc/init.d/ssh ] && /etc/init.d/ssh start
|
|
|
|
;;
|
|
|
|
set_diff_base )
|
|
|
|
# the present content of the tmpfs mirror get copied to
|
|
|
|
# MIRROR_ORIG_DIR for later diffs
|
|
|
|
# whenever you merged a diff, you should call this function
|
|
|
|
[ -e "$MIRROR_ORIG_DIR" ] && rm -rf "$MIRROR_ORIG_DIR"
|
|
|
|
cp -a "$MIRROR_DIR" "$MIRROR_ORIG_DIR"
|
|
|
|
;;
|
|
|
|
diff )
|
|
|
|
cd "`dirname \"$MIRROR_ORIG_DIR\"`"
|
|
|
|
# diff and remove "binary files differ"-warnings (vi-swap-files)
|
|
|
|
# ignore generated reports
|
|
|
|
# ignore cryptobox.pl and index.html, as those are the same as
|
|
|
|
# /var/www/cryptobox (symbilic links)
|
|
|
|
# replace the link name (/var/www/cryptobox) by its destination
|
|
|
|
# UGLY!
|
|
|
|
diff -ruN --exclude=report --exclude=cryptobox.pl --exclude=index.html "`basename \"$MIRROR_ORIG_DIR\"`" "`basename \"$MIRROR_DIR\"`" | grep -v "^Binary files" | sed 's#/var/www/cryptobox\t#/var/www/cgi-bin/cryptobox.pl\t#'
|
|
|
|
;;
|
|
|
|
stop )
|
|
|
|
[ -x /etc/init.d/ssh ] && /etc/init.d/ssh stop
|
2008-09-13 02:00:58 +02:00
|
|
|
#TODO: devel-features.sh stop appears to be broken on deb-live version
|
2008-06-09 02:23:17 +02:00
|
|
|
for a in $WRITE_DIRS
|
2008-09-13 02:00:58 +02:00
|
|
|
do umount "$MIRROR_DIR/$a" "$a"
|
2008-06-09 02:23:17 +02:00
|
|
|
done
|
|
|
|
rm -rf "$MIRROR_DIR"
|
|
|
|
;;
|
|
|
|
restart )
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo "Syntax: `basename $0` { start | stop | restart }"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|