add version + install

This commit is contained in:
a-sansara 2017-04-30 03:31:36 +02:00
parent a37468e027
commit ab999408d1
4 changed files with 82 additions and 27 deletions

33
dist/bes-build vendored
View File

@ -10,7 +10,7 @@ bes.build(){
fi fi
if [ -f "$APP_BIN" ]; then if [ -f "$APP_BIN" ]; then
if [ "$1" = "-s" ]; then if [ "$1" = "-s" ]; then
bes.echo.action "backup last build ${Coff}dist/$(date +%y%m%d)-$APP_NAME${Coff}" 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 mv $APP_BIN $APP_DIR/dist/$(date +%y%m%d)-$APP_NAME
else else
bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}"
@ -145,20 +145,47 @@ bes.color.map(){
done done
} }
BES_BUILD_VERSION=0.2 bes.install(){
local path=${1:-/usr/local/bin}
bes.echo.title "Installing bes-build ${Coff}in" "$path"
if [ -f "./bes-build" ]; then
rm ./bes-build
fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/master/dist/bes-build
if [ $? -eq 0 ]; then
chmod +x ./bes-build
if [ -d $path ]; then
bes.echo.action "install bes-build in ${Copt}$path/bes-build"
sudo mv ./bes-build $path/bes-build
bes.echo.state $?
else
bes.echo.error "install directory do not exists : ${Cspe}$path"
fi
else
bes.echo.error "can not download latest version of bes-build"
fi
}
BES_BUILD_VERSION=0.3
APP_DIR=$(pwd) APP_DIR=$(pwd)
APP_NAME=$(basename $(pwd)) APP_NAME=$(basename $(pwd))
APP_BIN=$APP_DIR/dist/$APP_NAME APP_BIN=$APP_DIR/dist/$APP_NAME
bes.main(){ bes.main(){
if [ "$1" = "version" ]; then
echo $BES_BUILD_VERSION
else
bes.title 'bes-build' $BES_BUILD_VERSION bes.title 'bes-build' $BES_BUILD_VERSION
echo echo
if [ "$1" = "install" ]; then if [ "$1" = "install" ]; then
bes.install bes.install $2
elif [ -z "$1" ] || [ "$1" = "-s" ]; then elif [ -z "$1" ] || [ "$1" = "-s" ]; then
bes.build "$1" bes.build "$1"
fi fi
echo echo
fi
} }
bes.main $* bes.main $*

24
src/install.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
bes.install(){
local path=${1:-/usr/local/bin}
bes.echo.title "Installing bes-build ${Coff}in" "$path"
if [ -f "./bes-build" ]; then
rm ./bes-build
fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/master/dist/bes-build
if [ $? -eq 0 ]; then
chmod +x ./bes-build
if [ -d $path ]; then
bes.echo.action "install bes-build in ${Copt}$path/bes-build"
sudo mv ./bes-build $path/bes-build
bes.echo.state $?
else
bes.echo.error "install directory do not exists : ${Cspe}$path"
fi
else
bes.echo.error "can not download latest version of bes-build"
fi
}

View File

@ -1,19 +1,23 @@
#!/bin/bash #!/bin/bash
BES_BUILD_VERSION=0.2 BES_BUILD_VERSION=0.3
APP_DIR=$(pwd) APP_DIR=$(pwd)
APP_NAME=$(basename $(pwd)) APP_NAME=$(basename $(pwd))
APP_BIN=$APP_DIR/dist/$APP_NAME APP_BIN=$APP_DIR/dist/$APP_NAME
bes.main(){ bes.main(){
if [ "$1" = "version" ]; then
echo $BES_BUILD_VERSION
else
bes.title 'bes-build' $BES_BUILD_VERSION bes.title 'bes-build' $BES_BUILD_VERSION
echo echo
if [ "$1" = "install" ]; then if [ "$1" = "install" ]; then
bes.install bes.install $2
elif [ -z "$1" ] || [ "$1" = "-s" ]; then elif [ -z "$1" ] || [ "$1" = "-s" ]; then
bes.build "$1" bes.build "$1"
fi fi
echo echo
fi
} }
bes.main $* bes.main $*