diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 6728a8c..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json -# -source ./scripts/env.sh -source ./scripts/util.sh - -./scripts/pull.sh -if [ $? -ne 0 ]; then - # failure - tput bel;tput bel;tput bel;tput bel - echo -e "\n${fgLtRed}Pull command failed. Giving up.${fgLtWhi}\n" - echo ${output} - exit 255 -fi - -# get version of package from package.json -package_version=$(jq -r ".version" workspace/extensions/webssh2/package.json) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$package_version - -echoNotice "Creating workspace package" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost /bin/tar --exclude='./extensions/webssh2/config.json' -czf - -C /var/ilx/workspaces/Common/$webssh_workspace_name . > Build/Release/$webssh_package_name-$package_version.tgz" - -echoNotice "Creating SHA256 hash" -runCommand "shasum -a 256 Build/Release/$webssh_package_name-$package_version.tgz > Build/Release/$webssh_package_name-$package_version.tgz.sha256" - -echoNotice "Copying to current" -runCommand "cp Build/Release/$webssh_package_name-$package_version.tgz $webssh_pua_location/$webssh_package_name-current.tgz && \ - cp Build/Release/$webssh_package_name-$package_version.tgz.sha256 $webssh_pua_location/$webssh_package_name-current.tgz.sha256" - -echoNotice "Deleting any '.DS_Store' files" -runCommand "find . -name '.DS_Store' -type f -delete" - -echo -e "\nWorkspace packages located at:\n" -echo " Build/Release/$webssh_package_name-$package_version.tgz" -echo " Build/Release/$webssh_package_name-$package_version.tgz.sha256" -echo " $webssh_pua_location/$webssh_package_name-current.tgz" -echo " $webssh_pua_location/$webssh_package_name-current.tgz.sha256" - -echo -e "\nšŸ‘ Build Complete šŸ‘\n" - -exit 0 diff --git a/scripts/env.sh b/scripts/env.sh deleted file mode 100755 index 1955d68..0000000 --- a/scripts/env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -#webssh_ilxhost=root@192.168.30.209 -webssh_ilxhost=root@192.168.30.203 -webssh_workspace_name=webssh2 -webssh_package_name=BIG-IP-ILX-WebSSH2 -webssh_pua_location=./bin \ No newline at end of file diff --git a/scripts/pull.sh b/scripts/pull.sh deleted file mode 100755 index 9826955..0000000 --- a/scripts/pull.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# ./scripts/pull.sh -# -# bill@f5.com -# -# Pulls an ILX workspace from a BIG-IP and syncs to ./workspace, excludes -# ./workspace/extensions/ephemeral_auth/node_modules. -# -source ./scripts/env.sh -source ./scripts/util.sh - -# get version of package from package.json -PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION - -echo "Pull ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}" - -# check to see if the workspace actually exists before attempting to copy over - -echoNotice "Checking for existing workspace ${fgLtCya}$webssh_workspace_name${fgLtWhi}" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1" - -echoNotice "Pulling ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}" -runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --include=\"extensions/ephemeral_auth/node_modules/f5-*\" --exclude=\".DS_Store\" --exclude=\"extensions/ephemeral_auth/node_modules/*\" $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/. workspace/. 2>&1" - -echo -e "\nšŸ‘ Pull complete šŸ‘\n" - -exit 0 diff --git a/scripts/push.sh b/scripts/push.sh deleted file mode 100755 index 02a641a..0000000 --- a/scripts/push.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# ./scripts/push.sh -# -# bill@f5.com -# -# Pushes ./workspace to a BIG-IP ILX workspace -# -source ./scripts/env.sh -source ./scripts/util.sh - -# get version of package from package.json -PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION - -echo "Push ${fgLtCya}$webssh_workspace_name${fgLtWhi} to ${fgLtCya}$webssh_ilxhost${fgLtWhi}" - -echoNotice "Checking $webssh_ilxhost for workspace $webssh_workspace_name" -output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1) -result="$?" 2>&1 -if [ $result -ne 0 ]; then - echo "āŒ" - echoNotice "Attempting to create workspace" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"tmsh create ilx workspace $webssh_workspace_name node-version 6.9.1\" 2>&1" -else - echo "āœ…" -fi - -echoNotice "Pushing ./workspace to $webssh_ilxhost at $webssh_workspace_name" -runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --delete --exclude='.DS_Store' --exclude extensions/webssh2/node_modules workspace/. $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/." - -echoNotice "Installing node modules at $webssh_workspace_name on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; npm i --production\" 2>&1" - -echoNotice "Setting permissions at $webssh_workspace_name on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"chown -R root.sdm /var/ilx/workspaces/Common/$webssh_workspace_name/; \ - chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$webssh_workspace_name/; \ - chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/version; \ - chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/node_version\" 2>&1" - -echoNotice "Deleting $webssh_workspace_name/node_modules/.bin on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; rm -rf node_modules/.bin\" 2>&1" - -# switch plugin to new workspace -echoNotice "Checking to see if plugin exists" -output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx plugin WebSSH_plugin one-line 2>&1) -result="$?" 2>&1 -if [ $result -ne 0 ]; then - echo "āŒ" - echoNotice "Attempting to create plugin" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh create ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1" -else - echo "āœ…" - echoNotice "Switching plugin to $webssh_workspace_name" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh modify ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1" -fi - -echo -e "\nšŸ‘ Push complete šŸ‘\n" - -exit 0 diff --git a/scripts/util.sh b/scripts/util.sh deleted file mode 100755 index 3029a27..0000000 --- a/scripts/util.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# Utility functions / scripts - -echoNotice () { echo -e -n "\n$@... "; } - -fgLtRed=$(tput bold;tput setaf 1) -fgLtGrn=$(tput bold;tput setaf 2) -fgLtYel=$(tput bold;tput setaf 3) -fgLtBlu=$(tput bold;tput setaf 4) -fgLtMag=$(tput bold;tput setaf 5) -fgLtCya=$(tput bold;tput setaf 6) -fgLtWhi=$(tput bold;tput setaf 7) -fgLtGry=$(tput bold;tput setaf 8) - -echo ${fgLtWhi} - -# check for jq and try to install... -output=$(which jq 2>&1) -if [[ $? -ne 0 ]]; then - echo -e "You need to install jq: https://stedolan.github.io/jq\n" - echo -e "If you have *brew* you can install with:\n" - echo -e " brew install jq\n" - echo -n "Do you want me to try and install that for you (Y/n)? " - read -n1 yesno - echo - if [[ ("$yesno" != "y") ]]; then - echo -e "\nUnable to continue, install jq first.\n\n" - exit 255 - else - which brew - if [[ $? -ne 0 ]]; then - echo -e "\nYou're a mess... You don't even have brew installed...\nMaybe you should check it out\n" - echo -e " https://brew.sh/\n\n" - exit 255 - fi - echo - brew install jq - if [[ $? -ne 0 ]]; then - echo -e "\nLooks like that failed, I can't do everything... Quitting, install jq...\n" - exit 255 - fi - fi -fi - -# checks the output of a command to get the status and report/handle failure -checkOutput() { - if [ $result -eq 0 ]; then - # success - #echo "${fgLtGrn}[OK]${fgLtWhi}" - echo "āœ…" - return - else - # failure - tput bel;tput bel;tput bel;tput bel - #echo "${fgLtRed}[FAILED]${fgLtWhi}" - echo "āŒ" - echo -e "\nPrevious command failed in ${script_path}/${scriptname} with error level: ${result}" - echo -e "\nCommand:\n" - echo " ${command}" - echo -e "\nSTDOUT/STDERR:\n" - echo ${output} - exit 255 - fi -} - -# run a comand and check call checkOutput -runCommand() { - # $1 command - command=$@ - output=$((eval $command) 2>&1) - result="$?" 2>&1 - prevline=$(($LINENO-2)) - checkOutput -} \ No newline at end of file diff --git a/scripts/ver.sh b/scripts/ver.sh deleted file mode 100755 index 72101c3..0000000 --- a/scripts/ver.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -## displays and optionally changes version of product - -source ./scripts/env.sh - -source ./scripts/util.sh - -echo -# get current version of workspace, ask to change or rebuild -webssh_ilx_ver=$(jq -r ".version" ./workspace/extensions/webssh2/package.json 2>&1) -if [[ $? -ne 0 ]]; then exit; echo "error reading ILX irule version";fi - -echo "Current version of $webssh_workspace_name is: $webssh_ilx_ver" - -echo -n "If you want to change this version, enter it now otherwise press enter to retain: " - -read newver - -echo - -if [[ ("$newver" != "") ]]; then - echo "Updating version of ILX to: $newver" - export newver - jq --arg newver "$newver" '.version = $newver' < ./workspace/extensions/webssh2/package.json > ./workspace/extensions/webssh2/package.json.new - if [[ $? -ne 0 ]]; then exit; echo "error changing version - ilx";fi - mv ./workspace/extensions/webssh2/package.json.new ./workspace/extensions/webssh2/package.json -else - echo "No changes made" -fi