Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
2324acb6d6 | |||
e27924f062 | |||
d3dc527b26 | |||
7ceb1f436b | |||
8ef92669cd | |||
d793218215 | |||
bb0bcc27c8 | |||
bdd7e7855b | |||
060a3b25d8 | |||
6b3975176a | |||
67ef7d128f |
@@ -7,7 +7,7 @@ Hyperling's scripts for a productive Termux environment.
|
|||||||
1. Download the repository.
|
1. Download the repository.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/Hyperling/Termux termux
|
git clone https://git.hyperling.com/me/env-termux env-termux
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Dive into the directory.
|
1. Dive into the directory.
|
||||||
|
67
bashrc.sh
67
bashrc.sh
@@ -34,6 +34,39 @@ alias dcim="cd $DCIM"
|
|||||||
export CODE="$SS/Code"
|
export CODE="$SS/Code"
|
||||||
alias code="cd $CODE"
|
alias code="cd $CODE"
|
||||||
|
|
||||||
|
function code-projects {
|
||||||
|
cat <<- EOF
|
||||||
|
env-termux dev
|
||||||
|
env-ansible dev
|
||||||
|
env-docker dev
|
||||||
|
nodejs-website dev
|
||||||
|
hugo-jackanope main
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
function code-reseed {
|
||||||
|
cd ~/Code
|
||||||
|
code-projects | while read project branch; do
|
||||||
|
git clone ssh://git@$GIT_SERVER:$GIT_PORT/$GIT_USER/$project --branch $branch --recurse-submodules
|
||||||
|
done
|
||||||
|
}
|
||||||
|
alias reseed-code="code-reseed"
|
||||||
|
|
||||||
|
function check-code {
|
||||||
|
cd ~/Code
|
||||||
|
ls | while read project; do
|
||||||
|
echo "Checking $project..."
|
||||||
|
cd $project
|
||||||
|
if [[ -d .git ]]; then
|
||||||
|
git pull
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "* Not a valid git project, skipping."
|
||||||
|
fi
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
}
|
||||||
|
alias code-check="check-code"
|
||||||
|
|
||||||
# Shortcuts for TRASH.
|
# Shortcuts for TRASH.
|
||||||
export TRASH="$SS/TRASH"
|
export TRASH="$SS/TRASH"
|
||||||
alias trash="cd $TRASH"
|
alias trash="cd $TRASH"
|
||||||
@@ -48,18 +81,36 @@ alias mv="mv -v"
|
|||||||
alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'"
|
alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'"
|
||||||
|
|
||||||
# Quickies
|
# Quickies
|
||||||
alias update="pkg update && pkg upgrade"
|
alias upgrade="update"
|
||||||
alias bye="exit"
|
alias bye="exit"
|
||||||
alias goodbye="update -y && bye"
|
alias goodbye="update -y && bye"
|
||||||
alias install="pkg install"
|
alias install="pkg install"
|
||||||
|
alias scan="nmap -A -p- --script=vuln"
|
||||||
|
|
||||||
## Functions ##
|
## Functions ##
|
||||||
|
|
||||||
|
function update {
|
||||||
|
params="$1"
|
||||||
|
|
||||||
|
echo "******* Apt *******" &&
|
||||||
|
echo "*** Update Cache ***" &&
|
||||||
|
apt update &&
|
||||||
|
echo -e "\n*** Auto Remove ***" &&
|
||||||
|
apt autoremove $params &&
|
||||||
|
echo -e "\n*** Clean ***" &&
|
||||||
|
apt clean $params &&
|
||||||
|
echo -e "Cleaned!\n\n*** Fix Broken/Missing ***" &&
|
||||||
|
apt --fix-broken --fix-missing install &&
|
||||||
|
echo -e "\n*** Upgrade ***" &&
|
||||||
|
apt dist-upgrade --allow-downgrades --fix-broken --fix-missing $params &&
|
||||||
|
echo -e "\n******* Mission Complete!! *******"
|
||||||
|
}
|
||||||
|
|
||||||
# Optimize the bitrate and audio levels for an edited video.
|
# Optimize the bitrate and audio levels for an edited video.
|
||||||
function process-video-usage {
|
function process-video-usage {
|
||||||
echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating]"
|
echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating] [numPasses] [forceBitrate]"
|
||||||
echo -n "Purpose: Call ffmpeg with preferred video posting settings. "
|
echo -n "Purpose: Call ffmpeg with preferred video posting settings. "
|
||||||
echo -n "Bitrates default to 2000k and 192k, size is 720. "
|
echo -n "Bitrates default to 2000k and 192k, size is 720, passes is 1, and force is N."
|
||||||
echo "These work well on Odysee and are fairly small as backups."
|
echo "These work well on Odysee and are fairly small as backups."
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo "- Create a small file for quick streaming."
|
echo "- Create a small file for quick streaming."
|
||||||
@@ -75,6 +126,7 @@ function process-video {
|
|||||||
audio="$4"
|
audio="$4"
|
||||||
size="$5"
|
size="$5"
|
||||||
passes="$6"
|
passes="$6"
|
||||||
|
force="$7"
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
if [[ -z $file || ! -e $file ]]; then
|
if [[ -z $file || ! -e $file ]]; then
|
||||||
@@ -99,7 +151,11 @@ function process-video {
|
|||||||
if [[ -z $video ]]; then
|
if [[ -z $video ]]; then
|
||||||
video="2000k"
|
video="2000k"
|
||||||
fi
|
fi
|
||||||
video="-maxrate $video"
|
if [[ $force == "Y" ]]; then
|
||||||
|
video="-b:v $video"
|
||||||
|
else
|
||||||
|
video="-b:v $video -minrate 0 -maxrate $video -bufsize $video"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $audio ]]; then
|
if [[ -z $audio ]]; then
|
||||||
audio="192k"
|
audio="192k"
|
||||||
@@ -184,7 +240,8 @@ function commit {
|
|||||||
# Otherwise can just source this file unless testing setup.sh.
|
# Otherwise can just source this file unless testing setup.sh.
|
||||||
function test-termux {
|
function test-termux {
|
||||||
sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null
|
sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null
|
||||||
git clone https://github.com/Hyperling/Termux ~/termux-deleteme --branch=dev
|
git clone https://git.hyperling.com/me/env-termux \
|
||||||
|
--branch=dev ~/termux-deleteme
|
||||||
chmod 755 ~/termux-deleteme/*.sh
|
chmod 755 ~/termux-deleteme/*.sh
|
||||||
~/termux-deleteme/setup.sh
|
~/termux-deleteme/setup.sh
|
||||||
}
|
}
|
||||||
|
26
setup.sh
26
setup.sh
@@ -9,11 +9,16 @@ cd $DIR
|
|||||||
DIR="`pwd`"
|
DIR="`pwd`"
|
||||||
echo "Working in '$DIR'."
|
echo "Working in '$DIR'."
|
||||||
|
|
||||||
|
if [[ $1 == "skip" ]]; then
|
||||||
|
echo "\n`date` - Skipping Updates"
|
||||||
|
else
|
||||||
echo -e "\n`date` - Upgrade Package Repos"
|
echo -e "\n`date` - Upgrade Package Repos"
|
||||||
pkg update &&
|
pkg update &&
|
||||||
pkg upgrade -y
|
pkg upgrade -y
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "\n`date` - Check Storage Permission"
|
echo -e "\n`date` - Check Storage Permission"
|
||||||
|
|
||||||
if [[ ! -e ~/storage/shared ]]; then
|
if [[ ! -e ~/storage/shared ]]; then
|
||||||
sleep 3
|
sleep 3
|
||||||
termux-setup-storage
|
termux-setup-storage
|
||||||
@@ -27,14 +32,19 @@ else
|
|||||||
echo "Everything looks good already, pal."
|
echo "Everything looks good already, pal."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "skip" ]]; then
|
||||||
|
echo "\n`date` - Skipping Installs"
|
||||||
|
else
|
||||||
echo -e "\n`date` - Install Software"
|
echo -e "\n`date` - Install Software"
|
||||||
pkg install -y \
|
pkg install -y \
|
||||||
openssh tsu vim htop git cronie man \
|
openssh tsu vim htop git cronie man zip \
|
||||||
nmap traceroute wget \
|
nmap traceroute wget \
|
||||||
ffmpeg imagemagick \
|
ffmpeg imagemagick \
|
||||||
kotlin php nodejs python libllvm
|
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 env.example ]]; then
|
if [[ -e env.example ]]; then
|
||||||
mv -v env.example ~/.env
|
mv -v env.example ~/.env
|
||||||
@@ -52,7 +62,8 @@ else
|
|||||||
echo "ERROR: bashrc.sh not found, skipping." >&2
|
echo "ERROR: bashrc.sh not found, skipping." >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n`date` - Cleanup"
|
echo -e "\n`date` - Directoriee"
|
||||||
|
|
||||||
if [[ -d ~/TRASH ]]; then
|
if [[ -d ~/TRASH ]]; then
|
||||||
rm -rfv ~/TRASH
|
rm -rfv ~/TRASH
|
||||||
fi
|
fi
|
||||||
@@ -61,7 +72,14 @@ if [[ ! -e ~/storage/shared/TRASH ]]; then
|
|||||||
fi
|
fi
|
||||||
ln -s ~/storage/shared/TRASH ~/TRASH
|
ln -s ~/storage/shared/TRASH ~/TRASH
|
||||||
|
|
||||||
if [[ -n $DIR && $DIR != "/" && -d .git ]]; then
|
if [[ ! -d ~/Code && ! -d ~/storage/shared/Code ]]; then
|
||||||
|
mkdir -pv ~/Code
|
||||||
|
ln -s ~/Code ~/storage/shared/Code
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n`date` - Cleanup"
|
||||||
|
|
||||||
|
if [[ -n $DIR && $DIR != "/" && $DIR == *"deleteme" && -d .git ]]; then
|
||||||
echo "We are in a git clone, remove the project."
|
echo "We are in a git clone, remove the project."
|
||||||
cd ..
|
cd ..
|
||||||
mv -v $DIR ~/TRASH/termux-"`date +'%Y%m%d%H%M%S'`" |
|
mv -v $DIR ~/TRASH/termux-"`date +'%Y%m%d%H%M%S'`" |
|
||||||
|
Reference in New Issue
Block a user