#!/bin/sh #--------------------------------------------------------------------------- # /var/install/bin/eisportal-modules-remove-modul-entry # Remove entry for the given modul from 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 modulToRemove=$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 ### ------------------------------------------------------------------------- remove_modul_entry () { if [ ! -f /var/run/mysql.pid ] then mecho -error "Error! Cannot connect to MySQL server." else # take modul_ID from eisportal_modules modul_ID=`${mysql_base_dir}/bin/mysql --skip-column-names -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 = '${modulToRemove}' "` if [ -z ${modul_ID} ] then mecho "Entry for modul ${modulToRemove} not existing in eisportal_modules" mecho "Nothing to delete" else # removing every entry with this modul_ID from eisportal_rights mecho -n "Removing entries from eisportal_rights... " ${mysql_base_dir}/bin/mysql -h ${EISPORTAL_DB_HOST} -D${EISPORTAL_DB_NAME} -u${EISPORTAL_DB_ADMIN_USER} -p${EISPORTAL_DB_ADMIN_PASS} -e"DELETE FROM eisportal_rights WHERE ( modul_ID = '${modul_ID}' );" mecho "Done" # removing entry from eisportal_rights mecho -n "Removing entry from eisportal_moduls... " ${mysql_base_dir}/bin/mysql -h ${EISPORTAL_DB_HOST} -D${EISPORTAL_DB_NAME} -u${EISPORTAL_DB_ADMIN_USER} -p${EISPORTAL_DB_ADMIN_PASS} -e"DELETE FROM eisportal_modules WHERE ( ID = '${modul_ID}' );" mecho "Done" fi fi } ###---------------------------------------------------------------------------- ### main ###---------------------------------------------------------------------------- remove_modul_entry exit 0 ### --------------------------------------------------------------------------- ### End ###----------------------------------------------------------------------------