summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorSebastian Schmelzer2009-01-27 13:12:02 +0100
committerSebastian Schmelzer2009-01-27 13:12:02 +0100
commit5e178d76311bd6d525684ba0d4fbe7505eb76e12 (patch)
treeb3df1e244406ba4555bbffe20fc71828343cc289 /packaging
parent * added missing spaces .. (diff)
downloadcore-5e178d76311bd6d525684ba0d4fbe7505eb76e12.tar.gz
core-5e178d76311bd6d525684ba0d4fbe7505eb76e12.tar.xz
core-5e178d76311bd6d525684ba0d4fbe7505eb76e12.zip
* postinstall stuff added to deb templates
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2531 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/dpkg/builddebianpackage11
-rw-r--r--packaging/dpkg/debianpaths6
-rwxr-xr-xpackaging/dpkg/default_files/postinst86
3 files changed, 81 insertions, 22 deletions
diff --git a/packaging/dpkg/builddebianpackage b/packaging/dpkg/builddebianpackage
index 74b0a294..72472e59 100755
--- a/packaging/dpkg/builddebianpackage
+++ b/packaging/dpkg/builddebianpackage
@@ -9,6 +9,9 @@ if [ -z "$dpkg_deb" ];then
exit
fi
+# import default paths for debian installation
+ . ./debianpaths
+
# change into folder where we expect the Makefile:
cd $(dirname $(readlink -f $0))/../..
if [ ! -e ./Makefile ]; then
@@ -29,6 +32,12 @@ if make plain-install; then
. ./VERSIONS
+ OPENSLX_VERSION_SVNREV=$(svnversion .)
+
+
+ sed -i -e "4r./packaging/dpkg/debianpaths" \
+ $SLX_BUILD_PATH/DEBIAN/postinst
+
#update control file
sed -i -e "s/##version##/$OPENSLX_VERSION_STRING/" \
-e "s/##size##/$(du -s $SLX_BUILD_PATH | awk '{print $1}')/" \
@@ -45,4 +54,4 @@ if make plain-install; then
ls -lh openslx_$OPENSLX_VERSION_STRING.deb
fi
#Clean up
-rm -rf $SLX_BUILD_PATH
+#rm -rf $SLX_BUILD_PATH
diff --git a/packaging/dpkg/debianpaths b/packaging/dpkg/debianpaths
new file mode 100644
index 00000000..0fa2732d
--- /dev/null
+++ b/packaging/dpkg/debianpaths
@@ -0,0 +1,6 @@
+export SLX_CONFIG_PATH=/etc/opt/openslx
+export SLX_BASE_PATH=/opt/openslx
+export SLX_PRIVATE_PATH=/var/opt/openslx
+export SLX_PUBLIC_PATH=/srv/openslx
+export SLX_TEMP_PATH=/tmp
+export USR_BIN_PATH=/usr/bin
diff --git a/packaging/dpkg/default_files/postinst b/packaging/dpkg/default_files/postinst
index d90f2524..2b918efd 100755
--- a/packaging/dpkg/default_files/postinst
+++ b/packaging/dpkg/default_files/postinst
@@ -1,41 +1,85 @@
#!/bin/sh
set -e
-#
+
+##VAR##
+
if [ "$1" = "configure" ]; then
# specific database modules are optional, but we tell the user if
# support for a database is missing:
- DEFAULT_DB_TYPE="";
+ DEFAULT_DB_TYPE=""
if test -e ${SLX_CONFIG_PATH}/settings; then
- echo "Reading local settings...";
- . ${SLX_CONFIG_PATH}/settings;
- fi;
+ echo "Reading local settings..."
+ . ${SLX_CONFIG_PATH}/settings
+ fi
for m in ${SLX_DB_TYPE} SQLite mysql; do
- perl -I/opt/openslx/lib -Ilib -Iconfig-db -e "use OpenSLX::MetaDB::$m";
+ perl -I/opt/openslx/lib -Ilib -Iconfig-db -e "use OpenSLX::MetaDB::$m"
if [ $? -gt 0 ] ; then
echo -e " 'DBD::$m' not found (or too old), so $m-databases will not be \
-supported.";
+supported."
+ exit 1
else
if test "${DEFAULT_DB_TYPE}X" = "X"; then
DEFAULT_DB_TYPE=$m;
- echo " db-type => $m";
- fi;
- fi;
- done;
+ echo " db-type => $m"
+ fi
+ fi
+ done
+
if test "${DEFAULT_DB_TYPE}X" = "X"; then
- echo " None of the DB-modules is available! Please install one of them.";
- echo " For SQLite usage:";
- echo " # aptitude install libdbd-sqlite3-perl";
- echo " For MySQL usage:";
- echo " # aptitude install libdbd-mysql-perl";
+ echo " None of the DB-modules is available! Please install one of them."
+ echo " For SQLite usage:"
+ echo " # aptitude install libdbd-sqlite3-perl"
+ echo " For MySQL usage:"
+ echo " # aptitude install libdbd-mysql-perl"
echo " or use CPAN to install the requred perl bindings"
else
- echo ${DEFAULT_DB_TYPE} >/opt/openslx/DEFAULT-DB-TYPE;
- fi;
+ echo ${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE;
+ fi
+
if ! which rsync >/dev/null 2>&1; then
- echo " rsync is required, please install it.";
- echo " # aptitude install rsync";
- fi;
+ echo " rsync is required, please install it."
+ echo " # aptitude install rsync"
+ fi
+
+ # do Makefile:postinit stuff
+
+ # create default config folder hierarchy:
+ perl -I/opt/openslx/lib -e 'use OpenSLX::ConfigFolder; createConfigFolderForDefaultSystem();'
+
+ # create complete default settings and empty local settings file:
+ cat > ${SLX_BASE_PATH}/share/settings.default << EOF
+# default setup for OpenSLX-installation
+
+# paths that are fixed at packaging/installation time:
+SLX_BASE_PATH=${SLX_BASE_PATH}
+SLX_CONFIG_PATH=${SLX_CONFIG_PATH}
+
+# paths which can be adjusted after installation:
+SLX_PRIVATE_PATH=${SLX_PRIVATE_PATH}
+SLX_PUBLIC_PATH=${SLX_PUBLIC_PATH}
+SLX_TEMP_PATH=${SLX_TEMP_PATH}
+EOF
+
+ if [ ! -e ${SLX_CONFIG_PATH}/settings ]; then
+
+cat > ${SLX_CONFIG_PATH}/settings << EOF
+# Local setup for OpenSLX (overrides default settings).
+#
+# Please look at ${SLX_BASE_PATH}/share/settings.default and the docs to learn
+# about the available options.
+EOF
+
+ fi
+
+ echo -e "#! /bin/sh\n\necho ${OPENSLX_VERSION_STRING}" > ${SLX_BASE_PATH}/bin/slxversion
+ chmod a+x ${SLX_BASE_PATH}/bin/slxversion
+ ln -sf /bin/slxversion ${USR_BIN_PATH}/
+ # set default db-type:
+ DEFAULT_DB_TYPE=$(cat DEFAULT-DB-TYPE)
+ rm DEFAULT-DB-TYPE
+ echo -n ' '
+ slxsettings set db-type="${DEFAULT_DB_TYPE}"
#
fi