Skip to content

Commit

Permalink
Update update_full-unix.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mportizlunyov authored Aug 20, 2023
1 parent 4ed8e47 commit 320ea2f
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions update_full-unix.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Written by Mikhail Patricio Ortiz-Lunyov
#
# Version 1.5.4 (August 17th, 2023)
# Version 1.5.5 (August 20th, 2023)
#
# This script is licensed under the GNU Public License Version 3 (GPLv3).
# Compatible and tested with BASH, SH, KSH, ASH, DASH and ZSH.
Expand All @@ -11,6 +11,7 @@
# Best practice is to limit writing permissions to this script in order to avoid accidental or malicious tampering.
# Checking the hashes from the github can help to check for tampering.


# Prints Exit Statement
ExitStatement () {
printf "\tI hope this program was useful for you!\n\n"
Expand All @@ -20,15 +21,17 @@ ExitStatement () {
# Checks for CURL/WGET dependency
DependencyTest () {
# Checks for CURL or WGET
if [ "$(curl > /dev/null 2>&1)" != "127" ] ; then
curl > /dev/null 2>&1
if [ "$?" != "127" ] ; then
# CURL is the preferred tool
printf "* CURL found, resuming!\n"
TOOLUSE="CURL"
CURL_INSECURE=false
else
printf "!!CURL missing\n"
# Checks for WGET as backup
if [ "$(wget > /dev/null 2)" != "127" ] ; then
wget > /dev/null 2>&1
if [ "$?" != "127" ] ; then
printf "* WGET found, resuming!\n"
TOOLUSE="WGET"
else
Expand Down Expand Up @@ -620,12 +623,12 @@ PrivacyPolicyMessage () {
SaveStatsComments () {
# Checks if NOCOMMENT variable is true
if [ "$NOCOMMENT" != "true" ] ; then
printf "\n\n\e[1mT* ype in the letters \"~esc~\" to exit the comments bar\n= = =\n"
printf "\n\n\e[1m* Type in the letters \"~esc~\" to exit the comments bar\n= = =\n"
COMMENTINPUT=""
# Loops until user types in 'esc'
until [ "$COMMENTINPUT" = "~esc~" ] ; do
( echo "$COMMENTINPUT" ) >> ./tempfile_COMMENTS
printf "TYPE: "
printf "* \e[0mTYPE:\e[1m "
read COMMENTINPUT
done
printf "= = =\n\e[0m"
Expand Down Expand Up @@ -889,6 +892,7 @@ ActionFlag () {
case $1 in
"-"* | "--"*)
MAIN_ARG=$1
# Strip initial dashes -- or -
case $MAIN_ARG in
"--"*"")
MAIN_ARG=$(echo "$MAIN_ARG" | cut -c "3-")
Expand All @@ -897,6 +901,7 @@ ActionFlag () {
MAIN_ARG=$(echo "$MAIN_ARG" | cut -c "2-")
;;
esac
# Read actual arguments
case $MAIN_ARG in
# Functional Arguments
"save-statistics" | "ss")
Expand Down Expand Up @@ -952,6 +957,7 @@ ActionFlag () {
ARG_MOD=$1
ARG_MOD="$(echo "$ARG_MOD" | cut -c "2-")"
case $MAIN_ARG in
# Modifiers for --save-statistics
"save-statistics" | "ss")
case $ARG_MOD in
"no-comment" | "nc")
Expand All @@ -965,26 +971,31 @@ ActionFlag () {
;;
esac
;;
# Modifiers for --custom-domain
"custom-domain" | "cd")
PRELOADED_CUSTOM_DOMAIN=$ARG_MOD
PRE_CD=true
;;
# Modifiers for --custom-log-path
"custom-log-path" | "clp")
LOG_DIR_PATH=$ARG_MOD
PRE_CLP=true
DESC_CLP=" using custom log PATH ($LOG_DIR_PATH)"
;;
# If no matching Functional argument is detected
*)
echo "!!NO PREVIOUS MATCHING MAIN ARGUMENT"
printf "Try \e[1m--help\e[0m or \e[1m-h\e[0m?\n"
exit 1
;;
esac
;;
# Ignore whitespace
"")
;;
# If no arguments are recogninzed at all
*)
echo "!!ARGUMENT NOT RECOGNISED!! (003)"
echo "!!ARGUMENT NOT RECOGNIZED!! (003)"
printf "Try \e[1m--help\e[0m or \e[1m-h\e[0m?\n"
echo $1
exit 1
Expand All @@ -996,12 +1007,6 @@ ActionFlag () {
ActionPrep () {
# Attempts to find the specific UNIX Distribution
case $(uname) in
"OpenBSD")
DISTRO_NAME="OpenBSD"
;;
"FreeBSD")
DISTRO_NAME="FreeBSD"
;;
# If uname returns 'Linux', attempt to filter out specific distro
"Linux")
if [ -f "/etc/os-release" ] ; then
Expand All @@ -1010,6 +1015,13 @@ ActionPrep () {
DISTRO_NAME="*Unknown*"
fi
;;
"OpenBSD")
DISTRO_NAME="OpenBSD"
;;
"FreeBSD")
DISTRO_NAME="FreeBSD"
;;

*)
DISTRO_NAME="*Unknown*"
;;
Expand Down Expand Up @@ -1252,8 +1264,8 @@ clear
# Starts counting time
TIMEBEGIN=$(date +%s)
# Save Version Number
FULL_VERSION_NUM="1.5.4 (August 17th 2023)"
SHORT_VERSION_NUM="1.5.4"
FULL_VERSION_NUM="1.5.5 (August 20th 2023)"
SHORT_VERSION_NUM="1.5.5"
# Sets up initial variables
RISKYOPERATION=false
ALLARGS=$@
Expand Down Expand Up @@ -1341,14 +1353,14 @@ ActionPrep
# Runs the checksum-checker
ChecksumCheck $TOOLUSE
if [ "$?" = "1" ] ; then
printf "Checksum-Checker FAILED! Investigate!!\n"
printf "!!Checksum-Checker FAILED!\n"
case $RISKYOPERATION in
"true")
printf "!!!Running despite Checksum-Checker FAILING!!!\n"
WarrantyMessage
;;
*)
printf "Check what is going on!\n"
printf "* Investigate what is going on!\n"
exit 1
;;
esac
Expand Down

0 comments on commit 320ea2f

Please sign in to comment.