summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorTyler Davis <tyler@gluecode.net>2024-06-11 00:32:11 +0000
committerTyler Davis <tyler@gluecode.net>2024-06-11 00:32:11 +0000
commitc03f11cc52b18f8849b4e45b8e8ab65b7d515627 (patch)
tree5a4cdc8406e7676d48c8bacb1d3907cb8364074e /.local
parentd95a00ccad42fe618759dc3212fb4e3b1aa0f8fb (diff)
downloaddotfiles-c03f11cc52b18f8849b4e45b8e8ab65b7d515627.tar.gz
dotfiles-c03f11cc52b18f8849b4e45b8e8ab65b7d515627.zip
bin: remove build and backup scripts
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/backup_sh104
-rw-r--r--.local/bin/buildgo_sh26
2 files changed, 0 insertions, 130 deletions
diff --git a/.local/bin/backup_sh b/.local/bin/backup_sh
deleted file mode 100755
index eb44107..0000000
--- a/.local/bin/backup_sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env sh
-
-# Generate a backup file named for the date, then run+update+compress
-
-UPDATED=0
-TARGET_DIR="/media/hdd/tdavis-archives/tech/backup"
-SOURCE_DIR="$HOME"
-TODAY=$(date +"%Y%m%d")
-TF="home-${TODAY}.tar"
-
-usage="$(basename "$0") [-h] [-t TARGET_DIR] [-s SOURCE_DIR]
-
-where:
- -s set the source directory (default: ${SOURCE_DIR})
- -t set the backup directory (default: ${TARGET_DIR})
-
- -h show this help text
-"
-
-while :; do
- case $1 in
- -h | -\? | --help) # Call a "show_help" function to display a synopsis, then exit.
- echo "$usage"
- exit
- ;;
- -s) # Takes an option argument, ensuring it has been specified.
- if [ -n "$2" ]; then
- SOURCE_DIR=$2
- shift
- fi
- ;;
- -s=?*)
- SOURCE_DIR=${1#*=} # Delete everything up to "=" and assign the remainder.
- ;;
- -s=) # Handle the case of an empty --file=
- printf 'ERROR: "-s" requires a non-empty option argument.\n' >&2
- exit 1
- ;;
- -t) # Takes an option argument, ensuring it has been specified.
- if [ -n "$2" ]; then
- TARGET_DIR=$2
- shift
- fi
- ;;
- -t=?*)
- TARGET_DIR=${1#*=} # Delete everything up to "=" and assign the remainder.
- ;;
- -t=) # Handle the case of an empty --t=
- printf 'ERROR: "-t" requires a non-empty option argument.\n' >&2
- exit 1
- ;;
- --) # End of all options.
- shift
- break
- ;;
- -?*)
- printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
- ;;
- *) # Default case: If no more options then break out of the loop.
- break ;;
- esac
- shift
-done
-
-# No posix-compliant way of getting processor count, so leverage OS-specifics
-if [ "$(uname -s)" = "Darwin" ]; then
- FS_SEPARATOR="/"
-elif [ "$(uname -s)" = "Linux" ]; then
- FS_SEPARATOR="/"
-else
- # Windows uses backslash
- FS_SEPARATOR="\\"
-fi
-
-# Verify free space
-SOURCE_SIZE=$(du -sk ${SOURCE_DIR} | cut -f 1)
-DOUBLE_SOURCE_SIZE=$(echo "${SOURCE_SIZE}*2" | bc -q)
-TARGET_FREE=$(df -Pk ${TARGET_DIR} | grep -vE "^Filesystem" | awk '{ print $4 }')
-if [ $DOUBLE_SOURCE_SIZE -gt $TARGET_FREE ]; then
- echo "insufficient space to perform backup. 2x Source Directory usage is ${DOUBLE_SOURCE_SIZE}, Target Directory free space is: ${TARGET_FREE}"
- exit 1
-fi
-
-COMPRESSION="gzip" # Gzip default
-SUFFIX=".gz"
-if [ $(command -v zstd) ]; then
- COMPRESSION="zstd -T0 -qq"
- SUFFIX=".zstd"
-elif [ $(command -v pigz) ]; then
- COMPRESSION="pigz -p"
-fi
-
-FULL_TF="${TARGET_DIR}${FS_SEPARATOR}${TF}"
-
-# Updating existing archives almost always fails. Build and zip in one shot.
-if [ -e ${FULL_TF}${SUFFIX} ]; then
- rm -f ${FULL_TF}${SUFFIX}
-fi
-
-# Do the backup
-if tar -C ${SOURCE_DIR} -c -f ${FULL_TF} ${SOURCE_DIR} >/dev/null 2>&1; then
- ${COMPRESSION} ${FULL_TF}
- rm -f ${FULL_TF} # Delete the original tar file just in case
-fi
diff --git a/.local/bin/buildgo_sh b/.local/bin/buildgo_sh
deleted file mode 100644
index e1c6432..0000000
--- a/.local/bin/buildgo_sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env sh
-
-if [ -d "$HOME/.golang/go" ] && [ $(command -v go) ]; then
- CURR=$PWD
- cd $HOME/.golang/go/src
- if [ "$(go version | grep devel)" ]; then
- # Check that the go version is dev-build
- # then verify that the displayed hash doesn't match current revision
- if [ ! "$(command -v git)" ]; then
- echo "git not found"
- exit 1
- fi
- fetchgit
- rev=$(git rev-parse --short HEAD)
- currentRevision=$(go version | cut -d ' ' -f 4 | cut -d- -f 2)
- if [ $rev != $currentRevision ]; then
- echo "Upgrading ${currentRevision} -> ${rev}"
- go clean -cache
- go clean -modcache
- ./all.bash # Make always finishes, tests may just fail
- cd $HOME
- gotools.sh
- fi
- fi
- cd $CURR
-fi