#!/bin/sh # # Copyright (c) 02005 sense.lab # # 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 # # # NOT currently called automatically in deb-live version. You can # change this for your builds by creating a symbolic link # config/chroot_local-includes/etc/rc3.d/S90cnas-devel-features ==> # ==> /usr/share/cryptonas-live/devel-features.sh # # called by: # - /etc/init.d/S90cnas-devel-features # 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 WRITE_DIRS="/var/www /usr/share/cryptobox-server /usr/share/cryptonas-live" 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 #TODO: devel-features.sh stop appears to be broken on deb-live version for a in $WRITE_DIRS do umount "$MIRROR_DIR/$a" "$a" done rm -rf "$MIRROR_DIR" ;; restart ) $0 stop $0 start ;; * ) echo "Syntax: `basename $0` { start | stop | restart }" ;; esac