diff --git a/setup.sh b/setup.sh index 5b7463b..d4ccdfc 100644 --- a/setup.sh +++ b/setup.sh @@ -20,7 +20,9 @@ SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd` PREREQ_PKGS="wget make git python-pip python-dev python-mysqldb libxml2-dev libxslt-dev libffi-dev" SERVICE_SRV_NAME="murano-repository" GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"` -ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME" +#ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME" +ETC_CFG_DIR="/etc/murano" +LOG_DIR="/var/log/murano/" SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-repository.conf" # Functions @@ -58,8 +60,8 @@ gitclone() log "Cloning from \"$FROM\" repo to \"$CLONEROOT\"" cd $CLONEROOT && git clone $FROM > /dev/null 2>&1 if [ $? -ne 0 ];then - log "cloning from \"$FROM\" fails, exiting!!!" - exit + log "cloning from \"$FROM\" fails, exiting!!!" + exit fi } @@ -71,7 +73,7 @@ CLONE_FROM_GIT=$1 for PKG in $PREREQ_PKGS do in_sys_pkg $PKG - done + done # If clone from git set if [ ! -z $CLONE_FROM_GIT ]; then @@ -92,25 +94,18 @@ CLONE_FROM_GIT=$1 # Setupping... log "Running setup.py" - #MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/setup.py MRN_CND_SPY=$SERVICE_CONTENT_DIRECTORY/setup.py if [ -e $MRN_CND_SPY ]; then chmod +x $MRN_CND_SPY log "$MRN_CND_SPY output:_____________________________________________________________" - #cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY install - #if [ $? -ne 0 ]; then - # log "\"$MRN_CND_SPY\" python setup FAILS, exiting!" - # exit 1 - #fi ## Setup through pip # Creating tarball - #cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY sdist - rm -rf $SERVICE_CONTENT_DIRECTORY/*.egg-info + rm -rf $SERVICE_CONTENT_DIRECTORY/*.egg-info cd $SERVICE_CONTENT_DIRECTORY && python $MRN_CND_SPY egg_info - if [ $? -ne 0 ];then - log "\"$MRN_CND_SPY\" egg info creation FAILS, exiting!!!" - exit 1 - fi + if [ $? -ne 0 ];then + log "\"$MRN_CND_SPY\" egg info creation FAILS, exiting!!!" + exit 1 + fi rm -rf $SERVICE_CONTENT_DIRECTORY/dist/* cd $SERVICE_CONTENT_DIRECTORY && $MRN_CND_SPY sdist if [ $? -ne 0 ];then @@ -118,8 +113,6 @@ CLONE_FROM_GIT=$1 exit 1 fi # Running tarball install - #TRBL_FILE=$(basename `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/*.tar.gz`) - #pip install $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/$TRBL_FILE TRBL_FILE=$(basename `ls $SERVICE_CONTENT_DIRECTORY/dist/*.tar.gz`) pip install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE if [ $? -ne 0 ];then @@ -138,11 +131,21 @@ CLONE_FROM_GIT=$1 exit 1 fi fi +# Creating log directory for the murano + if [ ! -d $LOG_DIR ];then + log "Creating $LOG_DIR direcory..." + mkdir -p $LOG_DIR + if [ $? -ne 0 ];then + log "Can't create $LOG_DIR, exiting!!!" + exit 1 + fi + chmod -R a+rw $LOG_DIR + fi # making sample configs log "Making sample configuration files at \"$ETC_CFG_DIR\"" for file in `ls $SERVICE_CONTENT_DIRECTORY/etc` do - cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file" + cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file" done } @@ -177,8 +180,8 @@ start on runlevel [2345] stop on runlevel [!2345] respawn exec start-stop-daemon --start --chuid root --user root --name $SERVICE_SRV_NAME --exec $SERVICE_EXEC_PATH -- --config-file=$SERVICE_CONFIG_FILE_PATH" > "/etc/init/$SERVICE_SRV_NAME.conf" -log "Reloading initctl" -initctl reload-configuration + log "Reloading initctl" + initctl reload-configuration } # purge init