diff --git a/modules/install/tools/golang-install.func b/modules/install/golang-install.func similarity index 100% rename from modules/install/tools/golang-install.func rename to modules/install/golang-install.func diff --git a/modules/install/tools/hugo-install.func b/modules/install/hugo-install.func similarity index 100% rename from modules/install/tools/hugo-install.func rename to modules/install/hugo-install.func diff --git a/modules/install/tools/rclone-install.func b/modules/install/rclone-install.func similarity index 100% rename from modules/install/tools/rclone-install.func rename to modules/install/rclone-install.func diff --git a/modules/machine.sh b/modules/machine.sh new file mode 100644 index 0000000..013829b --- /dev/null +++ b/modules/machine.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +function get_platform () { + + local OS + local ARCH + local PLATFORM + + OS="$(uname -s)" + ARCH="$(uname -m)" + + case $OS in + "Linux") + case $ARCH in + "x86_64") + ARCH=amd64 + ;; + "aarch64") + ARCH=arm64 + ;; + "armv6") + ARCH=armv6l + ;; + "armv8") + ARCH=arm64 + ;; + .*386.*) + ARCH=386 + ;; + esac + PLATFORM="linux-$ARCH" + ;; + "Darwin") + PLATFORM="darwin-amd64" + ;; + esac + + echo $PLATFORM + +} diff --git a/modules/node.sh b/modules/node.sh new file mode 100644 index 0000000..f6b9b92 --- /dev/null +++ b/modules/node.sh @@ -0,0 +1,16 @@ + +module_load confirm + +rm_node_modules () { +parent=${1:-$PWD} +echo finding node_modules folders within $parent +if command find . -name 'node_modules' -type d -prune 2>/dev/null;then +confirm continue with deleting? || return 1 +command find . -name 'node_modules' -type d -prune -exec rm -r '{}' + +else +echo no folders to delete +fi +} + +# if script was executed then call the function +(return 0 2>/dev/null) || rm_node_modules $@ \ No newline at end of file diff --git a/modules/vscode.sh b/modules/vscode.sh new file mode 100755 index 0000000..53597f5 --- /dev/null +++ b/modules/vscode.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +VSCODE_BIN=$(command -v code) +VSCODE_BIN=${VSCODE_BIN:-$(command -v codium)} +[[ $VSCODE_BIN ]] || { + echo "no vscode binary on machine" + exit +} +# set default home here +# can pass +vscode() { + #local home=$HOME + local home=/opt/vscode + home=${VSCODE_HOME:-$home} + [[ $1 == "-h" ]] && home=$2 && shift 2 + mkdir -p ${home}/${USER} + [[ $? -ne 0 ]] && echo "unable to set vscode home at $home/$USER, aborting" && return 1 + exts=${home}/${USER}/extensions + user=${home}/${USER}/data + echo $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@" + $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@" +} + +# # if script was executed then call the function +(return 0 2>/dev/null) || vscode $@