From 09ada24d4ec23cf24ab136141b354953d1bbc2fa Mon Sep 17 00:00:00 2001
From: Tim Keller <tjkeller.xyz>
Date: Sun, 17 Nov 2024 23:34:54 -0600
Subject: reorganize scripts

---
 sync/griff    | 64 -----------------------------------------------------------
 sync/pull     | 57 ----------------------------------------------------
 sync/pushsite |  8 --------
 sync/sink     | 47 -------------------------------------------
 4 files changed, 176 deletions(-)
 delete mode 100755 sync/griff
 delete mode 100755 sync/pull
 delete mode 100755 sync/pushsite
 delete mode 100755 sync/sink

(limited to 'sync')

diff --git a/sync/griff b/sync/griff
deleted file mode 100755
index 549b108..0000000
--- a/sync/griff
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-home=$(echo $HOME | sed 's/\//\\\//g')
-repos="$(grep -v '#' | sed "s/\~/$home/")" << REPOS
-#~/.local/src/programs/blr
-~/.local/src/programs/dmenu
-~/.config
-~/.local/bin
-~/.local/src/programs/st
-~/.local/src/programs/timmywm
-REPOS
-#echo "$repos" | cut -f1
-
-# Colors
-BOLD="\033[1m"
-NORM="\033[0m"
-CYN="\033[0;36m"
-RED="\033[0;31m"
-GRN="\033[0;32m"
-MAG="\033[0;35m"
-
-me() { echo $0 | sed 's/.*\///'; }
-repocheck() { [ -z "$repos" ] && echo "No repos have been added!\nUse \"$(me) add\" or edit the script file to add a new repo!" && exit; }
-
-reponame() { sed -n 's/^\s*url.*\/\(.*\)\.git/\1/p' $1/.git/config; }
-
-rddiff() {
-	repocheck
-	for repo in $repos; do
-		name="$(reponame $repo)"
-		if cd $repo 2>/dev/null; then
-			if git diff --quiet HEAD $REF -- $DIR; then
-				echo "$GRN[Repo $name is unchanged!]$NORM"
-			else
-				echo "$CYN[Repo $name has changed:]$NORM"
-				git status | grep -v '(use'
-				read -p "Would you like to view the changes? [y/n]: " viewchange
-				case $viewchange in
-					y|yes|Y|Yes)	git diff HEAD $REF -- $DIR	;;
-				esac
-				read -p "Would you like to push these changes? [y/n]: " pushchange
-				case $pushchange in
-					y|yes|Y|Yes)
-						while [ -z "$commitmsg" ]; do
-							read -p "Enter a commit message: " commitmsg
-						done
-						git add . && git commit -m "$commitmsg" && git push \
-							&& echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \
-							|| echo "$RED[An error occured while pushing changes to repo $name!]$NORM"
-						commitmsg=""
-					;;
-				esac
-			fi
-	       else
-	               echo "$BOLD$RED[Repo $name does not exist at $dir!]$NORM"
-	       fi
-	done
-}
-
-drdiff() { echo impl; }
-
-case $1 in
-	add) echo "add this in" ;;
-	*)	rddiff	;;
-esac
diff --git a/sync/pull b/sync/pull
deleted file mode 100755
index f52ec5e..0000000
--- a/sync/pull
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-printusage() { echo "Usage: $0 [-b,--build] [<repo> ...] (repos: all,`echo $repos | tr ' ' ','`)" && exit; }
-
-repos=$repos"blr dmenu dotconfig scripts st timmywm" #repos=$repos"dotconfig|dwmpatches|scripts|st|timmywm"
-
-[ -z $1 ] || [ `echo "$@" | tr ' ' '\n' | grep -v -c '\-'` = 0 ] && printusage
-
-# Colors
-BOLD="\033[1m"
-NORM="\033[0m"
-CYN="\033[0;36m"
-RED="\033[0;31m"
-GRN="\033[0;32m"
-MAG="\033[0;35m"
-
-printsyncmsg()	{ echo "$CYN[Pulling repo '$arg'...]$NORM"; }
-printsuccess()	{ echo "$BOLD$GRN[Successfully pulled repo '$arg']$NORM"; }
-printerror()	{ echo "$BOLD$RED[Failed to pull repo '$arg']$NORM"; }
-
-#change colors
-printmakemsg()	   { echo "$MAG[Building repo '$arg'...]$NORM"; }
-printmakesuccess() { echo "$BOLD$GRN[Successfully built repo '$arg']$NORM"; }
-printmakeerror()   { echo "$BOLD$RED[Failed to build repo '$arg']$NORM"; }
-
-pullrepo() {
-	printsyncmsg
-	cd $1 && git pull --verbose \
-	&& printsuccess || printerror
-}
-makerepo() {
-	if echo "$opts" | grep '\-b'; then
-		printmakemsg
-		${SUDO:-sudo} make clean install \
-		&& printmakesuccess || printmakeerror
-	fi
-}
-makeautoconf() { make autoconfig && echo "$BOLD$GRN[Automatically configured '$repo']$NORM"; }
-
-pullblr()	{ pullrepo ~/.local/src/programs/blr;		}
-pulldmenu()	{ pullrepo ~/.local/src/programs/dmenu		&& makeautoconf && makerepo; }
-pulldotconfig()	{ pullrepo ~/.config;				}
-pullscripts()	{ pullrepo ~/.local/bin;			}
-pullst()	{ pullrepo ~/.local/src/programs/st		&& makeautoconf && makerepo; }
-pulltimmywm()	{ pullrepo ~/.local/src/programs/timmywm	&& makeautoconf && makerepo; }
-
-for arg in "$@"; do
-	case $arg in
-		-b|--build) opts="$opts-b" ;;
-		all) $0 $opts $repos ;;
-		*) # Would like to use something like $repos) here but cant
-			for repo in $repos; do
-				[ "$arg" = "$repo" ] && pull$arg && break
-			done || printusage
-		;;
-	esac
-done
diff --git a/sync/pushsite b/sync/pushsite
deleted file mode 100755
index 1a1cbc3..0000000
--- a/sync/pushsite
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-ssh root@tjkeller.xyz << EOF
-cd /var/www/tjkeller/
-git pull
-cd articles
-git pull
-./tssg -r tssgmd . template.html
-EOF
diff --git a/sync/sink b/sync/sink
deleted file mode 100755
index b11b492..0000000
--- a/sync/sink
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-printusage()   { echo "Usage: $0 [<repos> ...] (repos: all,`echo $repos | tr ' ' ','`) [up|down]" && exit; }
-
-repos="docs patches"
-
-oper=`echo $@ | sed 's/.* //'` # Get last argument
-([ -z $2 ] || ([ "$oper" != "up" ] && [ "$oper" != "down" ])) && printusage
-
-# rync options
-#fix this too
-ropts="--archive --partial --progress --recursive --update --verbose" # Equivalent to: -aPrvu --delete
-rdest="rsync@tjkeller.xyz:"
-
-# Colors
-BOLD="\033[1m"
-NORM="\033[0m"
-CYN="\033[0;36m"
-RED="\033[0;31m"
-GRN="\033[0;32m"
-
-printsyncmsg() { echo -n "$CYN[Syncing $SYNCNAME...]$NORM\n"; }
-printsuccess() { echo -n "$BOLD$GRN[Successfully synced $SYNCNAME]\n"; }
-printerror()   { echo -n "$BOLD$RED[An error occured while syncing $SYNCNAME]\n"; }
-
-sync() {
-	[ $oper = "up" ] && SYNCNAME="$1$2 to $rdest$2" || SYNCNAME="$rdest$2 to $1$2"
-	printsyncmsg
-	(if [ $oper = "up" ]; then rsync $ropts $1$2 $rdest; else rsync $ropts --delete $rdest$2 $1; fi) \
-	&& printsuccess || printerror
-}
-
-# arg1 = options + containing directory path, arg2 = file/directory name
-syncdocs()	{ destdir="" && 			sync "/home/timmy/docs/" "school";						}
-#syncsites()	{ destdir="" &&				sync "--exclude=pass /home/timmy/.local/src/" "sites";			} # Excludes password file
-syncpatches()	{ destdir="" && 			sync "--exclude=.git /home/timmy/.local/src/programs/" "patches";	} # Excludes git files
-
-for arg in "$@"; do
-	case $arg in
-		all) $0 $repos $oper ;;
-		up|down) oper=$arg ;;
-		*) # Would like to use something like $repos) here but cant
-			for repo in $repos; do
-				[ "$arg" = "$repo" ] && sync$arg && break
-			done || printusage
-		;;
-	esac
-done
-- 
cgit v1.2.3