From dddfcf2832db67f10f0f6d8eb596d7eef59d9fb3 Mon Sep 17 00:00:00 2001 From: khs1994 Date: Sun, 31 Dec 2017 10:12:25 +0800 Subject: [PATCH] Add shell script for offline read --- bin/offline | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 bin/offline diff --git a/bin/offline b/bin/offline new file mode 100755 index 0000000..dccf5ed --- /dev/null +++ b/bin/offline @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ -f offline ];then echo "请在项目根目录执行 $0"; exit 1; fi + +command -v docker-compose > /dev/null 2>&1 + +if [ $? != 0 ];then echo "请安装 docker-compose"; exit 1; fi + +if [ "$1" = update ];then + status=`git status -s` + if [ -z "$status" ];then + git fetch --depth=1 origin master + git reset --hard origin/master + else + echo "您已修改项目,请提交或恢复原状!" + exit 1 + fi +fi + +docker-compose up server