summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/installer110
1 files changed, 110 insertions, 0 deletions
diff --git a/tools/installer b/tools/installer
index 92ece80d..7aa72b1d 100755
--- a/tools/installer
+++ b/tools/installer
@@ -1,9 +1,13 @@
#!/bin/bash
+# include fancy bash color stuff
. tools/inc/colors
+
+# determin distribution
DISTRO=$(lsb_release -i| sed 's/^[^:]*:\t//' | tr '[:upper:]' '[:lower:]')
+# get/set default paths
[ -z $USR_BIN_PATH ] && USR_BIN_PATH=/usr/bin
[ -z $SLX_CONFIG_PATH ] && SLX_CONFIG_PATH=/etc/opt/openslx
[ -z $SLX_BASE_PATH ] && SLX_BASE_PATH=/opt/openslx
@@ -284,6 +288,111 @@ check_upgrade()
fi
}
+postinstall()
+{
+ # create default config folder hierarchy:
+# perl -Ilib -e 'use OpenSLX::ConfigFolder; createConfigFolderForDefaultSystem();'
+#
+# # create complete default settings and empty local settings file:
+# echo -e "# default setup for OpenSLX-installation\
+#\n\
+#\n# paths that are fixed at packaging/installation time:\
+#\nSLX_BASE_PATH=${SLX_BASE_PATH}\
+#\nSLX_CONFIG_PATH=${SLX_CONFIG_PATH}\
+#\n\
+#\n# paths which can be adjusted after installation:\
+#\nSLX_PRIVATE_PATH=${SLX_PRIVATE_PATH}\
+#\nSLX_PUBLIC_PATH=${SLX_PUBLIC_PATH}\
+#\nSLX_TEMP_PATH=${SLX_TEMP_PATH}\n" \
+# > $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/settings.default; \
+# test -e $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/settings || \
+# echo -e "# Local setup for OpenSLX (overrides default settings).\
+#\n#\n# Please look at $(SLX_BASE_PATH)/share/settings.default and the docs to learn\
+#\n# about the available options.\n" \
+# > $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/settings; \
+#
+# @ # create slxversion script:
+# @if test -e REVISION; then \
+# . REVISION; \
+# else \
+# OPENSLX_VERSION_SVNREV=$$(svnversion .); \
+# fi; \
+# test "$${OPENSLX_SVN_SNAPSHOT}" = "0" && \
+# unset OPENSLX_SVN_SNAPSHOT || \
+# OPENSLX_SVN_SNAPSHOT="1"; \
+# . ./VERSIONS; \
+# echo -e "#! /bin/sh\n\necho $${OPENSLX_VERSION_STRING}" \
+# > $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \
+# chmod a+x $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \
+# ln -sf $(SLX_BASE_PATH)/bin/slxversion $(SLX_BUILD_PATH)$(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}";
+echo "123"
+}
+
+build_dpkg_package()
+{
+ make_install_tarball
+
+ dpkg_deb=`which dpkg-deb`
+ if [ -z "$dpkg_deb" ];then
+ echo "You need the program dpkg-deb (contained in package dpkg) to build a debian package"
+ exit
+ fi
+
+ # import default paths for debian installation
+ . ./packaging/dpkg/debianpaths
+
+ # change into folder where we expect the Makefile:
+ if [ ! -e ./Makefile ]; then
+ echo "There is no makefile in this programs directory (`pwd`)."
+ echo "Please run this script only embedded in the context of an openslx checkout."
+ exit
+ fi
+
+ export SLX_BUILD_PATH=/tmp/slx$$
+ mkdir -p $SLX_BUILD_PATH
+
+ INSTALL_HOME=$(pwd)
+ VERSIONSTRING="openslx-$(git_version)"
+
+ cd $SLX_BUILD_PATH
+ tar xf $INSTALL_HOME/$VERSIONSTRING.tar
+ cd $INSTALL_HOME
+
+ #Create Temporary working directory
+ mkdir -p $SLX_BUILD_PATH/DEBIAN
+ cp packaging/dpkg/default_files/control $SLX_BUILD_PATH/DEBIAN/
+ cp packaging/dpkg/default_files/pre* $SLX_BUILD_PATH/DEBIAN/
+ cp packaging/dpkg/default_files/post* $SLX_BUILD_PATH/DEBIAN/
+
+ OPENSLX_VERSION=$(git describe)
+
+
+ sed -i -e "4r./packaging/dpkg/debianpaths" \
+ $SLX_BUILD_PATH/DEBIAN/postinst
+
+ #update control file
+ sed -e "s/##version##/$OPENSLX_VERSION/" \
+ -e "s/##size##/$(du -s $SLX_BUILD_PATH | awk '{print $1}')/" \
+ -i $SLX_BUILD_PATH/DEBIAN/control
+
+ #Set permissions
+ find $SLX_BUILD_PATH -type d|xargs chmod 755
+
+ #Create the package
+ dpkg-deb --build $SLX_BUILD_PATH > /dev/null
+ cd packaging/dpkg
+ mv $SLX_BUILD_PATH.deb openslx_$OPENSLX_VERSION.deb
+ echo "Written 'openslx_$OPENSLX_VERSION.deb':"
+ ls -lh openslx_$OPENSLX_VERSION.deb
+ cd $INSTALL_HOME
+ #rm -rf $SLX_BUILD_PATH
+}
+
clean()
{
echo -n " * Cleanup OpenSLX source directory"
@@ -300,6 +409,7 @@ check_perl_dep
check_perl_db
check_helper_apps
prepare_install
+build_dpkg_package
#make_install_tarball
#make_install_tarball gzip
#make_install_tarball bzip2