Compare commits

..

31 Commits

Author SHA1 Message Date
me c62c47dc7e Fix indent of function. 2026-05-12 05:51:37 -07:00
me d154171f33 Meme photos have dashes in the name. 2026-05-12 05:29:19 -07:00
me 1cd5a4789c Add quotes to variable in conditional. 2026-05-08 10:39:25 -07:00
me 6caa36a09d Change log files to txt files because Android file haanddler is dumb. 2026-05-06 17:55:10 -07:00
me 6834d85fc2 Add automatic updates for env-termuc now that it's working in env-shared. 2026-05-06 17:52:02 -07:00
me 2de6e77d40 Fix another branch casing. 2026-05-06 17:44:54 -07:00
me cfd18df2c5 Add actual commands to update the env-shared project. 2026-05-06 17:41:53 -07:00
me 604639033b Uppercase the branch variable for consistency; unsure why it was lower. 2026-05-06 17:31:17 -07:00
me 3d0347e41a Add a Reports folder for Android. 2026-05-06 17:29:00 -07:00
me 4a9b4353d4 Fix variable which did not get switched over. 2026-05-06 17:17:23 -07:00
me fd238ddf2d Fix typo in Update. 2026-05-06 15:30:42 -07:00
me 864e8fa8db Fix the '$project' variable being shared across environments incorrectly. 2026-05-06 15:24:28 -07:00
me 7b62b21da9 Shorten the update message. 2026-05-06 15:07:28 -07:00
me 53d2587756 Add the fork back for updater. 2026-05-06 15:05:45 -07:00
me 2c1fba93d9 Fix the shared env project path. 2026-05-06 14:56:39 -07:00
me 5c12ff4a3b No longer push the update information to the screen, use notifications. 2026-05-06 14:50:49 -07:00
me 1c32aa3658 Remove the chmod as to not alter the project and prevent futuire pulls. 2026-05-06 10:15:38 -07:00
me f2c658a4f1 Set the BASH files to be executable. 2026-05-06 09:52:43 -07:00
me 65bdce1a8c Add prefix of git to env-shared project. 2026-05-06 09:28:08 -07:00
me 07ca4beacf Always update the critical software, check for skip in a better way. 2026-05-06 09:21:24 -07:00
me ba465cdece Fix encoding for echo. Add a reload-shared if the project a;ready exists. 2026-05-06 09:17:12 -07:00
me eda63610ad Simplify verbiage and shorten the length. 2026-05-05 15:24:44 -07:00
me 909875df32 Add filler content for the template. 2026-05-05 10:31:01 -07:00
me 4b0f0cbbcd Add a template to the README if it does not already have data. 2026-05-05 10:29:16 -07:00
me 16aa8b17cd Change the Termux project to stay put rather than use deleteme's. Add an update checker similar to shared project. 2026-05-05 09:45:11 -07:00
me fea3756a0e Download the shared code to its proper location rather than doing a deleteme dump. Use /sdcard/ rather than shared storage links from home directory. 2026-05-05 09:36:29 -07:00
me a84fba5a1c Be more consistent about only pulling files with today's date (screenshots, memes, edited photos). 2026-05-05 09:23:11 -07:00
me 6c9112ef23 Move trash related code to shared env. 2026-04-25 10:33:14 -07:00
me c9f2802359 Fix single quote location. 2026-04-18 10:47:42 -07:00
me 3486e238d4 Add a parameter for the branch that's preferred. 2026-04-17 15:46:21 -07:00
me 3ed66ea059 Add exporting of all functions, same as done in env-shared. 2026-04-13 19:28:32 -07:00
3 changed files with 172 additions and 98 deletions
Regular → Executable
+84 -21
View File
@@ -22,6 +22,11 @@ else
export PS1='\[$BOLD\]\[$GRAY\][\[$ORANGE\]\t \[$GREEN\]\w\[$GRAY\]]\[$RESET\]\$ ' export PS1='\[$BOLD\]\[$GRAY\][\[$ORANGE\]\t \[$GREEN\]\w\[$GRAY\]]\[$RESET\]\$ '
fi fi
if [[ -z "$BRANCH" ]]; then
export BRANCH="dev"
fi
## Aliases ## ## Aliases ##
# Quickly log onto production server. # Quickly log onto production server.
@@ -53,17 +58,6 @@ alias dcim="cd $DCIM"
export CODE="$SS/Code" export CODE="$SS/Code"
alias code="cd $CODE" alias code="cd $CODE"
# Shortcuts for TRASH.
export TRASH="$SS/TRASH"
alias trash="cd $TRASH"
alias clean-trash="bash -c 'rm -rfv $TRASH/*'; clean-trashed"
alias trash-clean="clean-trash"
alias check-trash="du -h $TRASH"
alias trash-check="check-trash"
alias clean-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -delete | sort -h'
alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h'
# Help prevent mistakes. # Help prevent mistakes.
alias cp="cp -v " alias cp="cp -v "
alias mv="mv -v " alias mv="mv -v "
@@ -129,16 +123,25 @@ function commit {
# Easily test this project after committing changes. # Easily test this project after committing changes.
# Otherwise can just source this file unless testing setup.sh. # Otherwise can just source this file unless testing setup.sh.
export PROJECT_TERMUX="$HOME/.git-env-termux"
function test-termux { function test-termux {
sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null if [[ -d "$PROJECT_TERMUX" ]]; then
log "`date` - Updating '$PROJECT_TERMUX'.\n"
git -C "$PROJECT_TERMUX" switch "$BRANCH"
git -C "$PROJECT_TERMUX" pull --recurse-submodules || \
( echo "Failed to pull project, exiting." && return 1 )
else
log "`date` - Downloading '$PROJECT_TERMUX'.\n"
git clone https://git.hyperling.com/me/env-termux \ git clone https://git.hyperling.com/me/env-termux \
--branch=dev ~/termux-deleteme --branch=$BRANCH "$PROJECT_TERMUX"
chmod 755 ~/termux-deleteme/*.sh fi
~/termux-deleteme/setup.sh "$@" "$PROJECT_TERMUX"/setup.sh "$@"
} }
alias reload-termux="test-termux " alias reload-termux="test-termux "
alias termux-test="test-termux " alias termux-test="test-termux "
alias termux-reload="reload-termux " alias termux-reload="reload-termux "
alias termux-update="reload-termux "
alias update-termux="reload-termux "
# Pulled from /me/env-ansible, need to make a shared library between it and Termux. # Pulled from /me/env-ansible, need to make a shared library between it and Termux.
@@ -233,17 +236,17 @@ alias goodbye="update -y && bye"
alias pull-content="mv -v $SS/DCIM/Camera/`date +"%Y-%m-%d"`* ./raw/" alias pull-content="mv -v $SS/DCIM/Camera/`date +"%Y-%m-%d"`* ./raw/"
alias pull-screenshots="mv -v $SS/Pictures/Screenshots/* ./raw/" alias pull-screenshots="mv -v $SS/Pictures/Screenshots/*`date +"%Y%m%d"`* ./raw/"
alias pull-screenshot="pull-screenshots" alias pull-screenshot="pull-screenshots"
alias pull-sc="pull-screenshots" alias pull-sc="pull-screenshots"
alias pull-crops="mv -v $SS/Documents/*/`date +"%Y%m%d"`*.{jpg,png} ./raw/" alias pull-crops="mv -v $SS/Documents/*/`date +"%Y%m%d"`*.{jpg,png} ./raw/"
alias pull-youcuts="mv -v $SS/Movies/youcut/* ./raw/" alias pull-youcuts="mv -v $SS/Movies/youcut/*`date +"%Y%m%d"`* ./raw/"
alias pull-youcut="pull-youcuts" alias pull-youcut="pull-youcuts"
alias pull-yc="pull-youcut" alias pull-yc="pull-youcut"
alias pull-memes="mv -v $SS/Pictures/memetastic/memes/*.jpg ./" alias pull-memes="mv -v $SS/Pictures/memetastic/memes/*`date +"%Y-%m-%d"`*.jpg ./"
alias pull-meme="pull-memes" alias pull-meme="pull-memes"
alias pull-icon="pull-meme" alias pull-icon="pull-meme"
@@ -254,9 +257,32 @@ function init-video-contents {
cd "$1" cd "$1"
fi fi
touch README.md touch README.md
#touch title.md if [[ ! -s README.md ]]; then
#touch desc.md cat >> README.md <<- EOF
#touch tags.md # title
COOL SIMPLE TITLE
# desc
VIDEO DESCRIPTION GOES HERE! :)
---
Recorded and edited on YYYY-MM-DD.
[blog.hyperling.com/TBD](https://blog.hyperling.com/TBD)
# tags
- TAG1
, TAG2
, TAG3
, TAG4
, TAG5
EOF
fi
mkdir -pv raw mkdir -pv raw
} }
alias init-video="init-video-contents" alias init-video="init-video-contents"
@@ -327,6 +353,43 @@ alias prod-backup="pull_prod_backups"
alias pull-prod="pull_prod_backups" alias pull-prod="pull_prod_backups"
alias prod-pull="pull_prod_backups" alias prod-pull="pull_prod_backups"
## Finalize ##
# Export all functions! #
eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
# Run update checker in background.
(
(
if [[ -d "$PROJECT_TERMUX" ]]; then
git -C "$PROJECT_TERMUX" fetch >/dev/null 2>&1 \
&& git -C "$PROJECT_TERMUX" status \
| grep "is behind" \
| while read status; do
title=TBD
message=TBD
success=0
reload-termux || success=1
if [[ "$success" == 0 ]]; then
title="env-termux Updated"
message="Reloaded automatically, please reload BASH. :)"
else
title="env-termux Updates Available"
message="Update with 'reload-termux'."
fi
if [[ -d /sdcard ]]; then
termux-notification \
-t "$title" \
-c "$message"
else
notify-send "$title" "$message"
fi
done
fi
) >> "$HOME"/Reports/env-termux.log.txt 2>&1 &
)
# Complete! # Complete!
PROG="$(basename -- "${BASH_SOURCE[0]}")" PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "`date` - '$PROG' completed!" echo "`date` - '$PROG' completed!"
+2 -1
View File
@@ -7,6 +7,7 @@ export PROD_USER=user
export PROD_GIT_HOST=git.example.com export PROD_GIT_HOST=git.example.com
export PROD_GIT_PORT=8080 export PROD_GIT_PORT=8080
export PROD_GIT_USER=git export PROD_GIT_USER=git
export PROD_GIT_BRANCH=main
export PROD_DATA_HOST=sftp.example.com export PROD_DATA_HOST=sftp.example.com
export PROD_DATA_PORT=2200 export PROD_DATA_PORT=2200
@@ -14,4 +15,4 @@ export PROD_DATA_USER=data
export PROD_DATA_DIR=/srv/sftp export PROD_DATA_DIR=/srv/sftp
PROG="$(basename -- "${BASH_SOURCE[0]}")" PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "'`date` - $PROG' completed!" echo "`date` - '$PROG' completed!"
Regular → Executable
+34 -24
View File
@@ -11,12 +11,12 @@ echo "Working in '$DIR'."
skip="false" skip="false"
if [[ "$1" == "skip" || "$2" == "skip" || "$3" == "skip" ]]; then if [[ "$@" == *"skip"* || "$@" == *"-s"* ]]; then
skip="true" skip="true"
fi fi
if [[ "$skip" == "true" ]]; then if [[ "$skip" == "true" ]]; then
echo "\n`date` - Skipping Updates" echo -e "\n`date` - Skipping Updates"
else else
echo -e "\n`date` - Upgrade Package Repos" echo -e "\n`date` - Upgrade Package Repos"
pkg update && pkg update &&
@@ -40,33 +40,28 @@ else
fi fi
if [[ "$skip" == "true" ]]; then echo -e "\n`date` - Install & Updayte Crtical Software"
echo "\n`date` - Skipping Installs"
else
echo -e "\n`date` - Install Software"
pkg install -y \ pkg install -y \
openssh tsu vim htop git cronie man zip ncurses-utils \ openssh tsu vim htop git cronie man zip ncurses-utils \
nmap traceroute wget rsync \ nmap traceroute wget rsync \
ffmpeg imagemagick \ ffmpeg imagemagick \
kotlin php nodejs python libllvm hugo kotlin php nodejs python libllvm hugo
fi
echo -e "\n`date` - BASH Environment" echo -e "\n`date` - BASH Environment"
if [[ ! -e ~/.env ]]; then if [[ ! -e ~/.env ]]; then
if [[ -e example.env ]]; then if [[ -e example.env ]]; then
mv -v example.env ~/.env cp -v example.env ~/.env
else else
echo "ERROR: Neither .env or example.env found." >&2 echo "ERROR: Neither .env or example.env found." >&2
fi fi
else else
echo "'.env' already exists. Good job!" echo "'.env' already exists. Good job!"
rm -v example.env
fi fi
if [[ -e bashrc.sh ]]; then if [[ -e bashrc.sh ]]; then
mv -v bashrc.sh ~/.bashrc cp -v bashrc.sh ~/.bashrc
else else
echo "ERROR: bashrc.sh not found, skipping." >&2 echo "ERROR: bashrc.sh not found, skipping." >&2
fi fi
@@ -77,31 +72,46 @@ echo -e "\n`date` - Directories"
if [[ -d ~/TRASH ]]; then if [[ -d ~/TRASH ]]; then
rm -rfv ~/TRASH rm -rfv ~/TRASH
fi fi
if [[ ! -e ~/storage/shared/TRASH ]]; then if [[ ! -e ~/sdcard/TRASH ]]; then
mkdir -pv ~/storage/shared/TRASH mkdir -pv /sdcard/TRASH
fi fi
ln -s ~/storage/shared/TRASH ~/TRASH ln -s /sdcard/TRASH ~/TRASH
if [[ ! -d ~/Code && ! -d ~/storage/shared/Code ]]; then if [[ ! -d ~/Code && ! -d ~/sdcard/Code ]]; then
mkdir -pv ~/Code mkdir -pv ~/Code
ln -s ~/Code ~/storage/shared/Code ln -s ~/Code /sdcard/Code
fi
if [[ -d /sdcard && ! -d "$HOME"/Reports ]]; then
mkdir -pv /sdcard/Reports
ln -s /sdcard/Reports "$HOME"/Reports
fi fi
echo -e "\n`date` - env-shared" echo -e "\n`date` - env-shared"
env_shared_dir="$HOME/.git-env-shared"
env_shared_dir="env-shared-dev-deleteme" if [[ ! -d "$env_shared_dir" ]]; then
echo -e "`date` - Not installed, downloading."
if [[ -z "$BRANCH" ]]; then
export BRANCH="dev"
fi
git clone https://git.hyperling.com/me/env-shared \ git clone https://git.hyperling.com/me/env-shared \
--branch=dev ~/$env_shared_dir --branch=$BRANCH "$env_shared_dir"
cp -v ~/$env_shared_dir/rc_shared.sh ~/.rc_shared cp -v "$env_shared_dir"/rc_shared.sh ~/.rc_shared
cp -v ~/$env_shared_dir/vimrc.vim ~/.vimrc cp -v "$env_shared_dir"/vimrc.vim ~/.vimrc
if [[ ! -d ~/bin ]]; then if [[ ! -d ~/bin ]]; then
mkdir -pv ~/bin mkdir -pv ~/bin
fi fi
cp -v ~/$env_shared_dir/bin-shared/* ~/bin/ cp -v "$env_shared_dir"/bin-shared/* ~/bin/
mv -v ~/$env_shared_dir \ else
~/TRASH/$env_shared_dir-"`date "+%Y%m%d-%H%M%S"`" \ echo -e "`date` - Already installed, updating."
| grep -v '/.git/' git -C "$env_shared_dir" switch "$BRANCH"
git -C "$env_shared_dir" pull --recurse-submodules || \
( echo "Failed to pull project, exiting." && return 1 )
cp -v "$env_shared_dir"/rc_shared.sh ~/.rc_shared
cp -v "$env_shared_dir"/vimrc.vim ~/.vimrc
fi
echo -e "\n`date` - Cleanup" echo -e "\n`date` - Cleanup"