summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile21
-rw-r--r--config-db/OpenSLX/ConfigDB.pm12
2 files changed, 29 insertions, 4 deletions
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
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm
index 8023cd2a..78a13e05 100644
--- a/config-db/OpenSLX/ConfigDB.pm
+++ b/config-db/OpenSLX/ConfigDB.pm
@@ -168,7 +168,17 @@ sub connect
$dbModule, $VERSION, $modVersion);
}
my $metaDB = $dbModule->new();
- $metaDB->connect($dbParams);
+ if (!eval '$metaDB->connect($dbParams);1') {
+ warn _tr("Unable to connect to DB-module <%s>\n%s", $dbModule, $@);
+ warn _tr("These DB-modules seem to work ok:");
+ foreach my $dbMod ('CSV', 'mysql', 'SQLite') {
+ if (eval "require DBD::$dbMod;") {
+ vlog 0, "\t$dbMod\n";
+ }
+ }
+ die _tr('Please use slxsettings to switch to another db-type.');
+ }
+
$self->{'db-type'} = $dbType;
$self->{'meta-db'} = $metaDB;
foreach my $tk (keys %{$DbSchema->{tables}}) {