2014-05-09 17:56:14 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# release leanote
|
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
# 当前路径
|
2014-05-09 17:56:14 +08:00
|
|
|
SP=$(cd "$(dirname "$0")"; pwd)
|
|
|
|
|
|
|
|
# tmp path to store leanote release files
|
|
|
|
tmp="/Users/life/Desktop/leanote_release"
|
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
# version
|
2015-11-23 10:39:01 +08:00
|
|
|
V="v1.4"
|
2015-04-20 19:51:20 +08:00
|
|
|
|
|
|
|
##=================================
|
|
|
|
# 1. 先build 成 3个平台, 2种bit = 6种
|
|
|
|
##=================================
|
|
|
|
|
|
|
|
# cd /Documents/Go/package2/src/github.com/leanote/leanote/bin
|
|
|
|
# GOOS=darwin GOARCH=amd64 go build -o leanote-darwin-amd64 ../app/tmp
|
2014-10-23 11:41:02 +08:00
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
cd $SP
|
|
|
|
|
|
|
|
# $1 = darwin, linux
|
|
|
|
# $2 = amd64
|
|
|
|
function build()
|
|
|
|
{
|
|
|
|
echo build-$1-$2
|
|
|
|
if [ $1 = "linux" -o $1 = "darwin" ]
|
|
|
|
then
|
|
|
|
suffix=""
|
|
|
|
else
|
|
|
|
suffix=".exe"
|
|
|
|
fi
|
|
|
|
|
|
|
|
GOOS=$1 GOARCH=$2 go build -o leanote-$1-$2$suffix ../app/tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
build "linux" "386";
|
|
|
|
build "linux" "amd64";
|
2015-11-23 10:39:01 +08:00
|
|
|
build "linux" "arm";
|
2015-09-17 18:52:10 +08:00
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
build "windows" "386";
|
|
|
|
build "windows" "amd64";
|
|
|
|
|
2015-09-18 11:23:00 +08:00
|
|
|
# build "darwin" "386";
|
2015-09-17 18:52:10 +08:00
|
|
|
build "darwin" "amd64";
|
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
|
|
|
|
##======================
|
|
|
|
# 2. release目录准备工作
|
|
|
|
##======================
|
2014-05-09 17:56:14 +08:00
|
|
|
rm -rf $tmp/leanote
|
|
|
|
mkdir -p $tmp/leanote/app
|
|
|
|
mkdir -p $tmp/leanote/conf
|
|
|
|
mkdir -p $tmp/leanote/bin
|
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
##==================
|
|
|
|
# 3. 复制
|
|
|
|
##==================
|
|
|
|
|
|
|
|
cd $SP
|
|
|
|
cd ../
|
|
|
|
|
2014-05-09 17:56:14 +08:00
|
|
|
# bin
|
|
|
|
cp -r ./bin/src $tmp/leanote/bin/
|
|
|
|
cp ./bin/run.sh $tmp/leanote/bin/
|
2015-04-20 19:51:20 +08:00
|
|
|
cp ./bin/run.bat $tmp/leanote/bin/
|
2014-10-23 11:41:02 +08:00
|
|
|
|
2014-05-09 17:56:14 +08:00
|
|
|
# views
|
|
|
|
cp -r ./app/views $tmp/leanote/app
|
2015-04-20 19:51:20 +08:00
|
|
|
# 可不要, 源码
|
|
|
|
#cp -r ./app/service $tmp/leanote/app/service
|
|
|
|
#cp -r ./app/controllers $tmp/leanote/app/controllers
|
|
|
|
#cp -r ./app/db $tmp/leanote/app/db
|
|
|
|
#cp -r ./app/info $tmp/leanote/app/info
|
|
|
|
#cp -r ./app/lea $tmp/leanote/app/lea
|
2014-05-27 13:29:19 +08:00
|
|
|
|
2014-05-09 17:56:14 +08:00
|
|
|
# conf
|
2015-04-20 19:51:20 +08:00
|
|
|
cp ./conf/app.conf $tmp/leanote/conf/app.conf
|
|
|
|
cp ./conf/routes $tmp/leanote/conf/routes
|
2015-04-20 20:51:03 +08:00
|
|
|
# 处理app.conf, 还原配置
|
|
|
|
cat $tmp/leanote/conf/app.conf | sed 's/db.dbname=leanote.*#/db.dbname=leanote #/' > $tmp/leanote/conf/app.conf2 # 不能直接覆盖
|
|
|
|
rm $tmp/leanote/conf/app.conf
|
|
|
|
mv $tmp/leanote/conf/app.conf2 $tmp/leanote/conf/app.conf
|
2014-05-09 17:56:14 +08:00
|
|
|
|
|
|
|
# others
|
|
|
|
cp -r ./messages ./public ./mongodb_backup $tmp/leanote/
|
|
|
|
|
|
|
|
# delete some files
|
|
|
|
rm -r $tmp/leanote/public/tinymce/classes
|
2014-09-04 16:15:57 +08:00
|
|
|
rm -r $tmp/leanote/public/upload
|
|
|
|
mkdir $tmp/leanote/public/upload
|
|
|
|
rm -r $tmp/leanote/public/.codekit-cache
|
|
|
|
rm $tmp/leanote/public/.DS_Store
|
|
|
|
rm $tmp/leanote/public/config.codekit
|
2014-05-09 17:56:14 +08:00
|
|
|
|
|
|
|
# make link
|
2015-04-20 19:51:20 +08:00
|
|
|
# cd $tmp/leanote/bin
|
2014-12-07 22:02:01 +08:00
|
|
|
# ln -s ../../../../ ./src/github.com/leanote/leanote
|
2014-05-09 17:56:14 +08:00
|
|
|
|
|
|
|
# archieve
|
|
|
|
# << 'BLOCK
|
2014-12-07 22:02:01 +08:00
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
##===========
|
|
|
|
# 4. 打包
|
|
|
|
##===========
|
|
|
|
# $1 = linux
|
|
|
|
# $2 = 386, amd64
|
|
|
|
|
|
|
|
# 创建一个$V的目录存放之
|
|
|
|
rm -rf $tmp/$V
|
|
|
|
mkdir $tmp/$V
|
|
|
|
|
|
|
|
function tarRelease()
|
|
|
|
{
|
|
|
|
echo tar-$1-$2
|
|
|
|
cd $SP
|
|
|
|
cd ../
|
|
|
|
rm $tmp/leanote/bin/leanote-* # 删除之前的bin文件
|
|
|
|
rm $tmp/leanote/bin/run* # 删除之前的run.sh 或 run.bat
|
|
|
|
|
|
|
|
if [ $1 = "linux" -o $1 = "darwin" ]
|
|
|
|
then
|
|
|
|
suffix=""
|
|
|
|
cp ./bin/run.sh $tmp/leanote/bin/
|
|
|
|
else
|
|
|
|
cp ./bin/run.bat $tmp/leanote/bin/
|
|
|
|
suffix=".exe"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp ./bin/leanote-$1-$2$suffix $tmp/leanote/bin/
|
|
|
|
cd $tmp
|
|
|
|
tar -cf $tmp/$V/leanote-$1-$2-$V.bin.tar leanote
|
|
|
|
gzip $tmp/$V/leanote-$1-$2-$V.bin.tar
|
|
|
|
}
|
|
|
|
|
|
|
|
tarRelease "linux" "386";
|
|
|
|
tarRelease "linux" "amd64";
|
2015-11-23 10:39:01 +08:00
|
|
|
tarRelease "linux" "arm";
|
2015-09-17 18:52:10 +08:00
|
|
|
|
2015-04-20 19:51:20 +08:00
|
|
|
tarRelease "windows" "386";
|
|
|
|
tarRelease "windows" "amd64";
|
2014-12-07 22:02:01 +08:00
|
|
|
|
2015-09-18 11:23:00 +08:00
|
|
|
# tarRelease "darwin" "386";
|
2015-09-17 18:52:10 +08:00
|
|
|
tarRelease "darwin" "amd64";
|
|
|
|
|
2015-06-15 19:47:22 +08:00
|
|
|
# BLOCK'
|