1 Star 0 Fork 39

Franklin杨/vanilla

forked from 周晶/vanilla 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup-framework 2.66 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
### BEGIN ###
# Author: idevz
# Since: 2016/04/09
# Description: Setup Vanilla Framework
### END ###
VANILLA_VERSION=0.1.0.rc7
VANILLA_VERSION_DIR_STR=0_1_0_rc7
VANILLA_PROJ_ROOT=/data/vanilla
OPENRESTY_ROOT=/usr/local/openresty
TIME_MARK=`date "+%Y_%m_%d_%H_%M_%S"`
PLATFORM=`uname`
ECHO_E=" -e "
[ $PLATFORM = "Darwin" ] && ECHO_E=""
alert()
{
MSG=$1
echo $ECHO_E"\033[31m$MSG \033[0m\n"
}
install_vanilla_framework()
{
echo $ECHO_E"\033[45mBegin install Vanilla Frameowrk! \033[0m\n"
VANILLA_PROJ_ROOT=$1
VANILLA_FRAMEWORK_ROOT=$1/framework
VANILLA_FRAMEWORK_V=$VANILLA_FRAMEWORK_ROOT/$VANILLA_VERSION_DIR_STR
[ -n $2 ] && OPENRESTY_ROOT=$2
[ ! -d $OPENRESTY_ROOT ] && alert "OPENRESTY_ROOT set ERROR, OpenResty Path "$OPENRESTY_ROOT" didn't exist, and -o to set the ture OPENRESTY_ROOT" && exit 1
VANILLA_BIN=/usr/local/bin/vanilla-$VANILLA_VERSION
VANILLA_CONSOLE_BIN=/usr/local/bin/v-console-$VANILLA_VERSION
echo $VANILLA_FRAMEWORK_V
[ -f $VANILLA_BIN ] && mv -f $VANILLA_BIN $VANILLA_BIN".old_"$TIME_MARK
[ -f $VANILLA_CONSOLE_BIN ] && mv -f $VANILLA_CONSOLE_BIN $VANILLA_CONSOLE_BIN".old_"$TIME_MARK
[ -d $VANILLA_FRAMEWORK_V ] && mv -f $VANILLA_FRAMEWORK_V $VANILLA_FRAMEWORK_V".old_"$TIME_MARK
make clean
./configure --prefix=$VANILLA_FRAMEWORK_ROOT --openresty-path=$OPENRESTY_ROOT
make install
if [[ $? -ne 0 ]];then
alert "Install Vanilla Frameowrk Fail. Pleas check your access permissions."
exit 1
fi
echo $ECHO_E"\033[35mVanilla Frameowrk Installed $VANILLA_FRAMEWORK_ROOT \033[0m\n"
}
show_usage()
{
echo $ECHO_E"`printf %-16s "Usage: $0"`"
echo $ECHO_E"`printf %-16s ` -h show this help info"
echo $ECHO_E"`printf %-16s ` -v VANILLA_PROJ_ROOT, vanilla project root, will contain vanilla framework and apps"
echo $ECHO_E"`printf %-16s ` -o OPENRESTY_ROOT, openresty install path(openresty root)"
}
while getopts v:o:h OPT; do
case "$OPT" in
v )
VANILLA_PROJ_ROOT=$OPTARG
;;
o )
OPENRESTY_ROOT=$OPTARG
;;
h )
show_usage && exit 0
;;
-- )
shift break
;;
? )
alert "ERROR: unknown argument!" && show_usage && exit 1
;;
esac
done
install_vanilla_framework $VANILLA_PROJ_ROOT $OPENRESTY_ROOT
echo
echo $ECHO_E"You are setup Vanilla-$VANILLA_VERSION and using:"
echo $ECHO_E"`printf %-30s "\"$OPENRESTY_ROOT\""` ---- as OpenResty install path(OpenResty root)"
echo $ECHO_E"`printf %-30s "\"$VANILLA_PROJ_ROOT\""` ---- as vanilla project root(will contain vanilla framework and apps)"
echo
exit 0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/franklinyang/vanilla.git
git@gitee.com:franklinyang/vanilla.git
franklinyang
vanilla
vanilla
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385