Modified pip search, garbage deleted
Change-Id: I7688fa408dadd7eb110465fcfa9cc7aa43f03f82
This commit is contained in:
parent
9fe43ab013
commit
30c9f82d17
@ -18,6 +18,8 @@
|
|||||||
LOGLVL=1
|
LOGLVL=1
|
||||||
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
|
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
|
||||||
PREREQ_PKGS="upstart wget git make python-pip python-devel mysql-connector-python"
|
PREREQ_PKGS="upstart wget git make python-pip python-devel mysql-connector-python"
|
||||||
|
PIPAPPS="pip python-pip pip-python"
|
||||||
|
PIPCMD=""
|
||||||
SERVICE_SRV_NAME="murano-conductor"
|
SERVICE_SRV_NAME="murano-conductor"
|
||||||
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
|
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"
|
||||||
@ -50,6 +52,24 @@ in_sys_pkg()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# find pip
|
||||||
|
find_pip()
|
||||||
|
{
|
||||||
|
for cmd in $PIPAPPS
|
||||||
|
do
|
||||||
|
_cmd=$(which $cmd 2>/dev/null)
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z $_cmd ];then
|
||||||
|
echo "Can't find \"pip\" in system, please install it first, exiting!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
PIPCMD=$_cmd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# git clone
|
# git clone
|
||||||
gitclone()
|
gitclone()
|
||||||
{
|
{
|
||||||
@ -72,7 +92,8 @@ CLONE_FROM_GIT=$1
|
|||||||
do
|
do
|
||||||
in_sys_pkg $PKG
|
in_sys_pkg $PKG
|
||||||
done
|
done
|
||||||
|
# Find python pip
|
||||||
|
find_pip
|
||||||
# If clone from git set
|
# If clone from git set
|
||||||
if [ ! -z $CLONE_FROM_GIT ]; then
|
if [ ! -z $CLONE_FROM_GIT ]; then
|
||||||
# Preparing clone root directory
|
# Preparing clone root directory
|
||||||
@ -95,16 +116,10 @@ CLONE_FROM_GIT=$1
|
|||||||
MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/setup.py
|
MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/setup.py
|
||||||
if [ -e $MRN_CND_SPY ];then
|
if [ -e $MRN_CND_SPY ];then
|
||||||
chmod +x $MRN_CND_SPY
|
chmod +x $MRN_CND_SPY
|
||||||
log "$MRN_CND_SPY output:_____________________________________________________________"
|
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
|
## Setup through pip
|
||||||
# Creating tarball
|
# 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
|
cd $SERVICE_CONTENT_DIRECTORY && python $MRN_CND_SPY egg_info
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
log "\"$MRN_CND_SPY\" egg info creation FAILS, exiting!!!"
|
log "\"$MRN_CND_SPY\" egg info creation FAILS, exiting!!!"
|
||||||
@ -117,12 +132,10 @@ CLONE_FROM_GIT=$1
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Running tarball install
|
# 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`)
|
TRBL_FILE=$(basename `ls $SERVICE_CONTENT_DIRECTORY/dist/*.tar.gz`)
|
||||||
pip install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE
|
$PIPCMD install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
log "pip install \"$TRBL_FILE\" FAILS, exiting!!!"
|
log "$PIPCMD install \"$TRBL_FILE\" FAILS, exiting!!!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -142,12 +155,10 @@ CLONE_FROM_GIT=$1
|
|||||||
#for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
|
#for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
|
||||||
for file in `ls $SERVICE_CONTENT_DIRECTORY/etc`
|
for file in `ls $SERVICE_CONTENT_DIRECTORY/etc`
|
||||||
do
|
do
|
||||||
#cp -f "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc/$file" "$ETC_CFG_DIR/$file.sample"
|
|
||||||
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample"
|
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample"
|
||||||
done
|
done
|
||||||
# making templates data
|
# making templates data
|
||||||
log "Making templates directory"
|
log "Making templates directory"
|
||||||
#cp -f -R "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/data" "$ETC_CFG_DIR/"
|
|
||||||
cp -f -R "$SERVICE_CONTENT_DIRECTORY/data" "$ETC_CFG_DIR/"
|
cp -f -R "$SERVICE_CONTENT_DIRECTORY/data" "$ETC_CFG_DIR/"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,30 +188,29 @@ start on runlevel [2345]
|
|||||||
stop on runlevel [!2345]
|
stop on runlevel [!2345]
|
||||||
respawn
|
respawn
|
||||||
exec $SERVICE_EXEC_PATH --config-file=$SERVICE_CONFIG_FILE_PATH" > "/etc/init/$SERVICE_SRV_NAME.conf"
|
exec $SERVICE_EXEC_PATH --config-file=$SERVICE_CONFIG_FILE_PATH" > "/etc/init/$SERVICE_SRV_NAME.conf"
|
||||||
log "Reloading initctl"
|
log "Reloading initctl"
|
||||||
initctl reload-configuration
|
initctl reload-configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
# purge init
|
# purge init
|
||||||
purgeinit()
|
purgeinit()
|
||||||
{
|
{
|
||||||
rm -f /etc/init/$SERVICE_SRV_NAME.conf
|
rm -f /etc/init/$SERVICE_SRV_NAME.conf
|
||||||
log "Reloading initctl"
|
log "Reloading initctl"
|
||||||
initctl reload-configuration
|
initctl reload-configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
# uninstall
|
# uninstall
|
||||||
uninst()
|
uninst()
|
||||||
{
|
{
|
||||||
#rm -f $SERVICE_EXEC_PATH
|
|
||||||
#rm -rf $SERVICE_CONTENT_DIRECTORY
|
|
||||||
# Uninstall trough pip
|
# Uninstall trough pip
|
||||||
# looking up for python package installed
|
find_pip
|
||||||
|
# looking up for python package installed
|
||||||
PYPKG=`echo $SERVICE_SRV_NAME | sed -e 's/murano-//'`
|
PYPKG=`echo $SERVICE_SRV_NAME | sed -e 's/murano-//'`
|
||||||
pip freeze | grep $PYPKG
|
_pkg=$($PIPCMD freeze | grep $PYPKG)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
log "Removing package \"$PYPKG\" with pip"
|
log "Removing package \"$PYPKG\" with pip"
|
||||||
pip uninstall $PYPKG --yes
|
$PIPCMD uninstall $_pkg --yes
|
||||||
else
|
else
|
||||||
log "Python package \"$PYPKG\" not found"
|
log "Python package \"$PYPKG\" not found"
|
||||||
fi
|
fi
|
||||||
@ -249,7 +259,7 @@ case $COMMAND in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
echo "Usage: $(basename "$0") command \nCommands:\n\tinstall - Install $SERVICE_SRV_NAME software\n\tuninstall - Uninstall $SERVICE_SRV_NAME software\n\tinject-init - Add $SERVICE_SRV_NAME to the system start-up\n\tpurge-init - Remove $SERVICE_SRV_NAME from the system start-up"
|
echo -e "Usage: $(basename "$0") command \nCommands:\n\tinstall - Install $SERVICE_SRV_NAME software\n\tuninstall - Uninstall $SERVICE_SRV_NAME software\n\tinject-init - Add $SERVICE_SRV_NAME to the system start-up\n\tpurge-init - Remove $SERVICE_SRV_NAME from the system start-up"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user