From e6b82d88fd59b97ce9932e651316fd578f68bb51 Mon Sep 17 00:00:00 2001 From: asa1997 Date: Mon, 13 Nov 2023 19:58:36 +0530 Subject: [PATCH] Updating version of release to 0.3.0 --- docs/get.bliman.io | 777 +++++++++++++++++++++++++++++++++++++++++++++ docs/index.md | 1 + mkdocs.yml | 1 + 3 files changed, 779 insertions(+) create mode 100644 docs/get.bliman.io create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/docs/get.bliman.io b/docs/get.bliman.io new file mode 100644 index 0000000..8f010a9 --- /dev/null +++ b/docs/get.bliman.io @@ -0,0 +1,777 @@ +#!/bin/bash +# install:- channel: stable; cliVersion: 5.18.1; cliNativeVersion: 0.2.9; api: https://api.bliman.io/2 + +track_last_command() { + last_command=$current_command + current_command=$BASH_COMMAND +} + +echo_failed_command() { + local exit_code="$?" + if [[ "$exit_code" != "0" ]]; then + echo "'$last_command': command failed with exit code $exit_code." + fi +} + +function infer_platform() { + local kernel + local machine + + kernel="$(uname -s)" + machine="$(uname -m)" + + case $kernel in + Linux) + case $machine in + i686) + echo "linuxx32" + ;; + x86_64) + echo "linuxx64" + ;; + armv6l) + echo "linuxarm32hf" + ;; + armv7l) + echo "linuxarm32hf" + ;; + armv8l) + echo "linuxarm32hf" + ;; + aarch64) + echo "linuxarm64" + ;; + *) + echo "exotic" + ;; + esac + ;; + Darwin) + case $machine in + x86_64) + echo "darwinx64" + ;; + arm64) + if [[ "$bliman_rosetta2_compatible" == 'true' ]]; then + echo "darwinx64" + else + echo "darwinarm64" + fi + ;; + *) + echo "darwinx64" + ;; + esac + ;; + MSYS* | MINGW*) + case $machine in + x86_64) + echo "windowsx64" + ;; + *) + echo "exotic" + ;; + esac + ;; + *) + echo "exotic" + ;; + esac +} + +function __bliman_quick_install() { + + set -e + trap track_last_command DEBUG + trap echo_failed_command EXIT + + # Global variables + export BLIMAN_SERVICE="https://raw.githubusercontent.com" + export BLIMAN_NAMESPACE="Be-Secure" + export BLIMAN_REPO_URL="$BLIMAN_SERVICE/$BLIMAN_NAMESPACE/BLIman/main" + export BLIMAN_VERSION="0.3.0" + export BLIMAN_LAB_URL="$BLIMAN_SERVICE/$BLIMAN_NAMESPACE/BeSLab/main" + + # export BLIMAN_NATIVE_VERSION="0.2.9" + # infer platform + + BLIMAN_PLATFORM="$(infer_platform)" + export BLIMAN_PLATFORM + + if [ -z "$BLIMAN_DIR" ]; then + BLIMAN_DIR="$HOME/.bliman" + BLIMAN_DIR_RAW="$HOME/.bliman" + else + BLIMAN_DIR_RAW="$BLIMAN_DIR" + fi + export BLIMAN_DIR + + # Local variables + bliman_src_folder="${BLIMAN_DIR}/src" + bliman_tmp_folder="${BLIMAN_DIR}/tmp" + bliman_ext_folder="${BLIMAN_DIR}/ext" + bliman_etc_folder="${BLIMAN_DIR}/etc" + bliman_var_folder="${BLIMAN_DIR}/var" + bliman_candidates_folder="${BLIMAN_DIR}/candidates" + bliman_config_file="${bliman_etc_folder}/config" + bliman_bash_profile="${HOME}/.bash_profile" + bliman_bashrc="${HOME}/.bashrc" + bliman_zshrc="${ZDOTDIR:-${HOME}}/.zshrc" + + bliman_init_snippet=$( + cat < /dev/null; then + # echo "Not found." + # echo "======================================================================================================" + # echo " Please install unzip on your system using your favourite package manager." + # echo "" + # echo " Restart after installing unzip." + # echo "======================================================================================================" + # echo "" + # exit 1 + # fi + + # echo "Looking for zip..." + # if ! command -v zip > /dev/null; then + # echo "Not found." + # echo "======================================================================================================" + # echo " Please install zip on your system using your favourite package manager." + # echo "" + # echo " Restart after installing zip." + # echo "======================================================================================================" + # echo "" + # exit 1 + # fi + + # echo "Looking for curl..." + # if ! command -v curl > /dev/null; then + # echo "Not found." + # echo "" + # echo "======================================================================================================" + # echo " Please install curl on your system using your favourite package manager." + # echo "" + # echo " Restart after installing curl." + # echo "======================================================================================================" + # echo "" + # exit 1 + # fi + + if [[ "$solaris" == true ]]; then + echo "Looking for gsed..." + if [ -z $(which gsed) ]; then + echo "Not found." + echo "" + echo "======================================================================================================" + echo " Please install gsed on your solaris system." + echo "" + echo " BLIMAN uses gsed extensively." + echo "" + echo " Restart after installing gsed." + echo "======================================================================================================" + echo "" + exit 1 + fi + else + echo "Looking for sed..." + if [ -z $(command -v sed) ]; then + echo "Not found." + echo "" + echo "======================================================================================================" + echo " Please install sed on your system using your favourite package manager." + echo "" + echo " Restart after installing sed." + echo "======================================================================================================" + echo "" + exit 1 + fi + fi + + echo "Installing BLIMAN scripts..." + + # Create directory structure + + echo "Create distribution directories..." + mkdir -p "$bliman_tmp_folder" + mkdir -p "$bliman_ext_folder" + mkdir -p "$bliman_etc_folder" + mkdir -p "$bliman_var_folder" + mkdir -p "$bliman_candidates_folder" + mkdir -p "$bliman_src_folder" + + echo "Getting available candidates..." + echo "from ${BLIMAN_REPO_URL}/candidates.txt" + BLIMAN_CANDIDATES_CSV=$(curl -s -k "${BLIMAN_REPO_URL}/candidates.txt") + echo "$BLIMAN_CANDIDATES_CSV" >"${BLIMAN_DIR}/var/candidates" + + echo "Prime the config file..." + touch "$bliman_config_file" + echo "bliman_auto_answer=false" >>"$bliman_config_file" + if [ -z "$ZSH_VERSION" -a -z "$BASH_VERSION" ]; then + echo "bliman_auto_complete=false" >>"$bliman_config_file" + else + echo "bliman_auto_complete=false" >>"$bliman_config_file" + fi + touch "$bliman_config_file" + { + echo "bliman_auto_env=false" + echo "bliman_auto_update=true" + echo "bliman_beta_channel=false" + echo "bliman_checksum_enable=true" + echo "bliman_colour_enable=true" + echo "bliman_curl_connect_timeout=7" + echo "bliman_curl_max_time=10" + echo "bliman_debug_mode=false" + echo "bliman_insecure_ssl=false" + echo "bliman_rosetta2_compatible=false" + echo "bliman_selfupdate_feature=true" + } >>"$bliman_config_file" + + # script cli distribution + echo "Installing script cli archive..." + # fetch distribution + bliman_zip_file="${bliman_tmp_folder}/bliman-${BLIMAN_VERSION}.zip" + echo "* Downloading..." + curl -s -k --location --progress-bar "${BLIMAN_SERVICE}/${BLIMAN_NAMESPACE}/BLIman/dist/dist/bliman-latest.zip" > "$bliman_zip_file" + + # check integrity + echo "* Checking archive integrity..." + ARCHIVE_OK=$(unzip -qt "$bliman_zip_file" | grep 'No errors detected in compressed data') + if [[ -z "$ARCHIVE_OK" ]]; then + echo "Downloaded zip archive corrupt. Are you connected to the internet?" + echo "" + echo "If problems persist, please raise an issue in:" + echo "* https://github.com/Be-Secure/BLIman/issues" + exit + fi + + # extract archive + echo "* Extracting archive..." + if [[ "$cygwin" == 'true' ]]; then + bliman_tmp_folder=$(cygpath -w "$bliman_tmp_folder") + bliman_zip_file=$(cygpath -w "$bliman_zip_file") + fi + unzip -qo "$bliman_zip_file" -d "$bliman_tmp_folder" + + # copy in place + echo "* Copying archive contents..." + #cp -r "contrib/" "$BLIMAN_DIR" + #cp -r "src/main/bash" "$bliman_src_folder" + mkdir -p "$BLIMAN_DIR/bin/" + cp -rf "${bliman_tmp_folder}"/bliman-* "$bliman_src_folder" + mv "$bliman_src_folder"/bliman-init.sh "$BLIMAN_DIR/bin/" + + # clean up + echo "* Cleaning up..." + rm -rf "$bliman_tmp_folder"/bliman-*.sh + rm -rf "$bliman_zip_file" + + echo "" + + # # native cli distribution + # if [[ "$BLIMAN_PLATFORM" != "exotic" ]]; then + # # fetch distribution + # bliman_zip_file="${bliman_tmp_folder}/bliman-native-${BLIMAN_NATIVE_VERSION}.zip" + # echo "* Downloading..." + # curl --fail --location --progress-bar "${BLIMAN_SERVICE}/broker/download/native/install/${BLIMAN_NATIVE_VERSION}/${BLIMAN_PLATFORM}" > "$bliman_zip_file" + + # # check integrity + # echo "* Checking archive integrity..." + # ARCHIVE_OK=$(unzip -qt "$bliman_zip_file" | grep 'No errors detected in compressed data') + # if [[ -z "$ARCHIVE_OK" ]]; then + # echo "Downloaded zip archive corrupt. Are you connected to the internet?" + # echo "" + # echo "If problems persist, please ask for help on our Slack:" + # echo "* easy sign up: https://slack.bliman.io/" + # echo "* report on channel: https://bliman.slack.com/app_redirect?channel=user-issues" + # exit + # fi + + # # extract archive + # echo "* Extracting archive..." + # if [[ "$cygwin" == 'true' ]]; then + # bliman_tmp_folder=$(cygpath -w "$bliman_tmp_folder") + # bliman_zip_file=$(cygpath -w "$bliman_zip_file") + # fi + # unzip -qo "$bliman_zip_file" -d "$bliman_tmp_folder" + + # # copy in place + # echo "* Copying archive contents..." + # rm -f "$bliman_libexec_folder"/* + # cp -rf "${bliman_tmp_folder}"/bliman-*/* "$BLIMAN_DIR" + + # # clean up + # echo "* Cleaning up..." + # rm -rf "$bliman_tmp_folder"/bliman-* + # rm -rf "$bliman_zip_file" + + # echo "" + # fi + + echo "Set version to $BLIMAN_VERSION ..." + echo "$BLIMAN_VERSION" >"${BLIMAN_DIR}/var/version" + + echo "Set native version to $BLIMAN_NATIVE_VERSION ..." + echo "$BLIMAN_NATIVE_VERSION" >"${BLIMAN_DIR}/var/version_native" + + if [[ $darwin == true ]]; then + touch "$bliman_bash_profile" + echo "Attempt update of login bash profile on OSX..." + if [[ -z $(grep 'bliman-init.sh' "$bliman_bash_profile") ]]; then + echo -e "\n$bliman_init_snippet" >>"$bliman_bash_profile" + echo "Added bliman init snippet to $bliman_bash_profile" + fi + else + echo "Attempt update of interactive bash profile on regular UNIX..." + touch "${bliman_bashrc}" + if [[ -z $(grep 'bliman-init.sh' "$bliman_bashrc") ]]; then + echo -e "\n$bliman_init_snippet" >>"$bliman_bashrc" + echo "Added bliman init snippet to $bliman_bashrc" + fi + fi + + echo "Attempt update of zsh profile..." + touch "$bliman_zshrc" + if [[ -z $(grep 'bliman-init.sh' "$bliman_zshrc") ]]; then + echo -e "\n$bliman_init_snippet" >>"$bliman_zshrc" + echo "Updated existing ${bliman_zshrc}" + fi + + __bliman_load_genesis_file + __bliman_write_tmpl_vagrantfile + + echo -e "\n\n\nAll done!\n\n" + + echo "You are subscribed to the STABLE channel." + + echo "" + echo "Please open a new terminal, or run the following in the existing one:" + echo "" + echo " source \"${BLIMAN_DIR}/bin/bliman-init.sh\"" + echo "" + echo "Then issue the following command:" + echo "" + echo " bli help" + echo "" + echo "Enjoy!!!" + +} + +function __bliman_write_tmpl_vagrantfile() +{ + local vagrantfile_path + vagrantfile_path="$BLIMAN_DIR/tmp/Vagrantfile" + touch "$vagrantfile_path" + cat <>"$vagrantfile_path" +# # -*- mode: ruby -*- +# # vi: set ft=ruby : + +VAGRANTFILE_API_VERSION = "2" +Vagrant.require_version '>= 1.8.1' + + +# Cross-platform way of finding an executable in the \$PATH. +def which(cmd) + exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] + ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| + exts.each { |ext| + exe = File.join(path, "#{cmd}#{ext}") + return exe if File.executable?(exe) && !File.directory?(exe) + } + end + return nil +end + +# Use oah-config.yml for basic VM configuration. +require 'yaml' + + +#dir = File.dirname(File.expand_path(__FILE__)) +dir = File.dirname("../../../") + +if !File.exist?("#{dir}/oah-config.yml") + raise "Configuration file #{dir}/oah-config.yml not found! Please copy example.oah-config.yml to oah-config.yml and try again." +end +vconfig = YAML::load_file("#{dir}/oah-config.yml") + + +\$script = <