Compare commits

...
18 Commits
Author SHA1 Message Date
me fed005d70d setup, fix typo. 2026-09-12 07:39:47 -07:00
me 9d86aa1585 setup, add jq. 2026-09-12 07:39:18 -07:00
me 29fe9343e9 Change the exits to returns. Fix typo. 2026-08-26 16:08:35 -07:00
me fc9db88670 Ensure that bashrc gets copied after a successful pull every time, whether or not reload-termux succeeds. 2026-08-26 16:08:05 -07:00
me 0c7adfadcb pull-plex, automatically remove empty directories. 2026-08-26 12:48:50 -07:00
me 10b33b023c pull-plex, fix rm command, change the catted file to be the dirname, and add better output. 2026-08-25 14:44:43 -07:00
me 500db502cc reload-termux, add header output for each git command. 2026-08-25 08:45:43 -07:00
me 4f28529537 termux-reload, since the setup.sh file keeps getting deleted by git for unknown reasons, ensure it gets restored automatically. 2026-08-25 08:43:39 -07:00
me 4c5f9eca37 setup, add installation of which. 2026-08-25 08:41:20 -07:00
me 6b8e9c0596 Merge branch 'dev-device-offline' into dev. 2026-08-24 15:36:03 -07:00
me 76fa85cbc0 plex, tested the code on local machine. 2026-08-18 14:12:58 -07:00
me dc3bdb1c82 plex, add automatic cleanup of the chunk files since this is not their source location. 2026-08-18 13:58:42 -07:00
me 17fe6ba2a4 plex, add test code for automatically concatting chunks. 2026-08-18 13:54:52 -07:00
me d905cb1474 Change how the cd to Plex works since su just opens a new session and su -c closes the new session. Tried all combinations of -i -l -m -p with -c and none drop the user in a root shell after the command has been run. 2026-08-15 14:41:37 -07:00
me eedc765074 Alter root workflows to use su -c. 2026-08-15 14:16:12 -07:00
me 7d693a9186 Correct the plex URI. 2026-08-14 13:13:06 -07:00
me 3119920c9f Begin adding a few root workflows, such as pulling Plex downloads. 2026-08-14 13:09:41 -07:00
me 4a641adb03 Also pull video files from OpenCamera. 2026-06-16 17:41:39 -07:00
2 changed files with 76 additions and 6 deletions

No files matched your search

+71 -1
View File
@@ -127,9 +127,14 @@ export PROJECT_TERMUX="$HOME/.git-env-termux"
function test-termux {
if [[ -d "$PROJECT_TERMUX" ]]; then
log "`date` - Updating '$PROJECT_TERMUX'.\n"
echo " Switching to '$BRANCH'."
git -C "$PROJECT_TERMUX" switch "$BRANCH"
echo " Pulling with submodules."
git -C "$PROJECT_TERMUX" pull --recurse-submodules || \
( echo "Failed to pull project, exiting." && return 1 )
# Something above is doing a 'D setup.sh', so ensure it gets recreated.
echo " Ensuring setup.sh exists."
git -C "$PROJECT_TERMUX" restore setup.sh
else
log "`date` - Downloading '$PROJECT_TERMUX'.\n"
git clone https://git.hyperling.com/me/env-termux \
@@ -234,7 +239,7 @@ alias goodbye="update -y && bye"
## Video Related ##
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"`* $SS/DCIM/OpenCamera/`date +"%Y%m%d"`* ./raw/"
alias pull-screenshots="mv -v $SS/Pictures/Screenshots/*`date +"%Y%m%d"`* ./raw/"
alias pull-screenshot="pull-screenshots"
@@ -354,6 +359,70 @@ alias pull-prod="pull_prod_backups"
alias prod-pull="pull_prod_backups"
## Root Workflows ##
function go-root {
command="$1"
if [[ -z "$command" ]]; then
su
else
su -c "$command"
fi
}
alias root="go-root "
alias doas-root="go-root "
plex_dir='/data/user/0/com.plexapp.android/Plex Media Server/Sync/1'
plex_movie_dir="$plex_dir"/1
plex_series_dir="$plex_dir"/2
function plex {
if [[ "$LOGNAME" == "root" ]]; then
cd "$plex_dir"
else
echo "Hopping into root, use this to go to plex's directory: "
echo "cd '$plex_dir'"
su
fi
}
function pull-plex {
dest="$1"
if [[ -z "$dest" ]]; then
dest=/sdcard/Movies/
fi
echo "`date` - Copying files from '$plex_dir' to '$dest'."
su -c "cp -Rv '$plex_dir'/{1,2}/* '$dest'"
echo -e "\n`date` - Combining videos split into chunks."
cd "$dest"
ls | while read dir; do
echo -e "\n\n`date` - Checking '$dir'"
ls -lh "$dir"/*.mkv 2>/dev/null ||
ls -lh "$dir"/* 2>/dev/null ||
{
echo " Directory is empty, removing."
rmdir -v "$dir"
echo " Skipping to next directory."
continue
}
cd "$dir"
# Unsure why -e and -f don't work here. Spaces in filenames? Globs?
if [[ `ls *.chunk0 2>/dev/null` ]]; then
final="$dir.mkv"
echo -e "\n Catting files together to make '$final'."
cat *.chunk* > "$final"
ls -lh "$final"
mv -v *.chunk* ~/TRASH/
fi
echo "`date` - Done."
cd ..
done
}
alias get-plex="pull-plex"
## Finalize ##
# Export all functions! #
@@ -370,6 +439,7 @@ eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
title=TBD
message=TBD
success=0
cp "$PROJECT_TERMUX"/bashrc.sh ~/.bashrc
reload-termux || success=1
if [[ "$success" == 0 ]]; then
title="env-termux Updated"
+5 -5
View File
@@ -33,19 +33,19 @@ if [[ ! -e ~/storage/shared ]]; then
echo "~/storage/shared/ now exists. :)"
else
echo "ERROR: Something ain't right, Jim! Abort!" >&2
exit 1
return 1
fi
else
echo "Everything looks good already, pal."
fi
echo -e "\n`date` - Install & Updayte Crtical Software"
echo -e "\n`date` - Install & Update Critical Software"
pkg install -y \
openssh tsu vim htop git cronie man zip ncurses-utils \
openssh tsu vim htop git cronie man zip ncurses-utils which \
nmap traceroute wget rsync \
ffmpeg imagemagick \
kotlin php nodejs python libllvm hugo
kotlin php nodejs python libllvm hugo jq
echo -e "\n`date` - BASH Environment"
@@ -134,4 +134,4 @@ echo "*******"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo -e "\n`date` - Finished $PROG"
exit 0
return 0