From a37468e0270b53d326f2d1699fc73f5b3ae250ab Mon Sep 17 00:00:00 2001 From: a-sansara Date: Sun, 30 Apr 2017 03:00:51 +0200 Subject: [PATCH] add backup last build --- dist/bes-build | 11 ++++++++--- src/build.sh | 9 +++++++-- src/main.sh | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dist/bes-build b/dist/bes-build index 27ea60e..62a40ee 100755 --- a/dist/bes-build +++ b/dist/bes-build @@ -9,8 +9,13 @@ bes.build(){ bes.echo.state $? fi if [ -f "$APP_BIN" ]; then - bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" - rm $APP_BIN + if [ "$1" = "-s" ]; then + bes.echo.action "backup last build ${Coff}dist/$(date +%y%m%d)-$APP_NAME${Coff}" + mv $APP_BIN $APP_DIR/dist/$(date +%y%m%d)-$APP_NAME + else + bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" + rm $APP_BIN + fi bes.echo.state $? fi echo "#!/bin/bash" > $APP_BIN @@ -150,7 +155,7 @@ bes.main(){ echo if [ "$1" = "install" ]; then bes.install - elif [ -z "$1" ]; then + elif [ -z "$1" ] || [ "$1" = "-s" ]; then bes.build "$1" fi echo diff --git a/src/build.sh b/src/build.sh index 9071834..f782516 100644 --- a/src/build.sh +++ b/src/build.sh @@ -9,8 +9,13 @@ bes.build(){ bes.echo.state $? fi if [ -f "$APP_BIN" ]; then - bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" - rm $APP_BIN + if [ "$1" = "-s" ]; then + bes.echo.action "backup last build to ${Coff}dist/$(date +%y%m%d)-$APP_NAME${Coff}" + mv $APP_BIN $APP_DIR/dist/$(date +%y%m%d)-$APP_NAME + else + bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" + rm $APP_BIN + fi bes.echo.state $? fi echo "#!/bin/bash" > $APP_BIN diff --git a/src/main.sh b/src/main.sh index 562d6de..1b7283f 100755 --- a/src/main.sh +++ b/src/main.sh @@ -10,7 +10,7 @@ bes.main(){ echo if [ "$1" = "install" ]; then bes.install - elif [ -z "$1" ]; then + elif [ -z "$1" ] || [ "$1" = "-s" ]; then bes.build "$1" fi echo