#!/bin/bash # # mkmoin 0.1: cria uma nova instancia do moin # feedback: rhatto at riseup.net | gpl # # This 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 any later version. # # This software is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # # section 1: default procedures # TMP="/tmp" MKSITE_BASE="/etc/mksite" CONF="$MKSITE_BASE/mksite.conf" MESSAGES="/usr/share/mksite/mksite.messages" LOCKFILE="$TMP/mksite.lock" HELPER_FUNCTIONS="/usr/libexec/mksite/mksite-helper" # plugin definitions PLUGIN_NAME="moin" USE_VERSION="0" USE_DATABASE="0" if [ -f "$HELPER_FUNCTIONS" ]; then source $HELPER_FUNCTIONS mksite_checks else echo Fatal error: function file not found, aborting. echo Erro fatal: arquivo de funcoes nao encontrado, abortando. exit 1 fi # # section 2: plugin specific functions # function usage { echo "usage: `basename $0` project [-n moin-name]" } function create_config_file { # TODO: # /var/users/usuario/moin/cgi-bin/moin.cgi: # # de: sys.path.insert(0, '/path/to/wikiconfig') # para: sys.path.insert(0, '..') # /var/users/home/usuario/moin/wikiconfig.py: # # data_dir = '../data/' # data_underlay_dir = '../underlay/' # url_prefix = '/moinroot' # logo_string = u'MoinMoin Logo' true } function update_config { true } function write_config_file { # salva as alteracoes no arquivo de configuracao do sitio local tmpfile moin tmpfile="$TMP/$USER-conf.tmp" moin="`mksite_eval_param $MKSITE_BASE/sites/$USER $PLUGIN_NAME_UPPER | sed -e "s/$INSTANCE_NAME//g" -e 's/ //g'`" echo "$PLUGIN_NAME_UPPER=\"$moin $INSTANCE_NAME\"" >> $tmpfile mv $tmpfile $MKSITE_BASE/sites/$USER mksite_write_config_file } function check_instance_installed { if [ -f "$HOME/$USER/$INSTANCE_NAME/cgi-bin/moin.cgi" ]; then INSTALLED="installed" fi } function create_folders { # TODO: arrumar! mkdir -p $HOME/$USER/$INSTANCE_NAME/cgi-bin cd $HOME/$USER/$INSTANCE_NAME/cgi-bin && cp $PLUGIN_DIR/server/moin.cgi . cd .. && cp $PLUGIN_DIR/config/wikiconfig.py . cp -R $PLUGIN_DIR/data . cp -R $PLUGIN_DIR/underlay . chown $APACHE_USER.$USER wikiconfig.py . chmod 460 wikiconfig.py . chown -R $APACHE_USER.$APACHE_GROUP data underlay cgi-bin chmod -R ug+rx cgi-bin && chmod -R o-rwx cgi-bin } function create_contrib_folders { true } # # section 3: main procedure # mksite_init $*