#!/bin/sh #--------------------------------------------------------------------------- # /var/install/bin/eisportal-modules-create-modul-entry # Create entry for the given modul in eisportal_modules # # Creation: 09.08.2006 ys # Last Update: $Id$ # # Copyright (c) 2005-2006 Yves Schumann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #--------------------------------------------------------------------------- #exec 2>/public/eisportal-trace$$.log #set -x . /etc/config.d/eisportal . /var/install/include/eislib if [ $# -lt 1 ] then mecho "" mecho -info "Usage: $0 MODULNAME" mecho -info "MODULNAME must be a EisPortal modul" mecho "" exit 1 fi newModul=$1 mysql_data_dir=/var/lib/mysql mysql_base_dir=/usr/local/mysql config_php=/var/www/htdocs/eisportal/config.php ### ------------------------------------------------------------------------- ### Create user table for specified EisPortal module ### ------------------------------------------------------------------------- create_modul_entry () { if [ ! -f /var/run/mysql.pid ] then mecho -error "Error! Cannot connect to MySQL server." else # is user table existing? modul_entry_exists=`${mysql_base_dir}/bin/mysql -h ${EISPORTAL_DB_HOST} -D${EISPORTAL_DB_NAME} -u${EISPORTAL_DB_ADMIN_USER} -p${EISPORTAL_DB_ADMIN_PASS} -e"SELECT ID FROM eisportal_modules WHERE modulname = '${newModul}' "` if [ -z ${modul_entry_exists} ] then mecho -n "Creating entry ${newModul} in eisportal_modules... " ${mysql_base_dir}/bin/mysql -h ${EISPORTAL_DB_HOST} -D${EISPORTAL_DB_NAME} -u${EISPORTAL_DB_ADMIN_USER} -p${EISPORTAL_DB_ADMIN_PASS} -e"INSERT INTO eisportal_modules ( modulname ) VALUES ( '${newModul}' );" mecho "Done." else mecho -warn "Entry for modul ${newModul} exists, creation skipped." fi fi } ###---------------------------------------------------------------------------- ### main ###---------------------------------------------------------------------------- create_modul_entry exit 0 ### --------------------------------------------------------------------------- ### End ###----------------------------------------------------------------------------