-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_full-unix.sh
1293 lines (1247 loc) · 44.1 KB
/
update_full-unix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Written by Mikhail P. Ortiz-Lunyov (mportizlunyov)
#
# Version 2.1.2 (August 19th, 2024)
#
# This script is licensed under the GNU Public License Version 3 (GPLv3).
# Compatible and tested with BASH, SH, KSH, ASH, and DASH.
#
#
# Not compatible with ZSH, CSH, TCSH, or PowerShell.
# More information about license in README and bottom.
# 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.
# Critical variables
## Version variables
VERSION_NUMB="2.1.2"
VERSION_NAME="August 19th 2024"
VERSION_NAME_FULL="v$VERSION_NUMB ($VERSION_NAME)"
echo "$VERSION_NAME_FULL" > $(pwd)/tempfile_VERSION
## Installation folder variable
INSTALLATION_FOLDER_UNIX="$(dirname $(readlink -f $0))"
RELATED_DIRECTORY=$INSTALLATION_FOLDER_UNIX
## Dependencies
DEPENDENCY_LIST="ping curl wget"
CHECKSUM_CHECKER_PATH="00_CHECKSUM_CHECKER.sh"
## Package managers
## Names are appended to strings, since arrays are not POSIX compliant
### Official
OFFICIAL_PKG_MAN="apt yum"
OFFICIAL_PLG_MAN="$OFFICIAL_PKG_MAN transactional-update"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN dnf rpm-ostree"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN pacman apk"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN zypper pacman"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN xbps swupd"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN slackpkg eopkg"
OFFICIAL_PKG_MAN="$OFFICIAL_PKG_MAN pkg pkg_add"
### Alternative
ALTERNATIVE_PKG_MAN="$ALTERNATIVE_PKG_MAN flatpak snap"
ALTERNATIVE_PKG_MAN="$ALTERNATIVE_PKG_MAN brew portsnap"
ALTERNATIVE_PKG_MAN="$ALTERNATIVE_PKG_MAN rubygem yarn"
ALTERNATIVE_PKG_MAN="$ALTERNATIVE_PKG_MAN pipx npm"
### Ambiguous
AMBIGUOUS_PKG_MAN="$AMBIGUOUS_PKG_MAN nix guix"
### Split string
IFS=" "
### Informational flag exit
INFORMATIONAL_EXIT=false
# Prints Exit Statement
ExitStatement () {
printf "\t* I hope this program was useful for you!\n\n"
printf "\t\e[3m* Please give this project a star on github!\e[0m\n"
}
# Deals with errors in an organized fashion
AllErrorsMethod () {
# Initialise error code
ERROR_CODE=1
# Deal with value of $1
case "$1" in
# Missing dependencies
"0")
echo "!!Dependency for Checksum-Checker NOT FOUND!!"
echo "!!Missing: $2"
;;
# Curl failed, even with --insecure
"1")
echo "!!CURL with --insecure flag failed!"
echo "!!Check connection to internet"
;;
# Raw Curl failed, refused --insecure flag
"2")
echo "!!Understood, QUITting"
echo "!!Please diagnose Curl not working"
ERROR_CODE=2
;;
# Wget failed
"3")
echo "!!WGET failed!"
echo "!!Check connection to internet"
;;
# Checksum-Checker script Failed
"4")
echo "!!Checksum-Checker script FAILED!"
echo "!!Investigate the script's checksums"
;;
# Official package manager NOT found
"5")
echo "!!OFFICIAL package manager NOT Found"
echo "!!Please check package manager compatibility"
;;
# Alternative package manager NOT found, forced --alt-only
"6")
echo "!!ALTERNATIVE package manager NOT found with --alt-only"
echo "!!Please check package manager compatibility"
;;
"7"|"8"|"10")
echo "!!Argument [ $2 ] NOT RECOGNISED"
printf "* Try \e[1m--help\e[0m or \e[1m-h\e[0m?\n"
;;
"9")
echo "!!Modifier [ $3 ] does not match argument [ $2 ]"
printf "* Try \e[1m--help\e[0m or \e[1m-h\e[0m?\n"
;;
# Missing Root
"11")
# Specific reason
case "$2" in
"MISSING_TOOL") printf "\t\e[3;5m!!Neither sudo nor doas detected!\e[0m\n" ;;
"NO_PERMS") printf "\t\e[3;5m!!User $(whoami) has no root privileges!\e[0m\n" ;;
esac
echo "!!Root missing, check user permissions"
printf "\n\tUpdate_Full is intended for SysAdmins to fully (or partially)\n\tupdate different systems.\n"
;;
# ChecksumCheck method failed
"12")
echo "* Investigate what is going in!"
;;
# Missing error code
*) ERROR_CODE=44 ;; # Reference to HTTP error 404
esac
# Run exit statements
ExitStatement
# Return number
echo $ERROR_CODE
}
# Verifies existance of programs
ExistanceCheck () {
# Execute program, hiding output
$1 $2 > /dev/null 2>&1
return $?
}
# Checks for CURL/WGET dependency
DependencyTest () {
for i in $DEPENDENCY_LIST ; do
case "$(ExistanceCheck "$i" "--help" ; echo "$?")" in
"127")
echo "$i missing"
case "$i" in
"ping"|"wget") AllErrorsMethod "0" $i ; exit $? ;;
esac
;;
*)
echo "* $i found, resuming"
case "$i" in
"curl"|"wget") TOOLUSE=$i ; break ;;
esac
;;
esac
done
}
# Extracts the Checksum-Checker and runs it
ChecksumCheck () {
# Declare local variables
local CURL_INSECURE=false
# Decide which tools to use to extract the Checksum-checker
case $1 in
"curl")
# By default, attempt to use secure CURL requests
$ROOTUSE curl --silent --remote-name https://raw.githubusercontent.com/mportizlunyov/uf-CHECKSUM_STORAGE/main/Update_Full-UNIX/$CHECKSUM_CHECKER_PATH || {
# If it fails, ask to use --insecure option of not
while [ "$LOOP_INPUT" = "true" ] ; do
printf "!!CURL did not work, try again with --insecure option?\n!RISKY, check what is going on!\n\n[Y]es/[N]o"
read INSECURE_OPTION
case $INSECURE_OPTION in
"Y"|"y"|"Yes"|"yes")
LOOP_INPUT=false
printf "* Understood, retrying with --insecure option"
CURL_INSECURE=true
$ROOTUSE curl --remote-name --insecure https://raw.githubusercontent.com/mportizlunyov/uf-CHECKSUM_STORAGE/main/Update_Full-UNIX/$CHECKSUM_CHECKER_PATH || {
# If CURL fails again, QUIT
AllErrorsMethod "1"
exit $?
}
;;
"N"|"n"|"No"|"no")
LOOP_INPUT=false
printf "!!Understood, quitting. Please diagnose the problem!!\n"
AllErrorsMethod "2"
exit $?
;;
*) printf "Please select one of the two options. Otherwise, quit and re-leanch the script.\n\n" ;;
esac
done
}
;;
"wget")
$ROOTUSE wget --quiet https://raw.githubusercontent.com/mportizlunyov/uf-CHECKSUM_STORAGE/main/Update_Full-UNIX/$CHECKSUM_CHECKER_PATH || {
AllErrorsMethod "3"
exit $?
}
;;
*)
printf "\t!!! INTERNAL PROGRAM ERROR !!!\n"
echo "Tool is [ $1 ]"
exit 1
;;
esac
$ROOTUSE $SHELL ./$CHECKSUM_CHECKER_PATH $VERSION_NUMB $TOOLUSE $CURL_INSECURE $RELATED_DIRECTORY
if [ "$?" = "1" ] ; then
echo "Checksum-Checker FAILED! Investigate!!"
case "$RISKYOPERATION" in
"true")
echo "!!!Running despite Checksum-Checker FAILING!!!"
WarrantyMessage
;;
*)
printf "Check what is going on!\n"
$ROOTUSE rm ./$CHECKSUM_CHECKER_PATH
AllErrorsMethod "4"
exit $?
;;
esac
fi
$ROOTUSE rm ./$CHECKSUM_CHECKER_PATH
}
# Tests internet connectivity using PING
NetworkTest () {
ping -q -c 3 $1 || {
# Define error message based on domain
case "$1" in
"raw.githubusercontent.com")
printf "\e[1;1m\e[1;40m--\e[1;31mx\e[1;0m\e[1;1m\e[1;40m-->\e[1;0m "
echo "!!No Connection to checksum repository, diagnose the problem and relaunch script."
;;
*)
echo "* Performing network connectivity test using ($PING_TARGET):"
echo "=-=-=-=-="
printf "\e[1;1m\e[1;40m--\e[1;31mx\e[1;0m\e[1;1m\e[1;40m-->\e[1;0m "
echo "!!No Connection to CUSTOM URL, diagnose the problem and relaunch script in event of failure."
;;
esac
EXIT1=true
}
}
# For Debian/Ubuntu-based operating systems
AptUpdate () {
APTFLAG=true
printf "\n\t* \e[1mAPT detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE apt-get update
$ROOTUSE apt-get $APT_UPGRADE $MANQ
$ROOTUSE apt-get -f install $MANQ
$ROOTUSE apt-get autoremove $MANQ
$ROOTUSE apt-get autoclean $MANQ
}
# For Red-Hat based Linux Operating Systems
RedHatUpdate (){
printf "\n\t* \e[1mRED HAT ($1) detected under $DISTRO_NAME!\e[0m\n"
case $1 in
# For YUM (legacy)
"YUM")
YUMFLAG=true
$ROOTUSE yum check-update $MANQ
$ROOTUSE yum update $MANQ
$ROOTUSE yum autoremove $MANQ
;;
# For DNF (modern)
"DNF")
DNFFLAG=true
$ROOTUSE dnf check-update $MANQ
$ROOTUSE dnf update $MANQ
$ROOTUSE dnf autoremove $MANQ_DEB1
;;
# For RPM-OSTREE (found in Fedora SilverBlue, Kinoite, and CoreOS)
"RPM-OSTREE")
OSTREEFLAG=true
rpm-ostree cancel
rpm-ostree upgrade --check
rpm-ostree upgrade
;;
esac
}
# For Slackware Linux-based operating systems
SlackpkgUpdate () {
if [ "$MANUAL_ALL" != "true" ] ; then
MANQ="-batch=on -default_answer=y"
fi
SLACKFLAG=true
printf "\n\t* \e[1mSLACKWARE detected!\e[0m\n"
$ROOTUSE slackpkg $MANQ update
$ROOTUSE slackpkg $MANQ install-new
$ROOTUSE slackpkg $MANQ upgrade-all
$ROOTUSE slackpkg $MANQ clean-system
}
# For Solus Linux-based operating systems
EopkgUpdate () {
EOPKGFLAG=true
printf "\n\t* \e[1mSOLUS detected!\e[0m\n"
$ROOTUSE eopkg update-repo
$ROOTUSE eopkg upgrade $MANQ
}
# For Flatpaks
FlatpakUpdate () {
FLATPAKFLAG=true
printf "\n\t* \e[1mFLATPAK detected under $DISTRO_NAME!\e[0m\n"
flatpak update $MANQ
flatpak uninstall --unused $MANQ
}
# For Snaps
SnapUpdate () {
SNAPFLAG=true
printf "\n\t* \e[1mSNAP detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE snap refresh
}
# For Clear Linux
SwupdUpdate () {
SWUPDFLAG=true
printf "\n\t* \e[1mCLEAR LINUX detected!\e[0m\n"
echo "By default, Clear Linux automatically updates its packages. You may need to disable auto-update."
$ROOTUSE swupd check-update $MANQ
$ROOTUSE swupd update $MANQ
}
# For Alpine Linux
ApkUpdate () {
APKFLAG=true
printf "\n\t* \e[1mALPINE LINUX detected!\e[0m\n"
$ROOTUSE apk update
$ROOTUSE apk upgrade
$ROOTUSE apk fix
}
# For Arch Linux
PacmanUpdate () {
PACMANFLAG=true
printf "\n\t* \e[1mPACMAN detected under $DISTRO_NAME!\e[0m\n"
case "$MANUAL_ALL" in
"false") yes | $ROOTUSE pacman -Syu ;;
"true") $ROOTUSE pacman -Syu ;;
esac
}
# For OpenSUSE Linux
OpenSuseUpdate () {
printf "\n\t* \e[1mOpenSUSE ($1) detected under $DISTRO_NAME!\e[0m\n"
case $1 in
# For OpenSUSE Tumbleweed and LEAP
"ZYPPER")
ZYPPERFLAG=true
$ROOTUSE zypper list-updates
$ROOTUSE zypper patch-check
$ROOTUSE zypper $SUSE_UPGRADE $MANQ
$ROOTUSE zypper patch $MANQ
$ROOTUSE zypper purge-kernels
;;
# For MicroOS
"TRANSACTIONAL-UPDATE")
TRANUPDATEFLAG=true
$ROOTUSE transactional-update $SUSE_UPGRADE
$ROOTUSE transactional-update patch
;;
esac
}
# For Nix OS Linux
NixUpdate () {
NIXFLAG=true
printf "\n\t* \e[1mNIX PACKAGE MANAGER detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE nix-channel --update
$ROOTUSE nix-env -u '*'
$ROOTUSE nix-env --delete-generations old
$ROOTUSE nix-collect-garbage
}
# For FreeBSD-based operating systems
PkgUpdate () {
PKGFLAG=true
printf "\n\t* \e[1mFREEBSD detected!\e[0m\n"
$ROOTUSE pkg update
$ROOTUSE pkg upgrade $MANQ
$ROOTUSE pkg autoremove $MANQ
$ROOTUSE pkg clean
$ROOTUSE pkg audit -F
}
# For OpenBSD
Pkg_addUpdate () {
PKG_ADDFLAG=true
printf "\n\t* \e[1mOPENBSD detected!\e[0m\n"
$ROOTUSE pkg_add -Uuvm
$ROOTUSE syspatch
}
# For Portsnaps
PortsnapUpdate () {
PORTSNAPFLAG=true
printf "\n\t* \e[1mPORTSNAP detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE portsnap auto
}
# For Homebrew
BrewUpdate () {
BREWFLAG=true
printf "\n\t* \e[1mHOMEBREW detected under $DISTRO_NAME!!\e[0m\n"
$ROOTUSE brew update
$ROOTUSE brew upgrade -v
$ROOTUSE brew cleanup -v
}
# For Void Linux
XbpsUpdate () {
XBPSFLAG=true
printf "\n\t* \e[1mVOID LINUX detected!\e[0m\n"
$ROOTUSE xbps-install -u xbps
$ROOTUSE xbps-install -Su
}
# For RubyGems
GemUpdate () {
GEMFLAG=true
printf "\n\t* \e[1mRUBYGEM detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE gem update
$ROOTUSE gem cleanup
}
# For Node.Js Package Manager
NpmUpdate () {
NPMFLAG=true
printf "\n\t* \e[1mNODE.JS PACKAGE MANAGER detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE npm update
}
# For Yarn Package Manager
YarnUpdate () {
YARNFLAG=true
printf "\n\t* \e[1mYARN detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE yarn upgrade
$ROOTUSE yarn install
}
# For Pip and subsequent Versions
PipxUpdate () {
PIPxFLAG=true
printf "\n\t* \e[1mPIPx detected under $DISTRO_NAME!\e[0m\n"
# Will Make version for pip3 and pip2 (for legacy support), Pipx for now
pipx upgrade-all
}
# For Guix Package Manager
GuixUpdate() {
GUIXFLAG=true
printf "\n\t* \e[1mGuix detected under $DISTRO_NAME!\e[0m\n"
$ROOTUSE guix pull
$ROOTUSE guix upgrade
}
# Check official package managers
CheckOfficialPkgMan () {
# Iterate through OFFICIAL_PKG_MAN array
for i in $OFFICIAL_PKG_MAN ; do
ExistanceCheck "$i" "--help"
case "$?" in
"127") ;; # Skip package manager
*)
case "$i" in
"apt") AptUpdate ; return ;;
"yum")
case "$YUM_UPDATE" in
"false") echo "GOT IT!" ; continue ;;
"true") RedHatUpdate "YUM" ; return ;;
esac
;;
"transactional-update") OpenSuseUpdate "TRANSACTIONAL-UPDATE" ; return ;;
"dnf") RedHatUpdate "DNF" ; return ;;
"rpm-ostree") RedHatUpdate "RPM_OSTREE" ; return ;;
"pacman") PacmanUpdate ; return ;;
"apk") ApkUpdate ; return ;;
"zypper") OpenSuseUpdate "ZYPPER" ; return ;;
"pacman") PacmanUpdate ; return ;;
"xbps") XbpsUpdate ; return ;;
"swupd") SwupdUpdate ; return ;;
"slackpkg") SlackpkgUpdate ; return ;;
"eopkg") EopkgUpdate ; return ;;
"pkg") PkgUpdate ; return ;;
"pkg_add") Pkg_addUpdate ; return ;;
esac
;;
esac
done
# Alternative Exit
AllErrorsMethod "5"
exit $?
}
# Check alternative package managers
CheckAlternativePkgMan () {
# Initialise local method variable
local PKG_RAN=false
for i in $ALTERNATIVE_PKG_MAN ; do
ExistanceCheck "$i" "--help"
case "$?" in
"127") ;; # Skip package manager
*)
case "$i" in
"flatpak") FlatpakUpdate ; PKG_RAN=true ;;
"snap") SnapUpdate ; PKG_RAN=true ;;
"brew") BrewUpdate ; PKG_RAN=true ;;
"portsnap") PortsnapUpdate ; PKG_RAN=true ;;
"rubygem") GemUpdate ; PKG_RAN=true ;;
"yarn") YarnUpdate ; PKG_RAN=true ;;
"pipx") PipxUpdate ; PKG_RAN=true ;;
"npm") NpmUpdate ; PKG_RAN=true ;;
esac
;;
esac
done
# If no alternative package managers are run,
# and the --alt-only flag is run, exit in an error
if [ "$PKG_MAN" = "false" ] && [ "$ALTONLY" = "true" ] ; then
AllErrorsMethod "6"
exit $?
fi
}
# Prints a Help message
HelpMessage () {
echo ' = = ='
echo 'This bash script allows for a full update on most UNIX systems, on most package managers.'
# Explain two types of arguments for script
printf "This script uses three types of arguments: \e[1mFunctional (changes how the script works)\e[0m, \e[1mModifiers (modifies aspects of a functional argument)\e[0m, and \e[1mDescriptive (gives information about the script)\e[0m.\n"
# Begin Functional arguments
printf "\nFunctional arguments:\n"
printf "\e[1m--override-checksum / -oc\e[0m\t Overrides any warning of mis-matching latest checksums\n"
printf "\t!!! Dangerous, could mean OUTDATED or otherwise MODIFIED script (INTENTIONALLY or MALICIOUSLY) !!!\n"
printf "\e[1m--custom-domain / -cd\e[0m\t Use a custom domain (manual input by default)\n"
printf "\t^Modifier available\n"
printf "\e[1m--yum-update / -yu\e[0m\t Use YUM instead of DNF on Red-Hat\n"
printf "\t*Not compatible with \e[1m-ao\e[0m\n"
printf "\e[1m--official-only / -oo\e[0m\t Skip alternative package managers\n"
printf "\t*Not compatible with \e[1m-ao\e[0m\n"
printf "\e[1m--alt-only / -ao\e[0m\t Skip native package managers\n"
printf "\t*Not compatible with \e[1m-oo\e[0m\n"
printf "\e[1m--custom-log-path / -clp\e[0m\t Define a custom PATH for the log-file\n"
printf "\t*Must be run with \e[1m-ss\e[0m\n"
printf "\t^Modifier available\n"
printf "\e[1m--manual-all / -ma\e[0m\t Leaves package manager prompts unanswered, and asks for custom domain and log file PATH is not preloaded\n"
printf "\t*Will make script unable to be run in a cronjob\n"
printf "\e[1m--save-statistics / -ss\e[0m\t Save a log file (and add comments!)\n"
printf "\t^Modifier available\n"
# Begin Modifiers
printf "\nModifiers:\n"
printf "\e[1m:<DOMAIN>\e[0m\t\t Preload custom domain for \e[1m-cd\e[0m\n"
printf "\e[1m:no-comment / :nc\e[0m\t Skip commenting for \e[1m-ss\e[0m\n"
printf "\e[1m:<LOG FILE PATH>\e[0m\t Defines custom PATH for log-file for \e[1m-clp\e[0m\n"
# Begin Descriptive arguments
printf "\nDescriptive arguments:\n"
printf "\e[1m--help / -h \t\e[0m\t Print Help statement\n"
printf "\e[1m--conditions / -c\e[0m\t Print Conditions of redistribution\n"
printf "\e[1m--warrenty / -w \e[0m\t Print Warranty\n"
printf "\e[1m--privacy-policy / -pp\e[0m\t Print Privacy Policy\n"
# Begin Security Advisories
printf "\n\nTo prevent tempering, change the PERMISSIONS."
printf "\nThis can easily be done by launching the \e[1muf-first-setup.sh\e[0m script that comes in the repository."
printf "\nIf you do not end up using it DELETE IT. Otherwise, it will delete itself after first usage."
printf "\n\nAdditionally, verify the script using the checksums found at /~https://github.com/mportizlunyov/uf-CHECKSUM_STORAGE\n\n"
INFORMATIONAL_EXIT=true
}
# Prints the conditions under which the GPLv3 license allows the program to be redistributed
ConditionMessage () {
echo ' = = ='
echo 'If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this'
echo 'License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to'
echo 'satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence'
echo 'you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further'
echo 'conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this'
echo 'License would be to refrain entirely from conveying the Program.'
INFORMATIONAL_EXIT=true
}
# Prints the warranty under which GPLv3 covers the script
WarrantyMessage () {
echo ' = = ='
echo 'THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.'
echo 'EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES'
echo 'PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR'
echo 'IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND'
echo 'FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE'
echo 'OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE'
echo 'COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.'
INFORMATIONAL_EXIT=true
}
# Prints the privacy policy
PrivacyPolicyMessage () {
echo ' = = ='
echo 'THIS PROGRAM DOES NOT COLLECT ANY TELEMETRY OR USER DATA.'
echo 'THE ONLY TIME IN WHICH THIS PROGRAM CONNECTS TO THE INTERNET IS DURING'
echo 'THE PING TEST (IN ORDER TO VERIFY CONNECTION TO THE INTERNET, CAN BE DISABLED)'
echo 'AND WHILE UPDATING PACKAGES THROUGH THEIR RESPECTIVE PACKAGE MANAGERS.'
echo 'THE ONLY TIME THAT THIS SCRIPT ACCESSES THE USERS FILE SYSTEM IS WHEN MAKING'
echo 'LOG FILES (WITH EXPRESS CONSENT FROM THE USER) AND WHEN CALLING UPON THE'
echo 'VARIOUS PACKAGE MANAGERS THAT THE SCRIPT SUPPORTS TO UPDATE THEIR PACKAGES.'
echo 'THIS SCRIPT CAN ONLY CONTROL THE PACKAGE MANAGERS THROUGH THE'
echo 'CONTROLS THEY PROVIDE TO THEIR USERS.'
echo 'ALL OF THESE STATEMENTS CAN BE VERIFIED, AS THIS SOFTWARE IS FREE & OPEN-SOURCE,'
echo 'THUS MEANING THAT ANYBODY CAN READ THE SOURCE CODE AND VERIFY WHAT IT DOES.'
INFORMATIONAL_EXIT=true
}
# This function sets up the commenting function in the SaveStats function
SaveStatsComments () {
case $NOCOMMENT in
"true") $ROOTUSE $SHELL -c '( echo "!= = NO COMMENTS = =!" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)' ;;
*)
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" ) >> $(pwd)/tempfile_COMMENTS
printf "* \e[0mTYPE:\e[1m "
read COMMENTINPUT
done
printf "= = =\n\e[0m"
case $tempfileISSUEFLAG in
"true")
LOGCOMMENTS="!!tempfile PREMATURELY DELETED, USER COMMENTS NOT SAVED!!"
( echo "$LOGCOMMENTS" ) > $(pwd)/tempfile_COMMENTS
;;
*)
LOGCOMMENTS="$(sed '1d' $(pwd)/tempfile_COMMENTS)"
( echo "$LOGCOMMENTS" ) > $(pwd)/tempfile_COMMENTS
if [ "$LOGCOMMENTS" = "" ] ; then
LOGCOMMENTS="* No comments by user*"
( echo "$LOGCOMMENTS" ) > $(pwd)/tempfile_COMMENTS
fi
;;
esac
$ROOTUSE $SHELL -c '( echo "User-Generated Comments: = =" && echo "$(cat $(pwd)/tempfile_COMMENTS)" && echo "= = = = = = = = = =" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
$ROOTUSE rm $(pwd)/tempfile_COMMENTS > /dev/null 2>&1
;;
esac
}
# This function records and sets up the package managers used by the script for the save-statistics argument.
SaveStatsPkgLog () {
# Begins to prepare adding the used package managers in log
OFFICIALPKGMAN="No official package managers used"
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
ALTPKGMAN="No alternative package managers used"
( echo "$ALTPKGMAN" ) > $(pwd)/tempfile_ALTPKG
STATUSFLATPAK="NOT USED"
( echo "$STATUSFLATPAK" ) > $(pwd)/tempfile_FLATPAK
STATUSSNAP="NOT USED"
( echo "$STATUSSNAP" ) > $(pwd)/tempfile_SNAP
STATUSPORTSNAP="NOT USED"
( echo "$STATUSPORTSNAP" ) > $(pwd)/tempfile_PORTSNAP
STATUSBREW="NOT USED"
( echo "$STATUSBREW" ) > $(pwd)/tempfile_BREW
STATUSGEM="NOT USED"
( echo "$STATUSGEM" ) > $(pwd)/tempfile_GEM
STATUSYARN="NOT USED"
( echo "$STATUSYARN" ) > $(pwd)/tempfile_YARN
STATUSNPM="NOT USED"
( echo "$STATUSNPM" ) > $(pwd)/tempfile_NPM
STATUSPIPx="NOT USED"
( echo "$STATUSPIPx" ) > $(pwd)/tempfile_PIPx
# For official Package Managers
if [ "$APTFLAG" = true ] ; then
OFFICIALPKGMAN="APT package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$PACMANFLAG" = true ] ; then
OFFICIALPKGMAN="PACMAN package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$DNFFLAG" = true ] ; then
OFFICIALPKGMAN="DNF package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$YUMFLAG" = true ] ; then
OFFICIALPKGMAN="YUM package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$SWUPDFLAG" = true ] ; then
OFFICIALPKGMAN="SWUPD package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$APKFLAG" = true ] ; then
OFFICIALPKGMAN="APK package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$GUIXFLAG" = true ] ; then
OFFICIALPKGMAN="GUIX package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$ZYPPERFLAG" = true ] ; then
OFFICIALPKGMAN="ZYPPER package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$NIXFLAG" = true ] ; then
OFFICIALPKGMAN="NIX package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$PKGFLAG" = true ] ; then
OFFICIALPKGMAN="PKG package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$PKG_ADDFLAG" = true ] ; then
OFFICIALPKGMAN="PKG_ADD package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$XBPSFLAG" = true ] ; then
OFFICIALPKGMAN="XBPS package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$SLACKFLAG" = true ] ; then
OFFICIALPKGMAN="Slackware package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$EOPKGFLAG" = true ] ; then
OFFICIALPKGMAN="Eopkg package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$OSTREEFLAG" = true ] ; then
OFFICIALPKGMAN="RPM-Ostree package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
elif [ "$TRANUPDATEFLAG" = true ] ; then
OFFICIALPKGMAN="Transactional-Update package manager used."
( echo "$OFFICIALPKGMAN" ) > $(pwd)/tempfile_OFFICIALPKG
fi
# Changes variable ALTPKGMAN as nessesary
if [ "$FLATPAKFLAG" = true -o "$SNAPFLAG" = true -o "$PORTSNAPFLAG" = true -o "$BREWFLAG" = true -o "$GEMFLAG" = true -o "$YARNFLAG" = true -o "$NPMFLAG" = true -o "$PIPxFLAG" = true ] ; then
ALTPKGMAN="Alternative package managers used"
( echo "$ALTPKGMAN" ) > $(pwd)/tempfile_ALTPKG
fi
# For alternative package managers
if [ "$FLATPAKFLAG" = true ] ; then
STATUSFLATPAK="USED"
( echo "$STATUSFLATPAK" ) > $(pwd)/tempfile_FLATPAK
FLATPAKFLAG=false
fi
if [ "$SNAPFLAG" = true ] ; then
STATUSSNAP="USED"
( echo "$STATUSSNAP" ) > $(pwd)/tempfile_SNAP
FLATPAKFLAG=false
fi
if [ "$PORTSNAPFLAG" = true ] ; then
STATUSPORTSNAPSNAP="USED"
( echo "$STATUSPORTSNAP" ) > $(pwd)/tempfile_PORTSNAP
PORTSNAPFLAG=false
fi
if [ "$BREWFLAG" = true ] ; then
STATUSBREW="USED"
( echo "$STATUSBREW" ) > $(pwd)/tempfile_BREW
BREWFLAG=false
fi
if [ "$GEMFLAG" = true ] ; then
STATUSGEM="USED"
( echo "$STATUSGEM" ) > $(pwd)/tempfile_GEM
GEMFLAG=false
fi
if [ "$YARNFLAG" = true ] ; then
STATUSYARN="USED"
( echo "$STATUSYARN" ) > $(pwd)/tempfile_YARN
YARNFLAG=false
fi
if [ "$NPMFLAG" = true ] ; then
STATUSNPM="USED"
( echo "$STATUSNPM" ) > $(pwd)/tempfile_NPM
NPMFLAG=false
fi
if [ "$PIPxFLAG" = true ] ; then
STATUSPIPx="USED"
( echo "$STATUSPIPx" ) > $(pwd)/tempfile_PIPx
PIPxFLAG=false
fi
# Changes logfile depending on if
if [ "$OFFICIALPKGMAN" = "No official package managers used" -a "$ALTPKGMAN" = "No alternative package managers used" ] ; then
$ROOTUSE $SHELL -c '( echo "No package managers at all detected!" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
else
$ROOTUSE $SHELL -c '( echo "$(cat $(pwd)/tempfile_OFFICIALPKG)" && printf "$(cat $(pwd)/tempfile_ALTPKG)\n FLATPAK: $(cat $(pwd)/tempfile_FLATPAK)\n SNAP: $(cat $(pwd)/tempfile_SNAP)\n PORTSNAP: $(cat $(pwd)/tempfile_PORTSNAP)\n BREW: $(cat $(pwd)/tempfile_BREW)\n GEM: $(cat $(pwd)/tempfile_GEM)\n NPM: $(cat $(pwd)/tempfile_NPM)\n PIPx: $(cat $(pwd)/tempfile_PIPx)\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
# Removes unneeded tempfiles
$ROOTUSE rm $(pwd)/tempfile_OFFICIALPKG > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_ALTPKG > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_FLATPAK > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_SNAP > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_PORTSNAP > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_BREW > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_GEM > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_YARN > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_NPM > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_PIPx > /dev/null 2>&1
fi
}
# This function sets up the Save Statistics action
SaveStats () {
if [ "$LOG_DIR_PATH" != "" ] ; then
LOGFILEPATH="$LOG_DIR_PATH"
else
#LOGFILEPATH="$($ROOTUSE find $(pwd) -type d -name "update_full-unix")"
LOGFILEPATH="$(pwd)"
fi
#LOG_FILE="$LOGFILEPATH/uf-unix-log.txt"
( echo "$LOGFILEPATH/uf-unix-log.txt" ) > $(pwd)/tempfile_LOGFILEPATH
# Checks if save-stat is enabled
if [ "$SAVECONFIRM" = true ] ; then
# Ends counting time
TIMEEND=$(date +%s)
TIMETOTAL=$(( $TIMEEND - $TIMEBEGIN ))
( echo "$TIMETOTAL" ) > $(pwd)/tempfile_TIME
# If ping scan fails
if [ "$SAVESTATSNOPING" = "true" ] ; then
DESCNOPING="Ping test failed, check domain ($PING_TARGET)"
( echo "$DESCNOPING" ) > $(pwd)/tempfile_DESCNOPING
$ROOTUSE $SHELL -c '( echo "--- Failed Operation ---\\" && printf "Generated $(date)\nTime took: $(cat $(pwd)/tempfile_TIME) sec.\n\n$(cat tempfile_DESCNOPING))\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
SaveStatsComments
$ROOTUSE $SHELL -c '( printf "$(cat $(pwd)/tempfile_VERSION)\n--- Exit 1 ---/\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
# Remove leftover tempfiles
$ROOTUSE rm $(pwd)/tempfile_DESCNOPING > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_TIME > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_LOGFILEPATH > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_VERSION > /dev/null 2>&1
# Ending phrase
printf "* Log Saved...\nAll done!\n"
ExitStatement
exit 1
# If two or more incompatible functional arguments are detected
elif [ "$SAVESTATINCOMPARGS" = "true" ] ; then
DESCINCOPARGS="Incompatible arguments detected($INCOMPARGS_DETAIL)"
( echo "$DESCINCOPARGS" ) > $(pwd)/tempfile_DESCINCOPARGS
$ROOTUSE $SHELL -c '( echo "--- Failed Operation ---\\" && printf "Generated $(date)\nTime took: $(cat $(pwd)/tempfile_TIME) sec.\n\n$(cat $(pwd)/tempfile_DESCINCOPARGS)\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
SaveStatsComments
$ROOTUSE $SHELL -c '( printf "$(cat $(pwd)/tempfile_VERSION)\n--- Exit 1 ---/\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
# Remove leftover tempfiles
$ROOTUSE rm $(pwd)/tempfile_DESCINCOPARGS > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_TIME > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_LOGFILEPATH > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_VERSION > /dev/null 2>&1
# Ending phrase
printf "* Log Saved...\nAll done!\n"
ExitStatement
exit 1
else
#SaveStatsPkgLog
$ROOTUSE $SHELL -c '( echo "--- Successful Operation ---\\" && printf "Generated $(date)\nTime took: $(cat $(pwd)/tempfile_TIME) sec.\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
SaveStatsPkgLog
SaveStatsComments
$ROOTUSE $SHELL -c '( printf "$(cat $(pwd)/tempfile_VERSION)\n--- Exit 0 ---/\n\n" ) >> $(cat $(pwd)/tempfile_LOGFILEPATH)'
# Remove leftover tempfiles
$ROOTUSE rm $(pwd)/tempfile_TIME > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_LOGFILEPATH > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_VERSION > /dev/null 2>&1
# Ending phrase
printf "* Log Saved...\nAll done!\n"
ExitStatement
exit 0
fi
else
# Remove leftover tempfiles
$ROOTUSE rm $(pwd)/tempfile_TIME > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_LOGFILEPATH > /dev/null 2>&1
$ROOTUSE rm $(pwd)/tempfile_VERSION > /dev/null 2>&1
echo "* All done!"
ExitStatement
exit 0
fi
}
# Action Flag Function
ActionFlag () {
# Functional arguments
case $1 in
"-"* | "--"*)
MAIN_ARG=$1
# Strip initial dashes -- or -
case $MAIN_ARG in
"--"*"") MAIN_ARG=$(echo "$MAIN_ARG" | cut -c "3-") ;;
"-"*"") MAIN_ARG=$(echo "$MAIN_ARG" | cut -c "2-") ;;
esac
# Read actual arguments
case $MAIN_ARG in
# Functional Arguments
"save-statistics"|"ss")
DESC_SS=" and saving in log"
SAVECONFIRM=true
;;
"custom-domain"|"cd")
DESC_CD=" using custom domain"
CUSTOM_DOMAIN=true
;;
"manual-all"|"ma")
DESC_MA=" using manual setting"
MANUAL_ALL=true
;;
"official-only"|"oo")
DESC_OO=" using only official package managers"
OFFICIALONLY=true
;;
"yum-update"|"yu")
DESC_YU=" using YUM over DNF"
YUM_UPDATE=true
;;
"alt-only"|"ao")
DESC_AO=" using only alternative package managers"
ALTONLY=true
;;
"custom-log-path"|"clp")
DESC_CLP=" using custom log PATH"
CUSTOMLOGPATH=true
;;
"override-checksum"|"oc")
RISKYOPERATION=true
;;
*) AllErrorsMethod "7" "$1" ; exit $? ;;
esac
;;
# Modifiers
":"*)
ARG_MOD="$(echo "$1" | cut -c "2-")"
case $MAIN_ARG in
# Modifiers for --save-statistics
"save-statistics" | "ss")
case $ARG_MOD in
"no-comment" | "nc")
NOCOMMENT=true
DESC_SS=" and saving in log(no comments)"
;;
*) AllErrorsMethod "8" "$1" ; exit $? ;;
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
*) AllErrorsMethod "9" "$1" "$ARG_MOD" ; exit $? ;;
esac
;;
# Ignore whitespace
"") ;;
# If no arguments are recogninzed at all
*) AllErrorsMethod "10" "$1" ; exit $? ;;
esac
}
# Preperation Function
ActionPrep () {
# Attempts to find the specific UNIX Distribution
case "$(uname)" in
# If uname returns 'Linux', attempt to filter out specific distro
"Linux")
if [ -f "/etc/os-release" ] ; then
DISTRO_NAME="$(cat /etc/os-release | grep "PRETTY_NAME=" | cut -c 13-)"
else
DISTRO_NAME="*Unknown Linux*"
fi
;;
"OpenBSD") DISTRO_NAME="OpenBSD" ;;
"FreeBSD") DISTRO_NAME="FreeBSD" ;;
*) DISTRO_NAME="*Unknown*" ;;
esac
# Functional argument ERRORS
# Error if all arguments are attempted
if [ "$SAVECONFIRM" = "true" ] && [ "$CUSTOM_DOMAIN" = "true" ] && [ "$MANUAL_ALL" = "true" ] && [ "$OFFICIALONLY" = "true" ] && [ "$YUM_UPDATE" = "true" ] && [ "$ALTONLY" = "true" ] ; then
echo "!!All Possible Arguments attempted! Not all functional variables are compatible with one-another!"
echo "!!Invalid argument combination (likely -ao/--alt-only and -dam/--disable-alt-managers). Relaunch script with valid combination."
if [ "$SAVECONFIRM" = "true" ] ; then
SAVESTATINCOMPARGS=true
INCOMPARGS_DETAIL="Likely all possible arguments attempted."
SaveStats
else
exit 1
fi
fi
# Error for mixed -ao/--alternate-only and -dam/--disable-alt-managers
if [ "$OFFICIALONLY" = "true" ] && [ "$ALTONLY" = "true" ] ; then
echo "!!Invalid argument combination (likely -ao/--alt-only and -dam/--disable-alt-managers). Relaunch script with valid combination."
if [ "$SAVECONFIRM" = "true" ] ; then
SAVESTATINCOMPARGS=true
INCOMPARGS_DETAIL="Likely -dam / --disable-alt-managers and -ao / --alt-only mixed."
SaveStats
else
exit 1
fi
fi
# Error for mixed -yu/--yum-update and -ao/--alt-only
if [ "$YUM_UPDATE" = "true" ] && [ "$ALTONLY" = "true" ] ; then
echo "!!Invalid argument combination (likely -ao/--alt-only and -yu/--yum-update). Relaunch script with valid combination."
if [ "$SAVECONFIRM" = "true" ] ; then
SAVESTATINCOMPARGS=true
INCOMPARGS_DETAIL="Likely -yu / --yum-update and -ao / --alt-only mixed."
SaveStats
else
exit 1
fi
fi
# Error for mixed -ss/--save-statistics and -clp/--custom-log-path
if [ "$SAVECONFIRM" = "false" ] && [ "$CUSTOMLOGPATH" = "true" ] ; then
echo "!!Missing partner argument (likely --save-statistics / -ss). Relaunch script with valid combination."
if [ "$SAVECONFIRM" = "true" ] ; then
SAVESTATINCOMPARGS=true