Created tag for Live CD/Live USB release v0.3.5 build config
This commit is contained in:
parent
783824bad9
commit
bd96dede76
101 changed files with 9510 additions and 0 deletions
160
deb-live_v0.3.5/scripts/cbox-dev.sh
Executable file
160
deb-live_v0.3.5/scripts/cbox-dev.sh
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 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$
|
||||
#
|
||||
# managing our work at the cryptobox
|
||||
#
|
||||
# development actions:
|
||||
# chroot - run first tests in a chroot environment
|
||||
# qemu - run the qemu emulation with the uncompressed image
|
||||
# qemuz - run the qemu emulation with the compressed image
|
||||
# upload - copy your local files to tmpfs on a running cryptobox
|
||||
# diff - compare tmpfs-files on a running cryptobox with the original
|
||||
# merge - apply the diff to the local copy
|
||||
# ssh - open a ssh connection to a running cryptobox
|
||||
#
|
||||
# problems of this script:
|
||||
# - chroot has to run as root
|
||||
#
|
||||
# jwc 9/08: started modifications to work with CryptoNAS Live
|
||||
|
||||
#Note: It appears to have been a long time since this script was maintained.
|
||||
#(For example, where *was* $DEV_FEATURES_SCRIPT defined previously?)
|
||||
#It may work or it may fail.
|
||||
DEV_FEATURES_SCRIPT="/usr/share/cryptonas-live/devel-features.sh"
|
||||
|
||||
set -ue
|
||||
|
||||
# include common functions and settings
|
||||
source $(dirname $0)/common.sh.inc
|
||||
|
||||
################### some settings #####################
|
||||
|
||||
# to connect to a development cryptobox with ssh
|
||||
SSH_CONFIG_FILE=$(get_config_file ssh_config)
|
||||
|
||||
# extract the hostname of the cryptobox from the ssh_config file
|
||||
SSH_HOST=$(grep "^Host " "$SSH_CONFIG_FILE" | head -1 | sed 's/^Host *\(.*\)$/\1/')
|
||||
|
||||
|
||||
####################### functions ######################
|
||||
|
||||
|
||||
function qemu_boot()
|
||||
# parameter: iso_image_file
|
||||
{
|
||||
# create a virtual harddisk image file
|
||||
if [ ! -e "$HD_IMAGE" ]
|
||||
then echo "Creating temporary harddisk image ..."
|
||||
dd if=/dev/zero of="$HD_IMAGE" bs=1M count=$HD_IMAGE_SIZE
|
||||
fi
|
||||
echo "Starting qemu ..."
|
||||
qemu -hda "$HD_IMAGE" -cdrom "$1" -boot d -m 96 -net nic -net tap || true
|
||||
}
|
||||
|
||||
|
||||
function upload2box()
|
||||
# upload local files to a development cryptobox
|
||||
# this is necessary to use an "old" development cd with
|
||||
# new code - this affects only the web-interface and the
|
||||
# cbox-manage.sh-script (the boot behaviour stays the same)
|
||||
#
|
||||
# of course, only the directories that are mapped to tmpfs can
|
||||
# be updated this way
|
||||
{
|
||||
local DIRS="var/www usr/share/cryptobox-server usr/share/cryptonas-live"
|
||||
echo "Uploading the following dirs: $DIRS "
|
||||
[ -e "$TMP_DIR" ] || mkdir -p "$TMP_DIR"
|
||||
for a in $DIRS
|
||||
do mkdir -p "$TMP_DIR/$a"
|
||||
cp -r "$TEMPLATE_DIR/$a/." "$TMP_DIR/$a"
|
||||
done
|
||||
find "$TMP_DIR" -type d -name '\.svn' | while read a
|
||||
do rm -rf "$a"
|
||||
done
|
||||
echo "Copying local files to the cryptobox ... "
|
||||
if scp -F "$SSH_CONFIG_FILE" -rpq "$TMP_DIR/." cryptobox:/tmp/mirror
|
||||
then echo "Set the base for future diffs to current state ..."
|
||||
ssh -F "$SSH_CONFIG_FILE" "$SSH_HOST" "$DEV_FEATURES_SCRIPT" set_diff_base
|
||||
else echo 'ERROR: copying failed!'
|
||||
fi
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
|
||||
|
||||
function merge_from_box()
|
||||
# merge a diff from a running development cryptobox into
|
||||
# your local copy
|
||||
{
|
||||
echo "Check for collisions ... (dry-run)"
|
||||
if box_diff | patch --dry-run -p1 -d "$TEMPLATE_DIR"
|
||||
then echo
|
||||
echo "Applying diff ..."
|
||||
box_diff | patch -p1 -d "$TEMPLATE_DIR"
|
||||
echo
|
||||
echo "Set the base for future diffs to current state ..."
|
||||
ssh -F "$SSH_CONFIG_FILE" "$SSH_HOST" "$DEV_FEATURES_SCRIPT" set_diff_base
|
||||
else echo "Merging will fail - do it manually!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# get the diff of a running cryptobox system between its current state
|
||||
# and its original content
|
||||
function box_diff()
|
||||
{
|
||||
ssh -F "$SSH_CONFIG_FILE" "$SSH_HOST" "$DEV_FEATURES_SCRIPT" diff
|
||||
}
|
||||
|
||||
|
||||
############################# main #####################################
|
||||
|
||||
[ $# -eq 0 ] && echo "[`basename $0`] - no arguments supplied - maybe you want to use '--help'" && exit 1
|
||||
|
||||
ACTION=--help
|
||||
[ $# -gt 1 ] && ACTION=$1
|
||||
|
||||
case "$1" in
|
||||
diff )
|
||||
# get a diff from a running development cryptobox
|
||||
box_diff
|
||||
;;
|
||||
merge )
|
||||
merge_from_box
|
||||
;;
|
||||
upload )
|
||||
upload2box
|
||||
;;
|
||||
chroot )
|
||||
# chroot may only be called as root
|
||||
[ "$(id -u)" -ne 0 ] && echo "the action 'chroot' may only be called as root!" >&2 && exit 1
|
||||
echo
|
||||
echo "##############################################################################"
|
||||
echo "# BEWARE: you can severly harm your real harddisk in the chroot environment! #"
|
||||
echo "##############################################################################"
|
||||
echo
|
||||
chroot_image
|
||||
;;
|
||||
qemu )
|
||||
qemu_boot "$IMAGE_FILE"
|
||||
;;
|
||||
ssh )
|
||||
ssh -F "$SSH_CONFIG_FILE" "$SSH_HOST"
|
||||
;;
|
||||
help|--help )
|
||||
echo "Syntax: `basename $0` ( qemu | chroot | upload | diff | merge | ssh | help )"
|
||||
echo
|
||||
;;
|
||||
* )
|
||||
echo -e "unknown action: $1"
|
||||
echo
|
||||
$0 help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
88
deb-live_v0.3.5/scripts/common.sh.inc
Normal file
88
deb-live_v0.3.5/scripts/common.sh.inc
Normal file
|
@ -0,0 +1,88 @@
|
|||
#
|
||||
# common settings and functions for cryptobox scripts
|
||||
#
|
||||
|
||||
#################### some functions ####################
|
||||
|
||||
# get the path of a configuration file - local configuration files
|
||||
# supersede default files
|
||||
# parameter: base name of the configuration file
|
||||
function get_config_file()
|
||||
{
|
||||
[ -e "$LOCALCONF_DIR/$1" ] && echo "$LOCALCONF_DIR/$1" && return 0
|
||||
[ -e "$DEFAULTCONF_DIR/$1" ] && echo "$DEFAULTCONF_DIR/$1" && return 0
|
||||
echo "configuration file ($1) not found!" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function error_die()
|
||||
{
|
||||
echo "$2" >&2
|
||||
exit $1
|
||||
}
|
||||
|
||||
function chroot_image()
|
||||
{
|
||||
MNT_SRC=$IMAGE_DIR/opt/dfsruntime/runtimerd
|
||||
MNT_DST=$IMAGE_DIR/opt/dfsruntime/runtimemnt
|
||||
TMP_DIR=/tmp/cryptobox-chroot-$(basename $0)-$$
|
||||
[ -d "$TMP_DIR" ] && rm -rf "$TMP_DIR"
|
||||
|
||||
cp -a "$MNT_SRC/." "$TMP_DIR"
|
||||
mount --bind "$TMP_DIR" "$MNT_DST"
|
||||
|
||||
[ ! -e "$TMP_DIR/dev/null" ] && mknod "$TMP_DIR/dev/null" c 1 3 && chmod 666 "$TMP_DIR/dev/null"
|
||||
[ ! -e "$TMP_DIR/dev/urandom" ] && mknod "$TMP_DIR/dev/urandom" c 1 9 && chmod 444 "$TMP_DIR/dev/urandom"
|
||||
[ ! -e "$TMP_DIR/dev/console" ] && mknod "$TMP_DIR/dev/console" c 1 5 && chmod 660 "$TMP_DIR/dev/console"
|
||||
|
||||
# remember, if proc was mounted before (e.g. because of a running chroot)
|
||||
local PROC_WAS_MOUNTED=no
|
||||
mount -t proc proc "$IMAGE_DIR/proc" 2>/dev/null || PROC_WAS_MOUNTED=yes
|
||||
|
||||
# default language setting - prevents dpkg error messages
|
||||
# set default terminal (good if you are running in a screen session)
|
||||
LANG=C TERM=linux chroot "$IMAGE_DIR" /bin/bash
|
||||
|
||||
umount "$MNT_DST"
|
||||
[ "$PROC_WAS_MOUNTED" = "no" ] && umount "$IMAGE_DIR/proc"
|
||||
rm -r "$TMP_DIR"
|
||||
}
|
||||
|
||||
################### general settings ###################
|
||||
|
||||
# the base directory of your local development files
|
||||
ROOT_DIR=$(dirname "$0")/..
|
||||
ROOT_DIR=$(cd "$ROOT_DIR"; pwd)
|
||||
|
||||
# the template (default) configuration directory
|
||||
DEFAULTCONF_DIR="$ROOT_DIR/etc-defaults.d"
|
||||
|
||||
# your local configuration directory (existing files supersede the defaults)
|
||||
LOCALCONF_DIR="$ROOT_DIR/etc-local.d"
|
||||
|
||||
# local configuration directory - contains scripts to be executed after
|
||||
# 'configure'
|
||||
CUSTOM_CONFIGURE_DIR="$ROOT_DIR/configure-local.d"
|
||||
|
||||
# the chroot-wrapper within the cryptobox
|
||||
CHROOT_START="/usr/lib/cryptobox-cd/chroot-start.sh"
|
||||
|
||||
|
||||
############# include local configuration ##############
|
||||
|
||||
if [ -e "$(get_config_file cbox-dev.conf)" ]
|
||||
then source "$(get_config_file cbox-dev.conf)"
|
||||
else echo "local cbox-dev.conf ($(get_config_file cbox-dev.conf)) does not exist!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# image directory created by dfsbuild
|
||||
# the BUILD_DIR is defined in the local cbox-dev.conf
|
||||
IMAGE_DIR=$BUILD_DIR/target
|
||||
IMAGEZ_DIR=$BUILD_DIR/target.z
|
||||
IMAGEZ_FILE="${IMAGE_FILE%.iso}_compressed.iso"
|
||||
UNCOMPRESSED_ITEMS="_offline autorun.inf start.html boot opt boot.catalog"
|
||||
|
||||
HD_IMAGE=$ROOT_DIR/test.img
|
||||
HD_IMAGE_SIZE=256
|
||||
|
141
deb-live_v0.3.5/scripts/mirror_offline_doc.sh
Executable file
141
deb-live_v0.3.5/scripts/mirror_offline_doc.sh
Executable file
|
@ -0,0 +1,141 @@
|
|||
#!/bin/sh
|
||||
|
||||
PROJ_DIR=$(dirname "$0")/..
|
||||
PROJ_DIR=$(cd "$PROJ_DIR"; pwd)
|
||||
DEST_DIR="$PROJ_DIR/live-cd-tree.d/_offline/doc"
|
||||
WIKI_PAGES="doc/0.3/CryptoBoxUserGettingStarted/en
|
||||
doc/0.3/CryptoBoxUserDailyUse/en
|
||||
CryptoBoxUser/en
|
||||
faq"
|
||||
|
||||
|
||||
function prepare_wiki_page()
|
||||
{
|
||||
sed -i '1,/<div class="wikipage">/d' "$1"
|
||||
# remove the "comment" or "edit" stuff
|
||||
sed -i '/<h2>Comments<\/h2>/,$d' "$1"
|
||||
sed -i '/<div class="buttons">/,$d' "$1"
|
||||
# remove the last horizontal line
|
||||
sed -i '$,$d' "$1"
|
||||
# add anchor ids to every head line
|
||||
sed -i 's#<h\([1-4]\)>\(.*\)</h#<h\1 id="\2">\2</h#g' "$1"
|
||||
while grep -q '<h[1-4] id="\([a-zA-Z]*\)[^a-zA-Z"]' "$1"
|
||||
do sed -i 's#<h\([1-4]\) id="\([a-zA-Z]*\)[^a-zA-Z"]#<h\1 id="\2#g' "$1"
|
||||
done
|
||||
# convert wiki links
|
||||
sed -i 's#="/wiki/\([^"/]*\)/#="/wiki/\1_#g' "$1"
|
||||
sed -i 's#="/wiki/\([^"/]*\)/#="/wiki/\1_#g' "$1"
|
||||
sed -i 's#="/wiki/\([^"/]*\)/#="/wiki/\1_#g' "$1"
|
||||
sed -i 's#="/wiki/\([^"/]*\)/#="/wiki/\1_#g' "$1"
|
||||
sed -i 's#="/wiki/\([^"#]*\)\([#"]\)#="\1.html\2#g' "$1"
|
||||
# remove outdated documentation
|
||||
sed -i 's#</ol>#</ol>\n#g' "$1"
|
||||
sed -i '/outdated/,/<\/ol>/d' "$1"
|
||||
# remove "searchable" ids (blue coloring of head lines)
|
||||
sed -i 's#<div id="searchable">#<div>#g' "$1"
|
||||
# fix image sources
|
||||
sed -i 's#src="/file/[^"]*/\([^/\?]*\)["\?]#src="\1"#g' "$1"
|
||||
}
|
||||
|
||||
|
||||
function wrap_wiki_page()
|
||||
{
|
||||
# add header and footer
|
||||
(
|
||||
echo "$page_header"
|
||||
echo '<div class="centercontent">'
|
||||
cat "$1"
|
||||
echo '</div>'
|
||||
echo "$page_footer"
|
||||
) >"${1}.new"
|
||||
mv "${1}.new" "$1"
|
||||
}
|
||||
|
||||
|
||||
function rename_files()
|
||||
{
|
||||
ls | grep "\?format=raw$" | while read fname
|
||||
do local real_name=$(echo "$fname" | sed 's/\?.*$//')
|
||||
mv "$fname" "$real_name"
|
||||
done
|
||||
ls | grep "\.[0-9]*$" | while read fname
|
||||
do rm "$fname"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function redirect_homepage_links()
|
||||
{
|
||||
ls *.html | while read fname
|
||||
do while grep -q '="http://devel.cryptobox.org/wiki/[^/"]*/' "$fname"
|
||||
do sed -i 's#\(="http://devel.cryptobox.org/wiki/[^/"]*\)/#\1_#g' "$fname"
|
||||
done
|
||||
sed -i 's#="http://devel.cryptobox.org/wiki/\([^"\#]*\)\(["\#]\)#="\1.html\2"#g' "$fname"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function remove_useless_files()
|
||||
{
|
||||
rm -f robots.txt
|
||||
}
|
||||
|
||||
|
||||
function rename_one_file()
|
||||
{
|
||||
find . -type f | grep -v "/\.svn" | while read fname
|
||||
do sed -i "s#\([^a-zA-Z0-9]\)$1#\1$2#g" "$fname"
|
||||
done
|
||||
mv "$1" "$2"
|
||||
}
|
||||
|
||||
|
||||
function rename_long_files()
|
||||
{
|
||||
# this is necessary to avoid problems with the 31-character restriction of iso9660
|
||||
# on windows systems
|
||||
find . -type f | grep -v "/\.svn" | while read fname
|
||||
do if test 14 -lt "${#fname}"
|
||||
then local neu_prefix=$(echo "${fname:2:6}" | sed 's#/#_#g')
|
||||
local neu_num=0
|
||||
local neu_suffix=$(echo "$fname"| sed 's#^.*\.\([^\.]*\)$#.\1#g')
|
||||
test 5 -lt "${#neu_suffix}" && neu_suffix=.${neu_suffix:-4}
|
||||
while test -e "$neu_prefix$neu_num$neu_suffix"
|
||||
do local i=$((neu_num+1))
|
||||
# we should use the additional step (using 'i') to avoid a bash-specific
|
||||
# handling of self-increment
|
||||
neu_num=$i
|
||||
done
|
||||
rename_one_file "${fname:2}" "$neu_prefix$neu_num$neu_suffix"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
test ! -d "$DEST_DIR" && echo "Destination directory does not exist: $DEST_DIR" && exit 1
|
||||
|
||||
# cleanup destination directory
|
||||
test -e "$DEST_DIR/index.html" && find "$DEST_DIR/" -type f | grep -v "/\.svn" | xargs rm
|
||||
|
||||
cd "$DEST_DIR"
|
||||
|
||||
# retrieve pages from cryptobox.org
|
||||
wget --mirror --page-requisites --no-directories --convert-links --quiet http://cryptobox.org
|
||||
wget --output-document=header.jpg --quiet http://cryptobox.org/gfx/header.jpg
|
||||
|
||||
page_header=$(sed -n '1,/<!-- content starts here -->/p' index.html)
|
||||
page_footer=$(sed -n '/<!-- content ends here -->/,$p' index.html)
|
||||
|
||||
for page in $WIKI_PAGES
|
||||
do filename=${page//\//_}.html
|
||||
wget --no-directories --page-requisites --quiet "http://devel.cryptobox.org/wiki/$page"
|
||||
mv "$(basename $page)" "$filename"
|
||||
prepare_wiki_page "$filename" "$page"
|
||||
wrap_wiki_page "$filename"
|
||||
done
|
||||
|
||||
rename_files
|
||||
redirect_homepage_links
|
||||
remove_useless_files
|
||||
rename_long_files
|
||||
|
9
deb-live_v0.3.5/scripts/show_TODO.sh
Executable file
9
deb-live_v0.3.5/scripts/show_TODO.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/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.
|
||||
#
|
||||
|
||||
grep "TODO" $(find "$(dirname $0)/.." -type f | grep -v "\.svn" | grep -v "$(basename $0)")
|
Loading…
Add table
Add a link
Reference in a new issue