diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index e69de29..0000000 diff --git a/MANIFEST.in b/MANIFEST.in index a857a0a..70274a9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,11 @@ include README +include LICENSE +include CHANGELOG +graft doc +graft conf-examples +graft event-scripts graft www-data -#graft www-data/screenshots graft templates graft lang graft plugins -prune commit.log prune package.exclude diff --git a/Makefile b/Makefile deleted file mode 100644 index 85045f6..0000000 --- a/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Makefile for the cryptobox web-interface -# -# Copyright (c) 02006 senselab -# - -CRYPTOBOX_ROOT = . - -PREFIX = /usr/local -SHARE_DIR = $(PREFIX)/share/cryptobox -LIB_DIR = $(PREFIX)/lib/cryptobox -DOC_DIR = $(PREFIX)/share/doc/cryptobox -BUILD_DIR = build_dir -INSTALL = install - -OS_TYPE=$(shell uname -o | tr [:upper:] [:lower:] | sed s/[^a-z0-9\._\-]/_/g) - -.PHONY: install clean build - -build: - $(INSTALL) -d -m 755 $(BUILD_DIR)/etc - $(INSTALL) -c -m 644 bin/cryptobox.conf $(BUILD_DIR)/etc/ - @sed -i 's#^HTML_TEMPLATE_DIR=.*$$#HTML_TEMPLATE_DIR=$(SHARE_DIR)/templates#' $(BUILD_DIR)/etc/cryptobox.conf - @sed -i 's#^LANGUAGE_DIR=.*$$#LANGUAGE_DIR=$(SHARE_DIR)/lang#' $(BUILD_DIR)/etc/cryptobox.conf - @sed -i 's#^DOC_DIR=.*$$#DOC_DIR=$(DOC_DIR)/html#' $(BUILD_DIR)/etc/cryptobox.conf - @sed -i 's#^CONFIG_DEFAULTS_DIR=.*$$#CONFIG_DEFAULTS_DIR=$(SHARE_DIR)/defaults#' $(BUILD_DIR)/etc/cryptobox.conf - - @touch $(BUILD_DIR)-stamp - - -install: $(BUILD_DIR)-stamp - ## programs - $(INSTALL) -d -m 755 $(LIB_DIR) - $(INSTALL) -c -m 755 bin/*.py $(LIB_DIR)/ - $(INSTALL) -c -m 755 bin/*.sh $(LIB_DIR)/ - ## language files - $(INSTALL) -d -m 755 $(SHARE_DIR)/lang - $(INSTALL) -c -m 644 lang/* $(SHARE_DIR)/lang/ - ## template files - $(INSTALL) -d -m 755 $(SHARE_DIR)/templates - $(INSTALL) -c -m 644 templates/*.cs $(SHARE_DIR)/templates - ## html data - $(INSTALL) -d -m 755 $(SHARE_DIR)/html - $(INSTALL) -c -m 644 www-data/*.css $(SHARE_DIR)/html/ - $(INSTALL) -c -m 644 www-data/*.png $(SHARE_DIR)/html/ - $(INSTALL) -c -m 644 www-data/*.gif $(SHARE_DIR)/html/ - ## screenshots - $(INSTALL) -d -m 755 $(SHARE_DIR)/html/screenshots - $(INSTALL) -c -m 644 www-data/screenshots/*.png $(SHARE_DIR)/html/screenshots/ - ## documentation files (html) - ls doc/html | while read lang ;\ - do test -d "doc/html/$$lang" && \ - $(INSTALL) -d -m 755 "$(DOC_DIR)/html/$$lang" && \ - $(INSTALL) -c -m 644 "doc/html/$$lang"/* "$(DOC_DIR)/html/$$lang/" ;\ - done; true - ## configuration examples - $(INSTALL) -d -m 755 $(DOC_DIR)/conf-examples - $(INSTALL) -c -m 644 conf-examples/* $(DOC_DIR)/conf-examples/ - ## plugins - $(INSTALL) -d -m 755 $(SHARE_DIR)/plugins - for e in plugins/*; do cp -r "$$e" "$(SHARE_DIR)/plugins"; done - ## event scripts - $(INSTALL) -c -m 644 hook-scripts/README $(DOC_DIR)/README.events - - -clean: - #$(MAKE) -C bin clean - -rm -rf $(BUILD_DIR) - -rm -f $(BUILD_DIR)-stamp - diff --git a/README b/README index 2fa9850..7161412 100644 --- a/README +++ b/README @@ -1 +1,24 @@ -link cbox-tree.d/usr/share/doc/cryptobox/README \ No newline at end of file +$Id$ +CryptoBox version 0.3 + +1) Documentation +The documentation is available at https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxUser + +2) Building a LiveCD +try: "scripts/cbox-build.sh release" +or look at the developer's documentation: https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxDev + +3) Bug reporting +Use our issue tracker at https://systemausfall.org/trac/cryptobox/newticket + +4) Licence +All scripts are GPL code (v2.0 or above). +The documentation is licenced under "Creative Commons 2.5 share-alike" (http://creativecommons.org/licenses/by-sa/2.5/). + +5) Contributors +Clavdia Horvat, Tadej Brce & Dušan Rebolj - slovenian translation + +6) Contact +email: cryptobox@systemausfall.org + +The CryptoBox project is mainly driven by sense.lab (https://systemausfall.org/senselab). diff --git a/bin/CryptoBoxWebserver b/bin/CryptoBoxWebserver index e396b9d..a4ada1c 100755 --- a/bin/CryptoBoxWebserver +++ b/bin/CryptoBoxWebserver @@ -1,4 +1,9 @@ #!/usr/bin/python2.4 +# +# The daemon script to run the CryptoBox webserver. +# +# run the script with "--help" to see all possible paramters +# import os, sys import cryptobox.web.sites @@ -115,7 +120,7 @@ def parseOptions(): parser.set_defaults(conffile="/etc/cryptobox/webserver.conf", pidfile="/var/run/cryptobox/webserver.pid", background=False, - datadir="/usr/share/cryptobox/html", + datadir="/usr/share/cryptobox/www-data", logfile="/var/log/cryptobox/webserver.log", port="8080", host="", diff --git a/bin/run_webserver.sh b/bin/run_webserver.sh index 9a36992..772bb2a 100755 --- a/bin/run_webserver.sh +++ b/bin/run_webserver.sh @@ -2,7 +2,7 @@ # # example start script to run a local cryptobox webserver # -# we set some en +# we set some parameters to make it possible to run it without an existing cryptobox installation # BIN_DIR=$(dirname "$0") diff --git a/doc/changelog b/changelog similarity index 100% rename from doc/changelog rename to changelog diff --git a/conf-examples/cryptobox.conf-dist b/conf-examples/cryptobox.conf similarity index 100% rename from conf-examples/cryptobox.conf-dist rename to conf-examples/cryptobox.conf diff --git a/conf-examples/cryptoboxwebserver.conf-dist b/conf-examples/cryptoboxwebserver.conf-dist deleted file mode 100644 index b7f22dc..0000000 --- a/conf-examples/cryptoboxwebserver.conf-dist +++ /dev/null @@ -1,17 +0,0 @@ -[global] -server.socketPort = 8080 -#server.environment = "production" -server.environment = "development" -server.logToScreen = False -server.log_tracebacks = True -server.threadPool = 1 -server.reverseDNS = False -server.logFile = "/var/log/cryptoboxwebserver.log" - -[/favicon.ico] -static_filter.on = True -# TODO: use live-cd/live-cd-tree.d/var/www/favicon.ico -static_filter.file = "/usr/share/doc/python-cherrypy/cherrypy/favicon.ico" - -[/test_stream] -stream_response = True diff --git a/doc/copyright b/copyright similarity index 100% rename from doc/copyright rename to copyright diff --git a/debian/cryptobox.docs b/debian/cryptobox.docs new file mode 100644 index 0000000..b8d67bd --- /dev/null +++ b/debian/cryptobox.docs @@ -0,0 +1,7 @@ +README +copyright +changelog +doc/html +LICENSE +event-scripts +conf-examples diff --git a/debian/cryptobox.init b/debian/cryptobox.init index d8d9ccf..842d7cf 100644 --- a/debian/cryptobox.init +++ b/debian/cryptobox.init @@ -32,7 +32,7 @@ CONF_FILE=/etc/cryptobox/cryptobox.conf # quit if NO_START is 1 (see /etc/default/cryptobox) [ "$NO_START" = "1" ] && exit 0 -DAEMON=/usr/bin/CryptoBoxWebserver +DAEMON=/usr/sbin/CryptoBoxWebserver PIDFILE=/var/run/cryptobox/webserver.pid DESC="CryptoBox Daemon (webinterface)" OPTIONS="-B --pidfile=$PIDFILE --config=$CONF_FILE $SERVER_OPTS" diff --git a/debian/dirs b/debian/dirs index c93de15..815d726 100644 --- a/debian/dirs +++ b/debian/dirs @@ -2,5 +2,5 @@ etc/cryptobox etc/cryptobox/events.d etc/default etc/init.d -usr/lib/cryptobox usr/share/cryptobox +usr/sbin diff --git a/debian/postinst b/debian/postinst index f362b1b..7783a81 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,12 +1,18 @@ #!/bin/sh -LOG_FILE=/var/log/cryptobox.log -WEBLOG_FILE=/var/log/cryptoboxwebserver.log +LOG_FILE=/var/log/cryptobox/cryptobox.log +WEBLOG_FILE=/var/log/cryptobox/webserver.log PID_DIR=/var/run/cryptobox CRYPTOBOX_USER=cryptobox USER_HOME=/var/cache/cryptobox SUPER_FILE=/etc/super.tab +# check the current cryptobox user - maybe it was changed +if test -r /etc/default/cryptobox + then runas_user=$(grep "^RUNAS=" /etc/default/cryptobox | cut -d "=" -f 2) + test -n "$runas_user" && CRYPTOBOX_USER=$runas_user + fi + create_user_home() { @@ -22,25 +28,25 @@ create_user_home() chmod 750 "$USER_HOME" } -create_log_file() -{ - # create config directories with appropriate permissions - test ! -e "$LOG_FILE" && mkdir -p "$(dirname $LOG_FILE)" && touch "$LOG_FILE" && chown "$CRYPTOBOX_USER" "$LOG_FILE" - test ! -e "$WEBLOG_FILE" && mkdir -p "$(dirname $WEBLOG_FILE)" && touch "$WEBLOG_FILE" && chown "$CRYPTOBOX_USER" "$WEBLOG_FILE" -} - create_add_super_permission() { ## this will add some lines to the configuration file of 'super' ## do nothing, if there is already a CryptoBox line grep -q "CRYPTOBOX_MARKER" "$SUPER_FILE" && return 0 echo >>"$SUPER_FILE" "## CRYPTOBOX_MARKER - please do not remove!" - echo >>"$SUPER_FILE" "CryptoBoxRootActions /usr/bin/CryptoBoxRootActions $CRYPTOBOX_USER" + echo >>"$SUPER_FILE" "CryptoBoxRootActions /usr/sbin/CryptoBoxRootActions $CRYPTOBOX_USER" } -create_pid_dir() +create_dirs_and_files() { - test ! -e "$PID_DIR" && mkdir -p "$PID_DIR" && chown "$CRYPTOBOX_USER" "$PID_DIR" + # pid file + test ! -e "$PID_DIR" && mkdir -p "$PID_DIR" + chown "$CRYPTOBOX_USER" "$PID_DIR" + # create config directories with appropriate permissions + test ! -e "$LOG_FILE" && mkdir -p "$(dirname $LOG_FILE)" && touch "$LOG_FILE" + chown "$CRYPTOBOX_USER" "$LOG_FILE" + test ! -e "$WEBLOG_FILE" && mkdir -p "$(dirname $WEBLOG_FILE)" && touch "$WEBLOG_FILE" + chown "$CRYPTOBOX_USER" "$WEBLOG_FILE" } @@ -49,8 +55,7 @@ create_pid_dir() case "$1" in configure) create_user_home - create_log_file - create_pid_dir + create_dirs_and_files create_add_super_permission # continue at the end ;; diff --git a/debian/postrm b/debian/postrm index 1fffed4..df322d2 100644 --- a/debian/postrm +++ b/debian/postrm @@ -1,7 +1,7 @@ #!/bin/sh -LOG_FILE=/var/log/cryptobox.log -WEBLOG_FILE=/var/log/cryptoboxwebserver.log +LOG_FILE=/var/log/cryptobox/cryptobox.log +WEBLOG_FILE=/var/log/cryptobox/webserver.log PID_DIR=/var/run/cryptobox SUPER_FILE=/etc/super.tab diff --git a/debian/rules b/debian/rules index 848cdd4..34f0ab0 100755 --- a/debian/rules +++ b/debian/rules @@ -13,19 +13,14 @@ .NOTPARALLEL: DEB_BUILD_DIR=$(CURDIR)/debian/cryptobox - -configure: configure-stamp -configure-stamp: patch - dh_testdir - @# PUT SOMETHING HERE - touch configure-stamp +CB_PYDIR=$(DEB_BUILD_DIR)/usr/lib/python$(shell pyversions -vr)/site-packages/cryptobox build: build-stamp -build-stamp: configure-stamp +build-stamp: dh_testdir - $(MAKE) build PREFIX=/usr + python setup.py build touch build-stamp clean: clean-patched unpatch @@ -33,8 +28,11 @@ clean: clean-patched unpatch clean-patched: dh_testdir dh_testroot - $(MAKE) clean - rm -f build-stamp configure-stamp + python setup.py clean + rm -f build-stamp + rm -rf build + find -type f -name '*.py[co]' | xargs rm -f + rm -f MANIFEST dh_clean patch: patch-stamp @@ -51,11 +49,19 @@ install: build dh_testroot dh_clean -k dh_installdirs - dh_pycentral - python setup.py install --root=debian/cryptobox - install -c -m 644 conf-examples/cryptobox.conf-dist $(DEB_BUILD_DIR)/etc/cryptobox/cryptobox.conf - install -c -m 644 conf-examples/cryptoboxwebserver.conf-dist $(DEB_BUILD_DIR)/etc/cryptobox/webserver.conf - + python setup.py install --root=$(DEB_BUILD_DIR) + # the cryptobox is a webserver - it should be installed in /usr/sbin + mv $(DEB_BUILD_DIR)/usr/bin/CryptoBoxWebserver $(DEB_BUILD_DIR)/usr/sbin/ + mv $(DEB_BUILD_DIR)/usr/bin/CryptoBoxRootActions $(DEB_BUILD_DIR)/usr/sbin/ + # remove tests + rm -rf $(CB_PYDIR)/tests + # remove duplicate documentation files + rm -rf $(CB_PYDIR)/share/doc + # move shared files + mv $(CB_PYDIR)/share $(DEB_BUILD_DIR)/usr/share/cryptobox + $(INSTALL) -d -m 755 $(DEB_BUILD_DIR)/var/log/cryptobox + $(INSTALL) -d -m 755 $(DEB_BUILD_DIR)/var/run/cryptobox + # Build architecture-independent files here. binary-indep: build install @@ -70,15 +76,14 @@ binary-arch: build install dh_installlogrotate dh_installinit dh_installman - dh_link - dh_strip + dh_install + dh_pycentral dh_compress dh_fixperms dh_installdeb - dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure clean-patched patch patch-stamp unpatch +.PHONY: build clean binary-indep binary-arch binary install clean-patched patch patch-stamp unpatch diff --git a/doc/README b/doc/README deleted file mode 100644 index 7161412..0000000 --- a/doc/README +++ /dev/null @@ -1,24 +0,0 @@ -$Id$ -CryptoBox version 0.3 - -1) Documentation -The documentation is available at https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxUser - -2) Building a LiveCD -try: "scripts/cbox-build.sh release" -or look at the developer's documentation: https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxDev - -3) Bug reporting -Use our issue tracker at https://systemausfall.org/trac/cryptobox/newticket - -4) Licence -All scripts are GPL code (v2.0 or above). -The documentation is licenced under "Creative Commons 2.5 share-alike" (http://creativecommons.org/licenses/by-sa/2.5/). - -5) Contributors -Clavdia Horvat, Tadej Brce & Dušan Rebolj - slovenian translation - -6) Contact -email: cryptobox@systemausfall.org - -The CryptoBox project is mainly driven by sense.lab (https://systemausfall.org/senselab). diff --git a/setup.py b/setup.py index eed4743..59eb7da 100644 --- a/setup.py +++ b/setup.py @@ -13,18 +13,27 @@ datadir = distutils.sysconfig.get_python_lib() datadir = datadir.replace(distutils.sysconfig.get_config_var("prefix") + os.path.sep, '') datadir = os.path.join(datadir, 'cryptobox','share') -def getdatafiles(dirs): +## configuration directory +confdir = os.path.join(os.path.sep, 'etc', 'cryptobox') + +def listfiles(prefix,srcdir): + """get files below a directory recursively - map them to the appropriate datatype as expected by 'data_files' in setup""" + ## add the files of this directory + result = [(os.path.join(prefix,srcdir), [ os.path.join(srcdir, f) for f in os.listdir(srcdir) if os.path.isfile(os.path.join(srcdir, f)) and not f in IGNORE_FILES ])] + ## add the files in subdirectories + for d in os.listdir(os.path.join(srcdir)): + if os.path.isdir(os.path.join(srcdir,d)) and not d in IGNORE_FILES: + result.extend(listfiles(prefix,os.path.join(srcdir,d))) + return result + + +def getdatafiles(prefix,dirs): filelist = [] - def listfiles(srcdir): - ## add the files of this directory - result = [(os.path.join(datadir,srcdir), [ os.path.join(srcdir, f) for f in os.listdir(srcdir) if os.path.isfile(os.path.join(srcdir, f)) and not f in IGNORE_FILES ])] - ## add the files in subdirectories - for d in os.listdir(os.path.join(srcdir)): - if os.path.isdir(os.path.join(srcdir,d)) and not d in IGNORE_FILES: - result.extend(listfiles(os.path.join(srcdir,d))) - return result for d in dirs: - filelist.extend(listfiles(d)) + if os.path.isdir(d): + filelist.extend(listfiles(prefix,d)) + else: + filelist.append((prefix, [d])) return filelist @@ -39,11 +48,12 @@ setup( license = 'GPL', url = 'http://cryptobox.org', packages = [ 'cryptobox', 'cryptobox.core', 'cryptobox.web', 'cryptobox.plugins', 'cryptobox.tests' ], - data_files = getdatafiles(['templates','www-data','lang','plugins','event-scripts','conf-examples']) + [ - (datadir, ['README']), - (datadir, ['CHANGELOG']), - (datadir, ['LICENSE'])], - package_dir = { 'cryptobox': 'src' }, + data_files = getdatafiles(datadir, ['templates','www-data','lang','plugins']) + + getdatafiles(confdir, ['conf-examples/cryptobox.conf']) + + getdatafiles(os.path.join(confdir,'events.d'), ['event-scripts/README']) + + getdatafiles(datadir, ['doc']) + + getdatafiles(os.path.join(datadir,'doc'), ['conf-examples','event-scripts','README','changelog','LICENSE','copyright','doc/html']), + package_dir = { '': 'src' }, scripts = [ 'bin/CryptoBoxWebserver', 'bin/CryptoBoxRootActions' ], classifiers = [ 'Development Status :: 2 - Beta', diff --git a/src/__init__.py b/src/cryptobox/__init__.py similarity index 100% rename from src/__init__.py rename to src/cryptobox/__init__.py diff --git a/src/core/__init__.py b/src/cryptobox/core/__init__.py similarity index 100% rename from src/core/__init__.py rename to src/cryptobox/core/__init__.py diff --git a/src/core/container.py b/src/cryptobox/core/container.py similarity index 100% rename from src/core/container.py rename to src/cryptobox/core/container.py diff --git a/src/core/exceptions.py b/src/cryptobox/core/exceptions.py similarity index 100% rename from src/core/exceptions.py rename to src/cryptobox/core/exceptions.py diff --git a/src/core/main.py b/src/cryptobox/core/main.py similarity index 100% rename from src/core/main.py rename to src/cryptobox/core/main.py diff --git a/src/core/settings.py b/src/cryptobox/core/settings.py similarity index 100% rename from src/core/settings.py rename to src/cryptobox/core/settings.py diff --git a/src/core/tools.py b/src/cryptobox/core/tools.py similarity index 100% rename from src/core/tools.py rename to src/cryptobox/core/tools.py diff --git a/src/plugins/__init__.py b/src/cryptobox/plugins/__init__.py similarity index 100% rename from src/plugins/__init__.py rename to src/cryptobox/plugins/__init__.py diff --git a/src/plugins/base.py b/src/cryptobox/plugins/base.py similarity index 100% rename from src/plugins/base.py rename to src/cryptobox/plugins/base.py diff --git a/src/plugins/manage.py b/src/cryptobox/plugins/manage.py similarity index 100% rename from src/plugins/manage.py rename to src/cryptobox/plugins/manage.py diff --git a/src/tests/__init__.py b/src/cryptobox/tests/__init__.py similarity index 100% rename from src/tests/__init__.py rename to src/cryptobox/tests/__init__.py diff --git a/src/tests/cryptobox.py b/src/cryptobox/tests/cryptobox.py similarity index 100% rename from src/tests/cryptobox.py rename to src/cryptobox/tests/cryptobox.py diff --git a/src/tests/cryptoboxtools.py b/src/cryptobox/tests/cryptoboxtools.py similarity index 100% rename from src/tests/cryptoboxtools.py rename to src/cryptobox/tests/cryptoboxtools.py diff --git a/src/tests/plugins.py b/src/cryptobox/tests/plugins.py similarity index 100% rename from src/tests/plugins.py rename to src/cryptobox/tests/plugins.py diff --git a/src/tests/websites.py b/src/cryptobox/tests/websites.py similarity index 100% rename from src/tests/websites.py rename to src/cryptobox/tests/websites.py diff --git a/src/web/__init__.py b/src/cryptobox/web/__init__.py similarity index 100% rename from src/web/__init__.py rename to src/cryptobox/web/__init__.py diff --git a/src/web/dataset.py b/src/cryptobox/web/dataset.py similarity index 100% rename from src/web/dataset.py rename to src/cryptobox/web/dataset.py diff --git a/src/web/sites.py b/src/cryptobox/web/sites.py similarity index 100% rename from src/web/sites.py rename to src/cryptobox/web/sites.py diff --git a/src/web/testclass.py b/src/cryptobox/web/testclass.py similarity index 100% rename from src/web/testclass.py rename to src/cryptobox/web/testclass.py