summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-15 15:54:28 +0200
committerSebastian Schmelzer2010-09-15 15:54:28 +0200
commit5144ffcde9045024e33dfe9d005539d78023f192 (patch)
treed0d388b793fa7bf3b070ece79dd4774c8f9a9740 /tools
parentminor changes (diff)
downloadcore-5144ffcde9045024e33dfe9d005539d78023f192.tar.gz
core-5144ffcde9045024e33dfe9d005539d78023f192.tar.xz
core-5144ffcde9045024e33dfe9d005539d78023f192.zip
fully working installer ;)
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/openslx.settings4
-rw-r--r--tools/inc/openslx.settings.dist10
-rwxr-xr-xtools/installer106
3 files changed, 75 insertions, 45 deletions
diff --git a/tools/inc/openslx.settings b/tools/inc/openslx.settings
new file mode 100644
index 00000000..6d42f8f8
--- /dev/null
+++ b/tools/inc/openslx.settings
@@ -0,0 +1,4 @@
+# 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. \ No newline at end of file
diff --git a/tools/inc/openslx.settings.dist b/tools/inc/openslx.settings.dist
index e69de29b..dfcbf51f 100644
--- a/tools/inc/openslx.settings.dist
+++ b/tools/inc/openslx.settings.dist
@@ -0,0 +1,10 @@
+# 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### \ No newline at end of file
diff --git a/tools/installer b/tools/installer
index b2eb3e8e..8b29aff4 100755
--- a/tools/installer
+++ b/tools/installer
@@ -33,6 +33,24 @@ git_version()
fi
}
+versions_update()
+{
+ VERSION_STRING=$(git_version)
+ VERSION_MAJOR=$(echo $VERSION_STRING| sed -e 's/^v//'| awk -F "." '{print $1}')
+ VERSION_MINOR=$(echo $VERSION_STRING| sed -e 's/^v//'| awk -F "." '{print $2}')
+ VERSION_RELEASE=$(echo $VERSION_STRING| sed -e 's/^v//'| awk -F "." '{print $3}' | sed -e 's/-.*$//')
+ VERSION_BUILD=$(echo $VERSION_STRING| sed -e 's/^[^-]*-//')
+
+ echo "OPENSLX_VERSION_MAJOR=\"$VERSION_MAJOR\"" > VERSIONS
+ echo "OPENSLX_VERSION_MINOR=\"$VERSION_MINOR\"" >> VERSIONS
+ echo "OPENSLX_VERSION_RELEASE=\"$VERSION_RELEASE\"" >> VERSIONS
+ echo "OPENSLX_VERSION_STRING=\"\${OPENSLX_VERSION_MAJOR}.\${OPENSLX_VERSION_MINOR}.\${OPENSLX_VERSION_RELEASE}\${OPENSLX_VERSION_BUILD}\"" >> VERSIONS
+ echo "" >> VERSIONS
+
+ echo "OPENSLX_VERSION_BUILD=\"-$VERSION_BUILD\"" >> BUILD
+
+}
+
print_banner()
{
@@ -124,7 +142,7 @@ check_perl_db()
echo " None of the DB-modules is available! Please install one of them.";
exit 1;
else
- echo $${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE;
+ echo ${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE;
fi;
}
@@ -272,10 +290,8 @@ do_install()
echo " you need to be root"
exit 1
fi
- check_upgrade
make_install_tarball >>${SLX_INSTALL_LOG} 2>&1
VERSIONSTRING="openslx-$(git_version)"
- check_upgrade
INSTALL_HOME=$(pwd)
cd ${SLX_BUILD_PATH}/; tar xf $INSTALL_HOME/$VERSIONSTRING.tar
cd $INSTALL_HOME
@@ -318,58 +334,53 @@ check_upgrade()
# find out if there is an older version installed and, if so, clean that
INSTALLED_VERSION=$(slxversion 2>/dev/null)
if ! test -z "${INSTALLED_VERSION}"; then
- if test -e REVISION; then
- . REVISION
- else
- OPENSLX_VERSION_REV=$(git_version)
- fi;
- test "${OPENSLX_SVN_SNAPSHOT}" = "0" &&
- unset OPENSLX_SVN_SNAPSHOT || OPENSLX_SVN_SNAPSHOT="1"
- . ./VERSIONS;
+ . ./BUILD
+ . ./VERSIONS
if test ${INSTALLED_VERSION} != ${OPENSLX_VERSION_STRING}; then
echo " * preparing upgrade from version (${INSTALLED_VERSION})"
prepare_upgrade;
+ else
+ echo " * reinstall current version (${INSTALLED_VERSION})"
fi;
fi
}
-postinstall()
+post_install()
{
+ echo " * run postinstall"
+
# create default config folder hierarchy:
- perl -Ilib -e 'use OpenSLX::ConfigFolder; createConfigFolderForDefaultSystem();'
+ perl -Isrc/lib -e 'use OpenSLX::ConfigFolder; createConfigFolderForDefaultSystem();'
# create complete default settings and empty local settings file:
- sed -e 's///' \
+ sed -e "s,###SLX_BASE_PATH###,$SLX_BASE_PATH," \
+ -e "s,###SLX_CONFIG_PATH###,$SLX_CONFIG_PATH," \
+ -e "s,###SLX_PRIVATE_PATH###,$SLX_PRIVATE_PATH," \
+ -e "s,###SLX_PUBLIC_PATH###,$SLX_PUBLIC_PATH," \
+ -e "s,###SLX_TEMP_PATH###,$SLX_TEMP_PATH," \
./tools/inc/openslx.settings.dist \
- $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"
+ > $SLX_BUILD_PATH/$SLX_BASE_PATH/share/settings.default
+
+ if [ ! -e $SLX_BUILD_PATH/$SLX_CONFIG_PATH/settings ]; then
+ # create complete default settings and empty local settings file:
+ sed -e "s,###SLX_BASE_PATH###,$SLX_BASE_PATH," \
+ ./tools/inc/openslx.settings \
+ > $SLX_BUILD_PATH/$SLX_CONFIG_PATH/settings
+ fi
+
+ . ./BUILD
+ . ./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 " o "
+ slxsettings set db-type="${DEFAULT_DB_TYPE}";
}
build_dpkg_package()
@@ -502,7 +513,7 @@ build_rpm_package()
clean()
{
echo -n " * Cleanup OpenSLX source directory"
- for file in ${SLX_INSTALL_LOG} openslx-*.tar openslx-*.tar.*; do
+ for file in ${SLX_INSTALL_LOG} VERSION openslx-*.tar openslx-*.tar.*; do
rm -f ${file}
done
rm -rf _install
@@ -531,12 +542,15 @@ cmd_plain_install()
cmd_install()
{
echo "running full install"
+ versions_update
check_perl
check_perl_dep
check_perl_db
- check_helper_apps
+ check_helper_apps
+ check_upgrade
prepare_install
do_install
+ post_install
}
cmd_build_rpm()
@@ -584,6 +598,8 @@ cmd_mrproper()
print_banner
+versions_update
+
case "$1" in
"plain-install")
cmd_plain_install