Compare commits

..

36 Commits

Author SHA1 Message Date
4ef51915fb Update TBD's. 2026-03-28 14:03:52 -07:00
0a3b339921 Finalize changes needed to get send-master to work!! Yay! 2026-03-28 14:03:08 -07:00
9243bd5480 Add exporting of functions needed for scripts. 2026-03-28 13:44:40 -07:00
c09e5560e6 Change clone to use all-params ($@). 2026-03-28 13:37:50 -07:00
90a94ec648 Move clone and ls aliases to shared. 2026-03-28 13:34:38 -07:00
945563aa28 Change double quotes to singles in clone command. 2026-03-28 13:30:44 -07:00
bb542d1d2f Further fix the while loop. 2026-03-28 13:29:34 -07:00
7ff5431e83 Change do-while to while. 2026-03-28 13:27:01 -07:00
0e193d430b Fix misquotes. 2026-03-28 12:54:19 -07:00
bef7091063 Fix output for updater. 2026-03-28 12:25:04 -07:00
890c991f18 Use log rather than echo. Add quotes on color assignments. 2026-03-28 12:22:41 -07:00
f34e02c641 Ensure colors are exported! 2026-03-28 12:20:14 -07:00
df8f7f3101 Add output to rc shared updater. 2026-03-28 12:19:25 -07:00
74fb1def7f Fix the function to reload shared RC file. 2026-03-28 12:18:24 -07:00
6d0840d4eb Fix the DIR variable to be current directory, not program directory. 2026-03-28 12:15:17 -07:00
eb9eb03c1e Remove start message. 2026-03-28 12:10:57 -07:00
9d1141bf82 Fix output to be more helpful. 2026-03-28 12:08:29 -07:00
513c0d6fac Add colors for PS1 prompts. 2026-03-28 12:08:16 -07:00
6ed7475c02 Change command to use the proper variables which should now exist in each main env project. Add a sleep for the loop with conditional output. 2026-03-27 18:40:11 -07:00
6afd10b296 Only show the output if not running as root. 2026-03-27 18:35:26 -07:00
e815803630 Add dates to output. 2026-03-27 18:34:20 -07:00
b94a3e4a0b Add an explicit bye since goodbye does not seem to be working still? 2026-03-27 17:09:42 -07:00
9c9de6f96f Add function which syncs all the MASTER catalogs in the current directory. 2026-03-27 17:07:24 -07:00
c5d1386211 Add another TODO to master sync script. 2026-03-27 17:06:48 -07:00
9f6c7834d8 Add comments and TBD's. 2026-03-23 12:31:42 -07:00
bbf7bd5606 Add comments to script. 2026-03-23 12:25:55 -07:00
3f4d3363af Finish the script for the shared config to update itself. Add aliases. 2026-03-23 12:24:11 -07:00
8e3c581d16 Rename file for better code highlighting. 2026-03-23 12:21:39 -07:00
3de906a03f Create alias with dash for script. 2026-03-23 12:13:57 -07:00
1c919cb4d9 Use underscore in script filename as well. 2026-03-23 12:13:46 -07:00
8bf6b5905c Use underscore in name. 2026-03-23 12:13:00 -07:00
3c6a0994c6 Edit note to be more stern yet kind. ;) 2026-03-23 12:08:40 -07:00
9bb80b51c4 Add RC file which sources the shared bin. 2026-03-23 12:07:55 -07:00
17a65f6ce0 Rename the bin dir to include shared. 2026-03-23 12:07:49 -07:00
353b38fad4 Rename script to something easier to remember as well as type. 2026-03-23 12:01:51 -07:00
c5a1015083 Add a script for uploading MASTER catalogs automagically, so the location of the trailing slash can't accidentally be swapped. ;) 2026-03-23 12:00:07 -07:00
2 changed files with 142 additions and 0 deletions

48
bin-shared/send_master.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# TBD:
# - add parameter to set loop=true, and accept a value for sleep seconds
# - allow passing the script a variable for the dir, rather than assuming curr
## Variables ##
PROG="$(basename -- "${BASH_SOURCE[0]}")"
loop=false
DIR="`pwd`"
dir="`basename $DIR`"
## Validations ##
if [[ "$DIR" != *"MASTER" ]]; then
echo "'$DIR' is not labeled as a MASTER. Skipping upload."
exit 0
fi
## Main ##
new_dir="${dir//MASTER/clone}"
echo "`date` - Sending '$dir' to" \
"'$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_PORT$PROD_DATA_DIR/$new_dir'"
sleep=0
while true; do
if (( $sleep > 0 )); then
echo "Sleeping for '$sleep' seconds..."
sleep $sleep
fi
clone -e "ssh -p $PROD_DATA_PORT" ./ \
$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_DIR/$new_dir &&
echo "`date` - Success!" ||
echo "`date` - Failed!"
sleep=30
if [[ "$loop" == false ]]; then
break;
fi
done
## Complete ##
echo "`date` - $PROG complete."
exit 0

94
rc_shared.sh Normal file
View File

@@ -0,0 +1,94 @@
# Notes:
# - Please keep this file working for both BASH and ZSH. :)
## Variables ##
# Environment Usability
export PATH="$PATH:~/bin-shared:~/.bin-shared"
# PS1 Colors
export PURPLE="`tput setaf 55`"
export ORANGE="`tput setaf 208`"
export GREEN="`tput setaf 34`"
export RED="`tput setaf 196`"
export SCARLET="`tput setaf 160`"
export YELLOW="`tput setaf 226`"
export GRAY="`tput setaf 243`"
export RESET="`tput sgr0`"
export BOLD="`tput bold`"
## Aliases ##
# Quickies
alias reload-bash="source ~/.bashrc"
alias bash-reload="reload-bash"
alias shell-reload="reload-bash"
alias reload-shell="reload-bash"
alias reload="reload-bash"
alias l='ls '
alias ll='ls -alh '
alias lh='ls -ash '
## Functions ##
# Related specifically to this project.
function update-shared {
log "`date` - Reloading the '~/.rc_shared' file from env-shared.\n"
branch="$1"
if [[ -z "$branch" ]]; then
branch="dev"
fi
dir="shared-rc-deleteme"
git clone https://git.hyperling.com/me/env-shared \
$dir --branch=$branch
mv -v $dir/rc_shared.sh ~/.rc_shared
mv -v $dir ~/TRASH/"$dir-`date "+%Y%m%d-%H%M%S"`"
log "\n`date` - Complete! Please note this does NOT update bin files."
}
alias shared-update="update-shared"
alias reload-shared="update-shared"
alias shared-reload="update-shared"
# Shortcuts
function send-master { send_master.sh; }
function goodbye { update -y; bye; }
function clone {
rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build' "$@"
}
export -f clone
# Enhance Bin Scripts
function send-masters {
ls | grep MASTER | while read dir; do
echo "Preparing to sync '$dir' to '$SERVER_NAME'."
cd $dir
send-master
cd ..
done
}
export -f send-masters
# Audio
# Video
## Complete! ##
[[ $(whoami) != "root" ]] &&
echo "`date` - Shared RC Config - Complete!"