From 525a788603387bcc8bf8b5d868d00ffbb153c492 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 30 Apr 2007 21:30:09 +0000 Subject: * improved error handling during installation and execution in case the DB-module can't be loaded (because of missing DBD::-modules). Closes ticket #118 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@971 95ad53e4-c205-0410-b2fa-d234c58c8868 --- Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f56ce59a..78f17237 100644 --- a/Makefile +++ b/Makefile @@ -120,12 +120,24 @@ install: done; \ # specific database modules are optional, but we tell the user if \ # support for a database is missing: \ - for m in CSV mysql SQLite; do \ + DEFAULT_DB_TYPE=""; \ + for m in SQLite CSV mysql; do \ if ! perl -e "use DBD::$$m" 2>>${SLX_INSTALL_LOG} ; then \ - echo -e " 'DBD::$$m' not found, so $$m-databases will not be\ + echo -e " 'DBD::$$m' not found, so $$m-databases will not be \ supported."; \ + else \ + if test "$${DEFAULT_DB_TYPE}X" = "X"; then \ + DEFAULT_DB_TYPE=$$m; \ + echo " db-type => $$m"; \ + fi; \ fi; \ - done; + done; \ + if test "$${DEFAULT_DB_TYPE}X" = "X"; then \ + echo " None of the DB-modules is available! Please install one of them."; \ + exit 1; \ + else \ + echo $${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE; \ + fi; @echo "Installing OpenSLX project files" @mkdir -p $(DESTDIR)$(SLX_CONFIG_PATH) \ -p $(DESTDIR)$(SLX_BASE_PATH)/lib \ @@ -232,6 +244,9 @@ functions via\n# inclusion: '. /etc/functions' ..." \ > $(DESTDIR)${SLX_BIN_PATH}/slxversion @chmod a+x $(DESTDIR)${SLX_BIN_PATH}/slxversion @ln -sf $(SLX_BIN_PATH)/slxversion $(DESTDIR)$(USR_BIN_PATH)/ + @# set default db-type: + @DEFAULT_DB_TYPE=$$(cat DEFAULT-DB-TYPE); \ + echo -n ' '; slxsettings --db-type="$${DEFAULT_DB_TYPE}"; \ vmware_install: @# we should read the config file here or better have a separate -- cgit v1.2.3-55-g7522