simplified install
This commit is contained in:
+10
-2
@@ -4,6 +4,14 @@
|
||||
## ARRAY Functions
|
||||
## ===============
|
||||
|
||||
function is_debian_like {
|
||||
grep -E 'ID=debian|ID_LIKE=debian' /etc/os-release
|
||||
}
|
||||
|
||||
function is_arch_like {
|
||||
grep -E 'ID=arch|ID_LIKE=arch' /etc/os-release
|
||||
}
|
||||
|
||||
function _array_contains {
|
||||
local -n array=$1
|
||||
local element=$2
|
||||
@@ -101,11 +109,11 @@ function isArray {
|
||||
}
|
||||
|
||||
function isDebian {
|
||||
grep ^ID=debian /etc/os-release
|
||||
grep -q ^ID=debian /etc/os-release
|
||||
}
|
||||
|
||||
function isArch {
|
||||
grep ^ID=arch /etc/os-release
|
||||
grep -q ^ID=arch /etc/os-release
|
||||
}
|
||||
|
||||
function os-release {
|
||||
|
||||
+6
-17
@@ -2,9 +2,7 @@
|
||||
|
||||
# CONSTANTS
|
||||
|
||||
#FIXME: source from functions.bash
|
||||
if [[ ! -v DESTINATION && ! -v MAIN_TAR_GZ_URL ]]; then
|
||||
readonly DESTINATION=/opt
|
||||
if [[ ! -v MAIN_TAR_GZ_URL ]]; then
|
||||
readonly MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz"
|
||||
fi
|
||||
|
||||
@@ -12,30 +10,21 @@ fi
|
||||
|
||||
#FIXME: source from functions.bash
|
||||
function bootstrap {
|
||||
if [[ ! -d "$DESTINATION/miaou-bash" ]]; then
|
||||
local temp_dir
|
||||
temp_dir=$(mktemp -d)
|
||||
pushd "$temp_dir" >/dev/null || return 2
|
||||
curl -s -O $MAIN_TAR_GZ_URL
|
||||
tar -xzf main.tar.gz --directory "$DESTINATION"
|
||||
echo "directory: miaou-bash successfully deployed to $DESTINATION"
|
||||
popd >/dev/null || return 3
|
||||
fi
|
||||
cd "$(mktemp -d)" || exit 4
|
||||
curl -s -O $MAIN_TAR_GZ_URL
|
||||
tar -xzf main.tar.gz --directory "$MIAOU_BASH_DIR/.."
|
||||
|
||||
local source_bin="$DESTINATION/miaou-bash/bin/miaou-bash"
|
||||
local source_bin="$MIAOU_BASH_DIR/bin/miaou-bash"
|
||||
local dest_bin="/usr/bin/miaou-bash"
|
||||
if ! cmp -s "$source_bin" "$dest_bin"; then
|
||||
cp -f "$source_bin" "$dest_bin"
|
||||
echo "executable: /usr/bin/miaou-bash freshly created"
|
||||
echo "/usr/bin/miaou-bash updated"
|
||||
fi
|
||||
|
||||
export MIAOU_BASH_DIR="$DESTINATION/miaou-bash"
|
||||
}
|
||||
|
||||
# MAIN
|
||||
|
||||
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1
|
||||
[[ ! -v MIAOU_BASH_DIR ]] && export MIAOU_BASH_DIR="$DESTINATION/miaou-bash"
|
||||
current=$(miaou-bash --version)
|
||||
latest=$("$MIAOU_BASH_DIR/tools/wget_semver" artcode miaou/miaou-bash)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user