Compare commits
24
Commits
16aa8b17cd
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c62c47dc7e | ||
|
|
d154171f33 | ||
|
|
1cd5a4789c | ||
|
|
6caa36a09d | ||
|
|
6834d85fc2 | ||
|
|
2de6e77d40 | ||
|
|
cfd18df2c5 | ||
|
|
604639033b | ||
|
|
3d0347e41a | ||
|
|
4a9b4353d4 | ||
|
|
fd238ddf2d | ||
|
|
864e8fa8db | ||
|
|
7b62b21da9 | ||
|
|
53d2587756 | ||
|
|
2c1fba93d9 | ||
|
|
5c12ff4a3b | ||
|
|
1c32aa3658 | ||
|
|
f2c658a4f1 | ||
|
|
65bdce1a8c | ||
|
|
07ca4beacf | ||
|
|
ba465cdece | ||
|
|
eda63610ad | ||
|
|
909875df32 | ||
|
|
4b0f0cbbcd |
No files matched your search
@@ -123,20 +123,19 @@ 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.
|
||||||
project="$HOME/.git-env-termux"
|
export PROJECT_TERMUX="$HOME/.git-env-termux"
|
||||||
function test-termux {
|
function test-termux {
|
||||||
if [[ -d "$project" ]]; then
|
if [[ -d "$PROJECT_TERMUX" ]]; then
|
||||||
log "`date` - Updating '$project'.\n"
|
log "`date` - Updating '$PROJECT_TERMUX'.\n"
|
||||||
git -C "$project" switch "$branch"
|
git -C "$PROJECT_TERMUX" switch "$BRANCH"
|
||||||
git -C "$project" pull --recurse-submodules || \
|
git -C "$PROJECT_TERMUX" pull --recurse-submodules || \
|
||||||
( echo "Failed to pull project, exiting." && return 1 )
|
( echo "Failed to pull project, exiting." && return 1 )
|
||||||
else
|
else
|
||||||
log "`date` - Downloading '$project'.\n"
|
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=$BRANCH "$project"
|
--branch=$BRANCH "$PROJECT_TERMUX"
|
||||||
fi
|
fi
|
||||||
chmod 755 "$project"/*.sh
|
"$PROJECT_TERMUX"/setup.sh "$@"
|
||||||
"$project"/setup.sh "$@"
|
|
||||||
}
|
}
|
||||||
alias reload-termux="test-termux "
|
alias reload-termux="test-termux "
|
||||||
alias termux-test="test-termux "
|
alias termux-test="test-termux "
|
||||||
@@ -148,56 +147,56 @@ 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.
|
||||||
# Change a branch to point at another.
|
# Change a branch to point at another.
|
||||||
function load-branch {
|
function load-branch {
|
||||||
rcvr="$1" # branch which we want to modify
|
rcvr="$1" # branch which we want to modify
|
||||||
base="$2" # branch with the changes we want
|
base="$2" # branch with the changes we want
|
||||||
|
|
||||||
if [[ "$rcvr" == "main" ]]; then
|
if [[ "$rcvr" == "main" ]]; then
|
||||||
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
|
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$base" ]]; then
|
|
||||||
if [[ "$rcvr" == "prod" ]]; then
|
|
||||||
base="stage"
|
|
||||||
elif [[ "$rcvr" == "stage" ]]; then
|
|
||||||
base="dev"
|
|
||||||
else
|
|
||||||
echo "* Unsure which branch to use for '$rcvr'. Please specify."
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "* Base was not specified, using '$base' for '$rcvr'."
|
|
||||||
else
|
|
||||||
echo "* Requested pointing '$rcvr' branch to '$base'."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\n* Ensuring we are on base branch '$base'." &&
|
if [[ -z "$base" ]]; then
|
||||||
git switch "$base" &&
|
if [[ "$rcvr" == "prod" ]]; then
|
||||||
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
|
base="stage"
|
||||||
git branch -f "$rcvr" "$base" &&
|
elif [[ "$rcvr" == "stage" ]]; then
|
||||||
#echo -e "\n* Switching to branch '$rcvr'." &&
|
base="dev"
|
||||||
#git switch "$rcvr" &&
|
else
|
||||||
echo -e "\n* Forcing push on branch '$rcvr'." &&
|
echo "* Unsure which branch to use for '$rcvr'. Please specify."
|
||||||
git push --force --set-upstream origin "$rcvr" &&
|
return 1
|
||||||
echo -e "\n* Done! Displaying list of remote branches." &&
|
fi
|
||||||
git ls-remote --heads | sort
|
echo "* Base was not specified, using '$base' for '$rcvr'."
|
||||||
|
|
||||||
if [[ "$base" != "dev" ]]; then
|
|
||||||
echo -e "\n* Checking if a dev branch exists."
|
|
||||||
git ls-remote --exit-code --heads origin dev
|
|
||||||
dev_exists="$?"
|
|
||||||
if [[ "$dev_exists" == 0 ]]; then
|
|
||||||
echo -e "\n* Switching back to dev."
|
|
||||||
git switch dev
|
|
||||||
elif [[ "$dev_exists" == 2 ]]; then
|
|
||||||
echo -e "\n* Switching back to main."
|
|
||||||
git switch main
|
|
||||||
else
|
else
|
||||||
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
|
echo "* Requested pointing '$rcvr' branch to '$base'."
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\n* Verifying which branch we're on."
|
echo -e "\n* Ensuring we are on base branch '$base'." &&
|
||||||
git branch
|
git switch "$base" &&
|
||||||
|
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
|
||||||
|
git branch -f "$rcvr" "$base" &&
|
||||||
|
#echo -e "\n* Switching to branch '$rcvr'." &&
|
||||||
|
#git switch "$rcvr" &&
|
||||||
|
echo -e "\n* Forcing push on branch '$rcvr'." &&
|
||||||
|
git push --force --set-upstream origin "$rcvr" &&
|
||||||
|
echo -e "\n* Done! Displaying list of remote branches." &&
|
||||||
|
git ls-remote --heads | sort
|
||||||
|
|
||||||
|
if [[ "$base" != "dev" ]]; then
|
||||||
|
echo -e "\n* Checking if a dev branch exists."
|
||||||
|
git ls-remote --exit-code --heads origin dev
|
||||||
|
dev_exists="$?"
|
||||||
|
if [[ "$dev_exists" == 0 ]]; then
|
||||||
|
echo -e "\n* Switching back to dev."
|
||||||
|
git switch dev
|
||||||
|
elif [[ "$dev_exists" == 2 ]]; then
|
||||||
|
echo -e "\n* Switching back to main."
|
||||||
|
git switch main
|
||||||
|
else
|
||||||
|
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n* Verifying which branch we're on."
|
||||||
|
git branch
|
||||||
}
|
}
|
||||||
alias load-prod="load-branch prod"
|
alias load-prod="load-branch prod"
|
||||||
alias load-stage="load-branch stage"
|
alias load-stage="load-branch stage"
|
||||||
@@ -247,7 +246,7 @@ 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/*`date +"%Y%m%d"`*.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"
|
||||||
|
|
||||||
@@ -258,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"
|
||||||
@@ -338,13 +360,35 @@ alias prod-pull="pull_prod_backups"
|
|||||||
eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
|
eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
|
||||||
|
|
||||||
# Run update checker in background.
|
# Run update checker in background.
|
||||||
( if [[ -d "$project" ]]; then
|
(
|
||||||
git -C "$project" fetch >/dev/null 2>&1 && git -C "$project" status | grep "is behind" \
|
(
|
||||||
| while read status; do
|
if [[ -d "$PROJECT_TERMUX" ]]; then
|
||||||
log "\n\n`date` - Updates to env-termux are available via 'reload-termux'."
|
git -C "$PROJECT_TERMUX" fetch >/dev/null 2>&1 \
|
||||||
log " '$status'"
|
&& git -C "$PROJECT_TERMUX" status \
|
||||||
done
|
| grep "is behind" \
|
||||||
fi & )
|
| 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]}")"
|
||||||
|
|||||||
@@ -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,16 +40,12 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$skip" == "true" ]]; then
|
echo -e "\n`date` - Install & Updayte Crtical Software"
|
||||||
echo "\n`date` - Skipping Installs"
|
pkg install -y \
|
||||||
else
|
openssh tsu vim htop git cronie man zip ncurses-utils \
|
||||||
echo -e "\n`date` - Install Software"
|
nmap traceroute wget rsync \
|
||||||
pkg install -y \
|
ffmpeg imagemagick \
|
||||||
openssh tsu vim htop git cronie man zip ncurses-utils \
|
kotlin php nodejs python libllvm hugo
|
||||||
nmap traceroute wget rsync \
|
|
||||||
ffmpeg imagemagick \
|
|
||||||
kotlin php nodejs python libllvm hugo
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "\n`date` - BASH Environment"
|
echo -e "\n`date` - BASH Environment"
|
||||||
@@ -86,21 +82,34 @@ if [[ ! -d ~/Code && ! -d ~/sdcard/Code ]]; then
|
|||||||
ln -s ~/Code /sdcard/Code
|
ln -s ~/Code /sdcard/Code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -d /sdcard && ! -d "$HOME"/Reports ]]; then
|
||||||
|
mkdir -pv /sdcard/Reports
|
||||||
|
ln -s /sdcard/Reports "$HOME"/Reports
|
||||||
|
fi
|
||||||
|
|
||||||
env_shared_dir="$HOME/.env-shared"
|
|
||||||
|
echo -e "\n`date` - env-shared"
|
||||||
|
env_shared_dir="$HOME/.git-env-shared"
|
||||||
if [[ ! -d "$env_shared_dir" ]]; then
|
if [[ ! -d "$env_shared_dir" ]]; then
|
||||||
echo -e "\n`date` - env-shared"
|
echo -e "`date` - Not installed, downloading."
|
||||||
if [[ -z "$BRANCH" ]]; then
|
if [[ -z "$BRANCH" ]]; then
|
||||||
export BRANCH="dev"
|
export BRANCH="dev"
|
||||||
fi
|
fi
|
||||||
git clone https://git.hyperling.com/me/env-shared \
|
git clone https://git.hyperling.com/me/env-shared \
|
||||||
--branch=$BRANCH ~/$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/
|
||||||
|
else
|
||||||
|
echo -e "`date` - Already installed, updating."
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user