From e3e0ab7522823948879308b4a23c7b2a4a2fa219 Mon Sep 17 00:00:00 2001 From: a-sansara Date: Fri, 7 Jul 2017 02:39:42 +0200 Subject: [PATCH] initial commit --- README.md | 4 ++++ bes.ini | 13 +++++++++++++ src/install.sh | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 README.md create mode 100644 bes.ini create mode 100644 src/install.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..36560ff --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +bes-install +=========== + +bes-install is a simple bash bes install library diff --git a/bes.ini b/bes.ini new file mode 100644 index 0000000..646fe6f --- /dev/null +++ b/bes.ini @@ -0,0 +1,13 @@ +[project] +vendor = bes +name = install +version = 1.0 +license = "GNU GPL v3" +author = a-Sansara +type = library +homepage = "https://git.pluie.org/meta-tech/bes-install" +description = "simple bash bes installer" +keywords = "bash, bes, install" + +[require] +bes.echo = 1.1 diff --git a/src/install.sh b/src/install.sh new file mode 100644 index 0000000..c2d0b6b --- /dev/null +++ b/src/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# @author a-Sansara - https://git.pluie.org/meta-tech/bes-install +# @app bes-install +# @license GNU GPL v3 +# @date 2017-07-07 02:21:51 CET +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +function bes.install () +{ + local app=${1} + local url=${2} + local path=${3:-/usr/local/bin} + local done=1 + bes.echo.title "Installing $app ${Coff}in" "$path" + + if [ -f "./$app" ]; then + rm ./$app + fi + wget -q $url + if [ $? -eq 0 ]; then + chmod +x ./$app + if [ -d $path ]; then + sudo mv ./$app $path/$app + local done=$? + bes.echo.state $done + else + bes.echo.error "install directory do not exists : ${Cspe}$path" + fi + else + bes.echo.error "can not download latest version of app $app. please check url : $url" + fi + bes.echo.rs $done +}