Skip to content

Commit

Permalink
commit 613451977 on 20201128
Browse files Browse the repository at this point in the history
  • Loading branch information
SDRausty committed Nov 28, 2020
1 parent bc866fb commit ad3e42e
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .conf/VERSIONID
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.391
2.0.392
2 changes: 1 addition & 1 deletion archlinuxconfig.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ printf "\\\\e[1;33mDirectory: \\\\e[1;37m'/home/\$@ exists'\\\\e[0;32m: Exiting.
fi
}
_FUNADDU_() {
[[ ! "\$(command -v sudo)" ]] 2>/dev/null && pci sudo
[[ ! "\$(command -v sudo)" ]] 2>/dev/null && (pc sudo || pc sudo)
printf "\\\\e[0;32m%s\\\\n\\\\e[1;32m" "Adding Arch Linux in Termux PRoot user '\$1' and creating Arch Linux in Termux PRoot user \$1's home directory in /home/\$1..."
[[ ! -f /etc/sudoers ]] && touch /etc/sudoers
sed -i "/# %wheel ALL=(ALL) NOPASSWD: ALL/ s/^# *//" /etc/sudoers
Expand Down
45 changes: 42 additions & 3 deletions espritfunctions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,49 @@ sleep $SPINDLAY
done
}

_TAMATRIX_() { # print TermuxArch source code as matrix
# Terminal codes VT100 \\e[?25l information at https://wiki.bash-hackers.org/scripting/terminalcodes website.
_TAMATRIXEND_() { # print TermuxArch source code as matrix ending
# Information about VT100 terminal codes such as \\e[?25l is available at this https://wiki.bash-hackers.org/scripting/terminalcodes website.
printf "\\e[0;32m"
. "$0" help
tail -n 32 "$0"
. "$0" h
printf "\\e[0m"
printf "\\e[?25h"
}

_TAMATRIX_() { # partial implemintation; print TermuxArch source code as matrix
_DOTAMSTRIX_() {
printf "\\e[?25l\\e[1;32m%s" "$(tr -d '\n' < $0)"
# split a string from file and print this split string
IFS=';' read -ra TAMATARR <<< "$(tr -d '\n' < $0)" && for EMSTRING in "${TAMATARR[@]}" ; do printf "\\e[0;32m%s" "$EMSTRING" ; sleep 0.0"$(shuf -i 0-999 -n 1)" ; done ; tail -n 8 "$0" ; printf "\\e[0m" ; printf "\\e[?25h"; exit
for EMSTRING in "${TAMATARR[@]}"
do
printf "\\e[0;32m%s" "$EMSTRING"
sleep 0.0"$(shuf -i 0-999 -n 1)"
done
}
IFS=';' read -ra TAMATARR <<< "$(tr -d '\n' < $0)"
if [[ ! -z "${MATRIXLCR:-}" ]]
then
TAMATRIXENDLCR=0
while :
do
_DOTAMSTRIX_
done
else
_DOTAMSTRIX_
fi
_TAMATRIXEND_
}

_WAKELOCK_() {
_PRINTWLA_
am startservice --user 0 -a com.termux.service_wake_lock com.termux/com.termux.app.TermuxService > /dev/null || _PSGI1ESTRING_ "am startservice _WAKELOCK_ necessaryfunctions.bash ${0##/*} : Continuing..."
_PRINTDONE_
}

_WAKEUNLOCK_() {
_PRINTWLD_
am startservice --user 0 -a com.termux.service_wake_unlock com.termux/com.termux.app.TermuxService > /dev/null || _PSGI1ESTRING_ "am startservice _WAKEUNLOCK_ necessaryfunctions.bash ${0##/*} : Continuing..."
_PRINTDONE_
}
# espritfunctions.bash EOF
85 changes: 54 additions & 31 deletions necessaryfunctions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,39 @@ _AARCH64ANDROID_
fi
}

_DOMIRROR_() { # partial implementaion: choose the corrrect mirror and test this mirror website
_DOCEMIRROR_() {
USERCOUNTRYCODE="$(getprop gsm.operator.iso-country || getprop gsm.sim.operator.iso-country)"
printf "Copying file '%s' to file '%s'; " "$INSTALLDIR/etc/pacman.d/mirrorlist" "$INSTALLDIR/etc/pacman.d/mirrorlist.$STIME.termuxarchnew"
cp "$INSTALLDIR/etc/pacman.d/mirrorlist" "$INSTALLDIR/etc/pacman.d/mirrorlist.$STIME.termuxarchnew"
printf "DONE\\n"
if [[ $USERCOUNTRYCODE == us ]]
then
RUSRCOUNTRYCODE="$USERCOUNTRYCODE"
USERCOUNTRYCODE="edu"
fi
CHSENMIR="$(grep -w http "$INSTALLDIR/etc/pacman.d/mirrorlist" | grep ^#S | grep -w "$USERCOUNTRYCODE" | awk 'sub(/^.{1}/,"")' | head -n 1)"
printf "%s\\n" "$CHSENMIR" >> "$INSTALLDIR/etc/pacman.d/mirrorlist"
printf "Uncommented mirror '%s' in file '%s'; Continuing...\\n" "$CHSENMIR" "${INSTALLDIR##*/}/etc/pacman.d/mirrorlist"
DOMIRLCR=0
}
if [[ -f "$INSTALLDIR/var/lock/${INSTALLDIR##*/}/domirror.lock" ]]
then
printf "Lockfile '%s' exists; Continuing..." "~/${INSTALLDIR##*/}/var/lock/${INSTALLDIR##*/}/domirror.lock"
else
if ! grep ^Server "$INSTALLDIR/etc/pacman.d/mirrorlist"
then
_DOCEMIRROR_
fi
fi
}
_DOPROXY_() {
[[ -f "$HOME"/.bash_profile ]] && grep -s "proxy" "$HOME"/.bash_profile | grep -s "export" >> root/bin/"$BINFNSTP" ||:
[[ -f "$HOME"/.bashrc ]] && grep -s "proxy" "$HOME"/.bashrc | grep -s "export" >> root/bin/"$BINFNSTP" ||:
[[ -f "$HOME"/.profile ]] && grep -s "proxy" "$HOME"/.profile | grep -s "export" >> root/bin/"$BINFNSTP" ||:
}
_KERNID_() {
declare KID=""
ur="$(uname -r)"
Expand Down Expand Up @@ -177,12 +210,6 @@ _PRINTSTARTBIN_USAGE_
exit
}
_DOPROXY_() {
[[ -f "$HOME"/.bash_profile ]] && grep -s "proxy" "$HOME"/.bash_profile | grep -s "export" >> root/bin/"$BINFNSTP" ||:
[[ -f "$HOME"/.bashrc ]] && grep -s "proxy" "$HOME"/.bashrc | grep -s "export" >> root/bin/"$BINFNSTP" ||:
[[ -f "$HOME"/.profile ]] && grep -s "proxy" "$HOME"/.profile | grep -s "export" >> root/bin/"$BINFNSTP" ||:
}

_MAKEFINISHSETUP_() {
_DOKEYS_() {
if [[ "$CPUABI" = "$CPUABIX86" ]] || [[ "$CPUABI" = i386 ]]
Expand Down Expand Up @@ -238,7 +265,7 @@ then
printf "%s\\n" "pacman -Su grep gzip patch sed sudo unzip --noconfirm --color=always || pacman -Su gzip patch sed sudo unzip --noconfirm --color=always || _PMFSESTRING_ \"pacman -Su gzip patch sed sudo unzip $BINFNSTP ${0##/*}\"" >> root/bin/"$BINFNSTP"
elif [[ "$CPUABI" = "$CPUABIX86" ]] || [[ "$CPUABI" = i386 ]]
then
printf "%s\\n" "pacman -Su patch sudo unzip --noconfirm --color=always || pacman -Su patch sudo unzip --noconfirm --color=always || _PMFSESTRING_ \"pacman -Su patch sudo unzip $BINFNSTP ${0##/*}\"" >> root/bin/"$BINFNSTP"
printf "%s\\n" "pacman -Su sudo --noconfirm --color=always || pacman -Su sudo --noconfirm --color=always || _PMFSESTRING_ \"pacman -Su sudo $BINFNSTP ${0##/*}\"" >> root/bin/"$BINFNSTP"
fi
fi
cat >> root/bin/"$BINFNSTP" <<- EOM
Expand Down Expand Up @@ -428,13 +455,16 @@ _FIXOWNER_
_PREPROOT_() {
if [[ "$CPUABI" = "$CPUABIX86" ]] || [[ "$CPUABI" = "$CPUABIX86_64" ]] || [[ "$CPUABI" = i386 ]] || [[ "$IFILE" == *i686* ]]
then
_TASPINNER_ clock & proot --link2symlink -0 bsdtar -p -xf "$IFILE" --strip-components 1 ; kill $!
_TASPINNER_ clock & proot --link2symlink -0 tar -p -xf "$IFILE" --strip-components 1 ; kill $!
else
_TASPINNER_ clock & proot --link2symlink -0 bsdtar -p -xf "$IFILE" ; kill $!
_TASPINNER_ clock & proot --link2symlink -0 tar -p -xf "$IFILE" ; kill $!
fi
}
_RUNFINISHSETUP_() {
_SEDUNCOM_() {
sed -i "/\/mirror.archlinuxarm.org/ s/^# *//" "$INSTALLDIR/etc/pacman.d/mirrorlist" || _PSGI1ESTRING_ "sed -i _SEDUNCOM_ necessaryfunctions.bash ${0##*/}" # sed replace a character in a matched line in place
}
_ADDresolvconf_
ALMLLOCN="$INSTALLDIR/etc/pacman.d/mirrorlist"
cp "$ALMLLOCN" "$INSTALLDIR/var/backups/${INSTALLDIR##*/}/etc/mirrorlist.$SDATE.bkp" || _PSGI1ESTRING_ "cp _RUNFINISHSETUP_ necessaryfunctions.bash ${0##*/}"
Expand All @@ -443,10 +473,11 @@ then
AL32MRLT="https://git.archlinux32.org/packages/plain/core/pacman-mirrorlist/mirrorlist"
printf "\\e[0m\\n%s\\n" "Updating ${ALMLLOCN##*/} from $AL32MRLT."
curl --retry 4 "$AL32MRLT" -o "$ALMLLOCN"
_DOMIRROR_
elif [[ "$CPUABI" = "$CPUABIX86_64" ]]
then
_DOMIRROR_
fi
_SEDUNCOM_() {
sed -i "/\/mirror.archlinuxarm.org/ s/^# *//" "$INSTALLDIR/etc/pacman.d/mirrorlist" || _PSGI1ESTRING_ "sed -i _SEDUNCOM_ necessaryfunctions.bash ${0##*/}" # sed replace a character in a matched line in place
}
printf "\\e[0m"
if [[ "$FSTND" ]]
then
Expand All @@ -462,6 +493,9 @@ printf "%s\\n" "Did not find server $NMIR in /etc/pacman.d/mirrorlist; Adding $N
printf "%s\\n" "Server = $NLCMIRROR/\$arch/\$repo" >> "$INSTALLDIR/etc/pacman.d/mirrorlist"
fi
else
if [[ -z "${DOMIRLCR:-}" ]]
then
DOMIRLCR=0
if [[ -z "${USEREDIT:-}" ]] || [[ "$USEREDIT" = "" ]]
then
_EDITORS_
Expand All @@ -473,11 +507,12 @@ fi
fi
"$USEREDIT" "$INSTALLDIR/etc/pacman.d/mirrorlist"
fi
fi
$INSTALLDIR/root/bin/setupbin.bash || _PRINTPROOTERROR_
}
_SETLANGUAGE_() { # This function uses device system settings to set locale. To generate locales in a preferred language, you can use "Settings > Language & Keyboard > Language" in Android; Then run 'setupTermuxArch r' for a quick system refresh to regenerate locales in your preferred language.
ULANGUAGE="unkown"
ULANGUAGE="C"
LANGIN=([0]="$(getprop user.language)")
LANGIN+=([1]="$(getprop user.region)")
LANGIN+=([2]="$(getprop persist.sys.country)")
Expand All @@ -487,17 +522,17 @@ LANGIN+=([5]="$(getprop ro.product.locale)")
LANGIN+=([6]="$(getprop ro.product.locale.language)")
LANGIN+=([7]="$(getprop ro.product.locale.region)")
touch "$INSTALLDIR"/etc/locale.gen
ULANGUAGE="${LANGIN[0]:-unknown}_${LANGIN[1]:-unknown}"
ULANGUAGE="${LANGIN[0]:-C}_${LANGIN[1]:-C}"
if ! grep -q "$ULANGUAGE" "$INSTALLDIR"/etc/locale.gen
then
ULANGUAGE="unknown"
ULANGUAGE="C"
fi
if [[ "$ULANGUAGE" != *_* ]]
then
ULANGUAGE="${LANGIN[3]:-unknown}_${LANGIN[2]:-unknown}"
ULANGUAGE="${LANGIN[3]:-C}_${LANGIN[2]:-C}"
if ! grep -q "$ULANGUAGE" "$INSTALLDIR"/etc/locale.gen
then
ULANGUAGE="unknown"
ULANGUAGE="C"
fi
fi
for i in "${!LANGIN[@]}"
Expand All @@ -510,10 +545,10 @@ fi
done
if [[ "$ULANGUAGE" != *_* ]]
then
ULANGUAGE="${LANGIN[6]:-unknown}_${LANGIN[7]:-unknown}"
ULANGUAGE="${LANGIN[6]:-C}_${LANGIN[7]:-C}"
if ! grep -q "$ULANGUAGE" "$INSTALLDIR"/etc/locale.gen
then
ULANGUAGE="unknown"
ULANGUAGE="C"
fi
fi
if [[ "$ULANGUAGE" != *_* ]]
Expand Down Expand Up @@ -541,16 +576,4 @@ _RUNFINISHSETUP_
rm -f root/bin/$BINFNSTP
rm -f root/bin/setupbin.bash
}

_WAKELOCK_() {
_PRINTWLA_
am startservice --user 0 -a com.termux.service_wake_lock com.termux/com.termux.app.TermuxService > /dev/null || _PSGI1ESTRING_ "am startservice _WAKELOCK_ necessaryfunctions.bash ${0##/*} : Continuing..."
_PRINTDONE_
}

_WAKEUNLOCK_() {
_PRINTWLD_
am startservice --user 0 -a com.termux.service_wake_unlock com.termux/com.termux.app.TermuxService > /dev/null || _PSGI1ESTRING_ "am startservice _WAKEUNLOCK_ necessaryfunctions.bash ${0##/*} : Continuing..."
_PRINTDONE_
}
# necessaryfunctions.bash EOF
2 changes: 1 addition & 1 deletion printoutstatements.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FLHDR1[1]="# IFS=$'\\n\\t'"
FLHDR1[2]="set -Eeuo pipefail"
FLHDR1[3]="shopt -s nullglob globstar"
FLHDR1[4]="unset LD_PRELOAD"
FLHDR1[5]="VERSIONID=2.0.390"
FLHDR1[5]="VERSIONID=2.0.391"
FLHDR1[6]=""
FLHDRP[0]="## BEGIN #####################################################################"
FLHDRP[1]=""
Expand Down
26 changes: 23 additions & 3 deletions setupTermuxArch
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
# command 'setupTermuxArch h[elp]' has information how to use this file
################################################################################
IFS=$'\n\t'
VERSIONID=2.0.390
VERSIONID=2.0.391
set -Eeuo pipefail
shopt -s nullglob globstar
umask 0022
unset LD_PRELOAD
## INIT FUNCTIONS ##############################################################
## The entire dataset can be viewed and work on with command 'setupTermuxArch bloom' which downloads all the components of TermuxArch into a ~/TermuxArchBloom directory in the home directory. The command 'setupTermuxArch bloom' is very similar to command 'setupTermuxArch manual' but much more expansive, verbose. Command 'setupTermuxArch h[elp]' has additional information how to use this file.

_TAMATRIXEXIT_() { # run when Matrix presentation ends
if [[ ! -z "${TAMATRIXENDLCR:-}" ]]
then
_TAMATRIXEND_
fi
}

_STRPERROR_() { # run on script error
local RV="$?"
printf "\\e[?25h\\n\\e[1;48;5;138m %s\\e[0m\\n" "TermuxArch WARNING: Generated script signal ${RV:-unknown} near or at line number ${1:-unknown} by '${2:-command}'!"
Expand All @@ -31,6 +39,10 @@ _STRPEXIT_() { # run on exit
local RV="$?"
rm -rf "$TAMPDIR"
sleep 0.04
if [[ ! -z "${TAMATRIXENDLCR:-}" ]]
then
_TAMATRIXEND_
fi
if [[ "$RV" = 0 ]]
then
printf "\\e[0;32mCommand \\e[1;32m%s \\e[0;32mversion %s\\e[1;34m: \\e[1;32m%s\\e[0m\\n\\n" "'${0##*/} $ARGS'" "$VERSIONID" "DONE 🏁 "
Expand Down Expand Up @@ -707,7 +719,7 @@ rm -rf "$INSTALLDIR" 2>/dev/null || _PSGI1ESTRING_ "rm -rf _RMARCHRM_ setupTermu
}
_SETROOT_EXCEPTION_
declare -a EXONSTGE
EXONSTGE=("$(find "$INSTALLDIR" -name storage -type d)")
EXONSTGE=("$(find "$INSTALLDIR" -name storage -type d 2>/dev/null ||:)")
_DOEXONSTGE_() {
for EXONSTGEM in ${EXONSTGE[@]}
do
Expand Down Expand Up @@ -794,7 +806,7 @@ else
STIME="$SDATE" && STIME="$(rev <<< "${STIME:7:4}")"
fi
ONESA="${SDATE: -1}"
PKGS=(bsdtar proot)
PKGS=(proot)
STIME="$ONESA$STIME"
## 5) Get device information via the 'getprop' command,
## 6) Determine its own name and location of invocation,
Expand Down Expand Up @@ -927,6 +939,14 @@ printf "\\nSetting 'lftp' as download manager.\\n"
DM=lftp
_OPT1_ "$@"
_INTRO_ "$@"
## [matr[ix]] Print TermuxArch source code as Matrix loop
elif [[ "${1//-}" = [Mm][Aa][Tt][Rr]* ]]
then
printf "\\nSetting mode to matrix loop.\\n"
MATRIXLCR=0
_PREPTERMUXARCH_
_DEPENDSBLOCK_ "$@"
_TAMATRIX_
## [mat[ix]] Print TermuxArch source code as Matrix
elif [[ "${1//-}" = [Mm][Aa][Tt]* ]]
then
Expand Down
26 changes: 23 additions & 3 deletions setupTermuxArch.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
# command 'setupTermuxArch h[elp]' has information how to use this file
################################################################################
IFS=$'\n\t'
VERSIONID=2.0.390
VERSIONID=2.0.391
set -Eeuo pipefail
shopt -s nullglob globstar
umask 0022
unset LD_PRELOAD
## INIT FUNCTIONS ##############################################################
## The entire dataset can be viewed and work on with command 'setupTermuxArch bloom' which downloads all the components of TermuxArch into a ~/TermuxArchBloom directory in the home directory. The command 'setupTermuxArch bloom' is very similar to command 'setupTermuxArch manual' but much more expansive, verbose. Command 'setupTermuxArch h[elp]' has additional information how to use this file.

_TAMATRIXEXIT_() { # run when Matrix presentation ends
if [[ ! -z "${TAMATRIXENDLCR:-}" ]]
then
_TAMATRIXEND_
fi
}

_STRPERROR_() { # run on script error
local RV="$?"
printf "\\e[?25h\\n\\e[1;48;5;138m %s\\e[0m\\n" "TermuxArch WARNING: Generated script signal ${RV:-unknown} near or at line number ${1:-unknown} by '${2:-command}'!"
Expand All @@ -31,6 +39,10 @@ _STRPEXIT_() { # run on exit
local RV="$?"
rm -rf "$TAMPDIR"
sleep 0.04
if [[ ! -z "${TAMATRIXENDLCR:-}" ]]
then
_TAMATRIXEND_
fi
if [[ "$RV" = 0 ]]
then
printf "\\e[0;32mCommand \\e[1;32m%s \\e[0;32mversion %s\\e[1;34m: \\e[1;32m%s\\e[0m\\n\\n" "'${0##*/} $ARGS'" "$VERSIONID" "DONE 🏁 "
Expand Down Expand Up @@ -707,7 +719,7 @@ rm -rf "$INSTALLDIR" 2>/dev/null || _PSGI1ESTRING_ "rm -rf _RMARCHRM_ setupTermu
}
_SETROOT_EXCEPTION_
declare -a EXONSTGE
EXONSTGE=("$(find "$INSTALLDIR" -name storage -type d)")
EXONSTGE=("$(find "$INSTALLDIR" -name storage -type d 2>/dev/null ||:)")
_DOEXONSTGE_() {
for EXONSTGEM in ${EXONSTGE[@]}
do
Expand Down Expand Up @@ -794,7 +806,7 @@ else
STIME="$SDATE" && STIME="$(rev <<< "${STIME:7:4}")"
fi
ONESA="${SDATE: -1}"
PKGS=(bsdtar proot)
PKGS=(proot)
STIME="$ONESA$STIME"
## 5) Get device information via the 'getprop' command,
## 6) Determine its own name and location of invocation,
Expand Down Expand Up @@ -927,6 +939,14 @@ printf "\\nSetting 'lftp' as download manager.\\n"
DM=lftp
_OPT1_ "$@"
_INTRO_ "$@"
## [matr[ix]] Print TermuxArch source code as Matrix loop
elif [[ "${1//-}" = [Mm][Aa][Tt][Rr]* ]]
then
printf "\\nSetting mode to matrix loop.\\n"
MATRIXLCR=0
_PREPTERMUXARCH_
_DEPENDSBLOCK_ "$@"
_TAMATRIX_
## [mat[ix]] Print TermuxArch source code as Matrix
elif [[ "${1//-}" = [Mm][Aa][Tt]* ]]
then
Expand Down
Loading

1 comment on commit ad3e42e

@SDRausty
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.