-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path050.start-private-browser.bash
More file actions
2470 lines (2295 loc) · 118 KB
/
Copy path050.start-private-browser.bash
File metadata and controls
2470 lines (2295 loc) · 118 KB
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
#!/usr/bin/env bash
#
# _____ _____ ____
# / ____| __ \| _ \
# | (___ | |__) | |_) |
# \___ \| ___/| _ <
# ____) | | | |_) |
# |_____/|_| |____/
# START PRIVATE BROWSER
#
# Start many instances of Brave (or another browser) at the same time.
#
# All isolated browser instances started with SPB,
# may run within the same graphical login instance simultantiusly.
#
# Easily run multiple isolated instances of a browser with different
# startup options, settings, proxies, seperated cookies and more...
#
# This script has built in support for many web browsers. SPB also allows
# starting of unsupported browsers. Uuse the '--help' option or see
# the home page (listed below) for additional usage information.
#
# (C) Copyright Henri Shustak 2024
#
# Released under the GNU GPLv3 or later license :
# https://www.gnu.org/licenses/gpl-3.0.en.html
#
# Project home page (featuring additional information and easy installation guide) :
# https://github.com/henri/spb
#
# version 01.0 - initial release
# version 01.1 - added a check to make sure brave is installed before doing anything
# version 01.2 - added a basic help menu explaining the functionality (if you call it with -h or --help)
# version 01.3 - added basic support for FreeBSD and MacOS
# version 01.4 - added support for listing the running sessions (just list them via screen - nothing internal keeping track)
# version 01.5 - initial support for passing additional options to brave implemented (note : zero checking of option validity)
# version 01.6 - updates to the help output
# version 01.7 - added url to download brave if it is not installed
# version 01.8 - added user-agent usage example
# version 01.9 - added additional sanity check
# version 02.0 - additional requirement check that screen is installed before doing anything
# version 02.1 - bug fix related to screen detection
# version 02.2 - minor improvement when listing active sessions
# version 02.3 - added additional usage notes
# version 02.4 - added improved support for displaying help
# version 02.5 - improved option parsing system
# version 02.6 - initial foundations for templating sub-system implemented
# version 02.7 - improved option parsing to allow for greater flexibility
# version 02.8 - increased verbosity of output while loading template data
# version 02.9 - added locking to the templates and squashed bugs
# version 03.0 - added standard option to not start incognito mode
# version 03.1 - added a quiet mode option for less verbose output
# version 03.2 - prevent copying a template while it is being edited
# version 03.3 - improved template lock file session support, improved template support and squashed bugs
# version 03.4 - reporting and error handling relating to lock files improved
# version 03.5 - further improvements to template lock file subsystem reliability and user support dialog
# version 03.6 - cross platform compatibility enhancement
# version 03.7 - added a force stop command (to kill an spb session)
# version 03.8 - foundation laid for the template system to support browser compatibility
# version 03.9 - further improvements to multi-browser support within the templating system
# version 04.0 - added update option support
# version 04.1 - minor improvements to output relating to updates
# version 04.2 - bug fixes
# version 04.3 - altered configuration defaults working towards improved browser compatibility
# version 04.4 - prepared multi-browser compatibility foundations
# version 04.5 - initial templating compatibility checks implemented
# version 04.6 - improved template listing output in relation to multi-browser improvements
# version 04.7 - bug fixes relating to older versions of bash
# version 04.8 - improvements to mutli-browser compatibility
# version 04.9 - initial environment variable support for spb browser configuration
# version 05.0 - initial spb configuration file support - only via sourcing
# version 05.1 - bug fixes relating to loading order of configuration file
# version 05.2 - improved template listing output and bug fixes relating to multi-browser support
# version 05.2 - improvements with regards support for cross-platform multi-browser support
# version 05.3 - updates to the built in help
# version 05.4 - bug fixes
# version 05.5 - added ability to list available browsers in multi-mode with option --list-browsers
# version 05.6 - improved multi-browser support
# version 05.7 - bug fix related to loading templates
# version 05.8 - improved logic paths during edge cases of browser template laoding
# version 05.9 - implemented detection for shells without connected display enviroment(s)
# version 06.0 - experimental support for ungoogled-chrome, firefox and palemoon
# version 06.1 - improved template loading, additional linux distribution support (this needs some work)
# version 06.2 - improved argument parsing and bug fixes
# version 06.3 - bug fix relating to experimental firefox and palemoon support
# version 06.4 - added template copy progress bar using gcp if it is installed on the system
# version 06.5 - added template copy progress bar using pv and tar if they are available on the system and gcp is not available
# version 06.6 - bug fix resolved relating to du options on macOS and also added APFS template cloning support (it is faster)
# version 06.7 - bug fix we now correctly report when we are copying or cloning template data
# version 06.8 - standard mode reporting improvements
# version 06.9 - added support for custom spb-template path override via the option --template-path
# version 07.0 - experimental support for opera
# version 07.1 - initial support for verbose option currently providing reporting of the path to to user data for session
# version 07.2 - bug fix relating to following template symlinks when using the --list-templates option
# version 07.3 - added option to overide the default /tmp/ directory used for storing temporary browser data via spb.config file
# version 07.4 - very experimental support for zen browser
# version 07.5 - updates to the help
# version 07.6 - enabled post-browser script launching subsystem
# version 07.7 - exerimental support for omarchy
# version 07.8 - added --browser-path option to allow the path to be set via the CLI rather than just via an envioment variable
# version 07.9 - improved --list-browser option output to check if a browser is installed on the system
# version 08.0 - slightly improved help message when listing templates with the --list-templates option
# version 08.1 - added experimental support for cachyos
# version 08.2 - added option to allow for editing of the active spb configuration file using the --edit-configuration option
# version 08.3 - improved template listing display for browsers with longer names (specifically chromium)
# version 08.4 - improved verbose output when listing templates to include template directory with --list-templates --verbose options
# version 08.5 - improved verbose output when listing sessions with the --list --verbose options
# version 08.6 - various improvements to output formatting and error messages providing more information.
# version 08.7 - added edge case for browser installed tick mark on macOS (bug fix) when using --list-browsers option
# version 08.8 - improved error output when editing a template which has not yet to been created
# version 08.9 - experimental support for pop!_os introduced
# version 09.0 - experimental support for librewolf introduced
# version 09.1 - added ability to disable filesystem syncs
# version 09.2 - requesting to edit the SPB configuration file will automatically setup the template directory if not present
# version 09.3 - improved quiet output for listing installed browsers
# version 09.4 - implimented --about option which will start an SPB web session showing information about the SPB project
# version 09.5 - updates for FireFox launching (removed -class falg)
# version 09.6 - spb_edit_template_standard_mode added for automatic standard mode when editing a template and resolved mispelling of --quiet
# version 09.7 - added --configuration-variables parameter to show a list of the possible spb enviroment variables
# version 09.8 - updated to provide realpath display for configuration file when when using --verbose option
# version 09.9 - added enviroment varibles further supporting auto standard mode : spb_template_standard_mode and template_standard_mode
# version 10.0 - improved output formating of enviroment variable listing and of those currently configured
# version 10.1 - experimental support for waterfox and helium added
# version 10.2 - added ability to use --browser and --browser-path cli arguments to override enviroment variables / configuration file
# version 10.3 - allowed spb_temp_data_path enviroment varable to be configured not only within configuration file
# version 10.4 - imporved support for fedora
# version 10.5 - initial support for suplamentary browser options to be provided via 'spb_browser_options" envirment varable
# version 10.6 - experimental support for mallvad browser added - templating is broken for mallvad
# version 10.7 - bug fixes for correctly exporting enviroment variable spb_browser_name when spb.config is run with cli argument --browser
# version 10.8 - standard input support added and modifiable with enviroment variable spb_read_from_stdin
# version 10.9 - bug fixes related to standrd input support
# version 11.0 - added hook enviroment variable to allow script or comands to be run prior launching the browser 'spb_hook_pre_browser_cmd'
# version 11.1 - added experimental enviroment varable which is availble to hook scripts 'spb_browser_data_directory'
# version 11.2 - added experimental support for athena os
##
## configuration of variables
##
# configuration variables
screen_session_prefix="spb-session" # prefix of the screen session name
temp_dir_name_prefix="spb-browser" # prefix for spb temporary instance data storage
template_dir_base="~/bin/spb-templates" # location of spb templates and configuration parent path
template_browser_id_filename="spb-browser.id" # file which will contain the browser identifier for this template
update_script_path="~/bin/spb-update.bash" # where to find the spb-update script
update_script_arguments="--auto-monitoring" # arguments passed to update script when running an update
spb_configuration_file_name="spb.config" # default config file name
# //////////////////////////////////
# enviroment option override allowed
# //////////////////////////////////
# configuration of variables with overide #
if [ -z "${spb_temp_data_path}" ] ; then #
spb_temp_data_path="/tmp" # temporary data storage path
fi #
if [ -z "${spb_read_from_stdin}" ] ; then #
spb_read_from_stdin="true" # spb to read data from standard input (piped intput)
fi #
if [ -z "${spb_hook_pre_browser_cmd}" ] ; then #
spb_hook_pre_browser_cmd="" # executed brefore the browser is launched
fi #
# lock file variables to protect templates being edited
spb_template_lock_file_name="spb-template-edit.lock"
spb_etlfr_cmd="" # spb edit template lock file remove command (leave this blank it is automatically updated when required)
# post browser launch subsystem variables
post_browser_cmd="" # executed once the browser has been launched (leave this blank it is automatically updated when required)
# setup variables for processing arguments we ares specifically NOT using get opts
args=("$@")
index=0
pre_index=0
super_pre_index=0
num_args=$#
skip_arg="false"
pre_skip_arg="false"
super_pre_skip_arg="false"
pre_arg_scan_proceed="true"
read_from_stdin="true"
standard_input_data=""
dot_dot_dot=""
template_in_use_via_cli_flag="false"
standard_mode_via_variable_flag="false"
standard_mode_via_cli_flag="false"
standard_mode_via_variable_text=""
tempalte_via_cli_flag="false"
new_tempalte_via_cli_flag="false"
edit_tempalte_via_cli_flag="false"
template_dir_base_default_override=""
spb_default_multi_browser_support="false"
spb_browser_path_externally_configured="false"
enviroment_varibales_true_or_false_pass="true"
spb_cli_browser_option_occurance_count=0
spb_cli_browser_path_option_occurance_count=0
spb_config_file_spb_browser_name_set="false"
spb_config_file_spb_browser_path_set="false"
spb_browser_path_backup=""
spb_browser_name_backup=""
# super pre argument varables (initial setup)
#
# related to output verbosity
verbose_mode="false" # when set to true additional information reported to standard out
quiet_mode="false" # when set to true less information is reported to standard out
export spb_verbose_mode="${verbose_mode}"
export spb_quiet_mode="${quiet_mode}"
# os detection
os_type=$(uname -s | tr '[:upper:]' '[:lower:]')
# default multi-browser support enabled - if we are running bash version 4 or later
if [[ ! -z ${BASH_VERSINFO} ]] ; then
if [[ ${BASH_VERSINFO} -ge 4 ]] ; then
# default browser values - these are the commands which we run on various operating systems for various browsers
# remember if your operating system is not listed, it is possible to use environment variables or the configuration
# file to specify the browser name and browser path for any browser / operating system pair
declare -A spb_default_browser_data
# # # # # # # # # # # # #
spb_default_browser_data["zen:linux:mint"]="zen"
spb_default_browser_data["zen:linux:arch"]="zen"
spb_default_browser_data["zen:linux:athenaos"]="zen"
spb_default_browser_data["zen:linux:omarchy"]="zen"
spb_default_browser_data["zen:linux:ubuntu"]="zen"
spb_default_browser_data["zen:linux:debian"]="zen"
spb_default_browser_data["zen:linux:endeavouros"]="zen"
spb_default_browser_data["zen:linux:manjaro"]="zen"
spb_default_browser_data["zen:linux:centos"]="zen"
spb_default_browser_data["zen:linux:fedora"]="zen"
spb_default_browser_data["zen:linux:cachyos"]="zen"
spb_default_browser_data["zen:linux:pop"]="zen"
spb_default_browser_data["zen:freebsd"]="zen"
spb_default_browser_data["zen:darwin"]="/Applications/Zen.app/Contents/MacOS/zen"
# # # # # # # # # # # # #
spb_default_browser_data["helium:linux:mint"]="helium"
spb_default_browser_data["helium:linux:arch"]="helium"
spb_default_browser_data["helium:linux:athenaos"]="helium"
spb_default_browser_data["helium:linux:omarchy"]="helium"
spb_default_browser_data["helium:linux:ubuntu"]="helium"
spb_default_browser_data["helium:linux:debian"]="helium"
spb_default_browser_data["helium:linux:endeavouros"]="helium"
spb_default_browser_data["helium:linux:manjaro"]="helium"
spb_default_browser_data["helium:linux:centos"]="helium"
spb_default_browser_data["helium:linux:fedora"]="helium"
spb_default_browser_data["helium:linux:cachyos"]="helium"
spb_default_browser_data["helium:linux:pop"]="helium"
spb_default_browser_data["helium:freebsd"]="helium"
spb_default_browser_data["helium:darwin"]="/Applications/Helium.app/Contents/MacOS/Helium"
# # # # # # # # # # # # #
spb_default_browser_data["waterfox:linux:mint"]="waterfox"
spb_default_browser_data["waterfox:linux:arch"]="waterfox"
spb_default_browser_data["waterfox:linux:athenaos"]="waterfox"
spb_default_browser_data["waterfox:linux:omarchy"]="waterfox"
spb_default_browser_data["waterfox:linux:ubuntu"]="waterfox"
spb_default_browser_data["waterfox:linux:debian"]="waterfox"
spb_default_browser_data["waterfox:linux:endeavouros"]="waterfox"
spb_default_browser_data["waterfox:linux:manjaro"]="waterfox"
spb_default_browser_data["waterfox:linux:centos"]="waterfox"
spb_default_browser_data["waterfox:linux:fedora"]="waterfox"
spb_default_browser_data["waterfox:linux:cachyos"]="waterfox"
spb_default_browser_data["waterfox:linux:pop"]="waterfox"
spb_default_browser_data["waterfox:freebsd"]="waterfox"
spb_default_browser_data["waterfox:darwin"]="/Applications/Waterfox.app/Contents/MacOS/waterfox"
# # # # # # # # # # # # #
spb_default_browser_data["opera:linux:mint"]="opera"
spb_default_browser_data["opera:linux:arch"]="opera"
spb_default_browser_data["opera:linux:athenaos"]="opera"
spb_default_browser_data["opera:linux:omarchy"]="opera"
spb_default_browser_data["opera:linux:ubuntu"]="opera"
spb_default_browser_data["opera:linux:debian"]="opera"
spb_default_browser_data["opera:linux:endeavouros"]="opera"
spb_default_browser_data["opera:linux:manjaro"]="opera"
spb_default_browser_data["opera:linux:centos"]="opera"
spb_default_browser_data["opera:linux:fedora"]="opera"
spb_default_browser_data["opera:linux:cachyos"]="opera"
spb_default_browser_data["opera:linux:pop"]="opera"
spb_default_browser_data["opera:freebsd"]="opera"
spb_default_browser_data["opera:darwin"]="/Applications/Opera.app/Contents/MacOS/Opera"
# # # # # # # # # # # # #
spb_default_browser_data["librewolf:linux:mint"]="librewolf"
spb_default_browser_data["librewolf:linux:arch"]="librewolf"
spb_default_browser_data["librewolf:linux:athenaos"]="librewolf"
spb_default_browser_data["librewolf:linux:omarchy"]="librewolf"
spb_default_browser_data["librewolf:linux:ubuntu"]="librewolf"
spb_default_browser_data["librewolf:linux:debian"]="librewolf"
spb_default_browser_data["librewolf:linux:endeavouros"]="librewolf"
spb_default_browser_data["librewolf:linux:manjaro"]="librewolf"
spb_default_browser_data["librewolf:linux:centos"]="librewolf"
spb_default_browser_data["librewolf:linux:fedora"]="librewolf"
spb_default_browser_data["librewolf:linux:cachyos"]="librewolf"
spb_default_browser_data["librewolf:linux:pop"]="librewolf"
spb_default_browser_data["librewolf:freebsd"]="librewolf"
spb_default_browser_data["librewolf:darwin"]="/Applications/LibreWolf.app/Contents/MacOS/librewolf"
# # # # # # # # # # # # #
spb_default_browser_data["palemoon:linux:mint"]="palemoon"
spb_default_browser_data["palemoon:linux:arch"]="palemoon"
spb_default_browser_data["palemoon:linux:athenaos"]="palemoon"
spb_default_browser_data["palemoon:linux:omarchy"]="palemoon"
spb_default_browser_data["palemoon:linux:ubuntu"]="palemoon"
spb_default_browser_data["palemoon:linux:debian"]="palemoon"
spb_default_browser_data["palemoon:linux:endeavouros"]="palemoon"
spb_default_browser_data["palemoon:linux:manjaro"]="palemoon"
spb_default_browser_data["palemoon:linux:centos"]="palemoon"
spb_default_browser_data["palemoon:linux:fedora"]="palemoon"
spb_default_browser_data["palemoon:linux:cachyos"]="palemoon"
spb_default_browser_data["palemoon:linux:pop"]="palemoon"
spb_default_browser_data["palemoon:freebsd"]="palemoon"
spb_default_browser_data["palemoon:darwin"]="/Applications/Pale Moon.app/Contents/MacOS/palemoon"
# # # # # # # # # # # # #
spb_default_browser_data["firefox:linux:mint"]="firefox"
spb_default_browser_data["firefox:linux:arch"]="firefox"
spb_default_browser_data["firefox:linux:athenaos"]="firefox"
spb_default_browser_data["firefox:linux:omarchy"]="firefox"
spb_default_browser_data["firefox:linux:ubuntu"]="firefox"
spb_default_browser_data["firefox:linux:debian"]="firefox"
spb_default_browser_data["firefox:linux:endeavouros"]="firefox"
spb_default_browser_data["firefox:linux:manjaro"]="firefox"
spb_default_browser_data["firefox:linux:centos"]="firefox"
spb_default_browser_data["firefox:linux:fedora"]="firefox"
spb_default_browser_data["firefox:linux:cachyos"]="firefox"
spb_default_browser_data["firefox:linux:pop"]="firefox"
spb_default_browser_data["firefox:freebsd"]="firefox"
spb_default_browser_data["firefox:darwin"]="/Applications/Firefox.app/Contents/MacOS/Firefox"
# # # # # # # # # # # # #
spb_default_browser_data["ungoogled-chromium:linux:mint"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:ubuntu"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:debian"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:arch"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:omarchy"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:endeavouros"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:linux:manjaro"]="ungoogled-chrome"
spb_default_browser_data["ungoogled-chromium:linux:centos"]="ungoogled-chrome"
spb_default_browser_data["ungoogled-chromium:linux:fedora"]="ungoogled-chrome"
spb_default_browser_data["ungoogled-chromium:linux:cachyos"]="ungoogled-chrome"
spb_default_browser_data["ungoogled-chromium:linux:pop"]="ungoogled-chrome"
spb_default_browser_data["ungoogled-chromium:freebsd"]="ungoogled-chromium"
spb_default_browser_data["ungoogled-chromium:darwin"]="/Applications/Chromium.app/Contents/MacOS/Chromium"
# # # # # # # # # # # # #
spb_default_browser_data["vivaldi:linux:mint"]="vivaldi"
spb_default_browser_data["vivaldi:linux:ubuntu"]="vivaldi"
spb_default_browser_data["vivaldi:linux:debian"]="vivaldi"
spb_default_browser_data["vivaldi:linux:arch"]="vivaldi"
spb_default_browser_data["vivaldi:linux:athenaos"]="vivaldi"
spb_default_browser_data["vivaldi:linux:omarchy"]="vivaldi"
spb_default_browser_data["vivaldi:linux:endeavouros"]="vivaldi"
spb_default_browser_data["vivaldi:linux:manjaro"]="vivaldi"
spb_default_browser_data["vivaldi:linux:centos"]="vivaldi"
spb_default_browser_data["vivaldi:linux:fedora"]="vivaldi"
spb_default_browser_data["vivaldi:linux:cachyos"]="vivaldi"
spb_default_browser_data["vivaldi:linux:pop"]="vivaldi"
spb_default_browser_data["vivaldi:freebsd"]="vivaldi"
spb_default_browser_data["vivaldi:darwin"]="/Applications/Vivaldi.app/Contents/MacOS/Vivaldi"
# # # # # # # # # # # # #
spb_default_browser_data["brave:linux:mint"]="brave-browser"
spb_default_browser_data["brave:linux:ubuntu"]="brave-browser"
spb_default_browser_data["brave:linux:debian"]="brave-browser"
spb_default_browser_data["brave:linux:arch"]="brave"
spb_default_browser_data["brave:linux:athenaos"]="brave"
spb_default_browser_data["brave:linux:omarchy"]="brave"
spb_default_browser_data["brave:linux:endeavouros"]="brave"
spb_default_browser_data["brave:linux:manjaro"]="brave"
spb_default_browser_data["brave:linux:centos"]="brave-browser"
spb_default_browser_data["brave:linux:fedora"]="brave-browser"
spb_default_browser_data["brave:linux:cachyos"]="brave"
spb_default_browser_data["brave:linux:pop"]="brave-browser"
spb_default_browser_data["brave:freebsd"]="brave-browser"
spb_default_browser_data["brave:darwin"]="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
# # # # # # # # # # # # #
spb_default_browser_data["chromium:linux:mint"]="chromium"
spb_default_browser_data["chromium:linux:ubuntu"]="chromium"
spb_default_browser_data["chromium:linux:debian"]="chromium"
spb_default_browser_data["chromium:linux:arch"]="chromium"
spb_default_browser_data["chromium:linux:athenaos"]="chromium"
spb_default_browser_data["chromium:linux:omarchy"]="chromium"
spb_default_browser_data["chromium:linux:endeavouros"]="chromium"
spb_default_browser_data["chromium:linux:manjaro"]="chromium"
spb_default_browser_data["chromium:linux:centos"]="chromium"
spb_default_browser_data["chromium:linux:fedora"]="chromium"
spb_default_browser_data["chromium:linux:cachyos"]="chromium"
spb_default_browser_data["chromium:linux:pop"]="chromium"
spb_default_browser_data["chromium:freebsd"]="chromium"
spb_default_browser_data["chromium:darwin"]="/Applications/Chromium.app/Contents/MacOS/Chromium"
# # # # # # # # # # # # #
spb_default_browser_data["mullvad:linux:mint"]="mullvad-browser"
spb_default_browser_data["mullvad:linux:arch"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:athenaos"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:omarchy"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:ubuntu"]="mullvad-browser"
spb_default_browser_data["mullvad:linux:debian"]="mullvad-browser"
spb_default_browser_data["mullvad:linux:endeavouros"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:manjaro"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:centos"]="mullvad-browser" #untested
spb_default_browser_data["mullvad:linux:fedora"]="mullvad-browser"
spb_default_browser_data["mullvad:linux:cachyos"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:linux:pop"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:freebsd"]="mullvad-browser" # untested
spb_default_browser_data["mullvad:darwin"]="/Applications/Mullvad Browser.app/Contents/MacOS/mullvadbrowser" # untested
# # # # # # # # # # # # #
spb_default_multi_browser_support="true"
# # # # # # # # # # # # #
fi
fi
# keep an eye on the browser_path being configured externally
if [[ ! -z "$spb_browser_path" ]] ; then
export spb_browser_path_externally_configured="true"
fi
# super-pre argument scanning (special arguments for overiding settings and configuring varables correctly) - yes we custom argument parsing in 2025
for arg in "$@" ; do
# skip some parameters passed into script
if [[ "${super_pre_skip_arg}" == "true" ]] ; then
super_pre_skip_arg="false"
((super_pre_index++))
continue
fi
# skip some parameters passed into script
if [[ "${super_pre_skip_arg}" == "true" ]] ; then
super_pre_skip_arg="false"
((super_pre_index++))
continue
fi
# look ahead for passed argument parameters
if (( super_pre_index + 1 < num_args )) ; then
next_arg="${args[super_pre_index + 1]}"
else
next_arg=""
fi
if [[ "${arg}" == "--standard" ]] ; then
standard_mode_via_cli_flag="true"
fi
# check if we are editing template (pre super check)
if [[ "${arg}" == "--edit-template" ]] ; then
# used for enviromental varable processing
template_in_use_via_cli_flag="true"
edit_tempalte_via_cli_flag="true"
if [[ "${next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
valid_argument_found="true"
fi
fi
# check if we are creating new template (pre super check)
if [[ "${arg}" == "--new-template" ]] ; then
# used for enviromental varable processing
template_in_use_via_cli_flag="true"
new_tempalte_via_cli_flag="true"
if [[ "${next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
valid_argument_found="true"
fi
fi
# check if we are using an exiting template (pre super check)
if [[ "${arg}" == "--template" ]] ; then
# used for enviromental varable processing
template_in_use_via_cli_flag="true"
tempalte_via_cli_flag="true"
if [[ "${next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
valid_argument_found="true"
fi
fi
# check for template or template editing
if [[ "${arg}" == "--template-path" ]] ; then
# check they are not listed more than once
if [[ "${template_dir_base_default_override}" != "" ]] ; then
echo ""
echo "ERROR! : Using the ${arg} option is only allowed once"
echo ""
exit -75
fi
if [[ "${next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
valid_argument_found="true"
template_dir_base_default_override="${next_arg}"
template_dir_base="${template_dir_base_default_override}"
else
echo ""
echo "ERROR! : Using the ${arg} option requires specifying a valid spb-template path."
echo " the spb-template directrory path by default is set to the following : "
echo ""
echo " ${template_dir_base}"
echo ""
echo " The template directory contains all the other templates not a single"
echo " template."
exit -77
fi
fi
# check for edit configuration option
if [[ "${arg}" == "--edit-configuration" ]] ; then
edit_configuration_file_requested="true"
valid_argument_found="true"
fi
# check if quiet mode should be enabled
if [[ "${arg}" == "--quiet" ]] || [[ "${arg}" == "--quite" ]]; then
# there is a mis-spelt option also which will be allowed for legacy scripts
# which may exist using the incorrect spelling and also for recursive calls
quiet_mode="true"
export spb_quiet_mode="${quiet_mode}"
valid_argument_found="true"
fi
# check if verbose mode should be enabled
if [[ "${arg}" == "--verbose" ]] ; then
verbose_mode="true"
export spb_verbose_mode="${verbose_mode}"
valid_argument_found="true"
fi
# check to see if browser path specified as argument
if [[ "${arg}" == "--browser-path" ]] ; then
# check they are not listed more than once
((spb_cli_browser_path_option_occurance_count++))
if [[ "${spb_browser_path_externally_configured}" == "true" ]] ; then
if [[ ${spb_cli_browser_path_option_occurance_count} -gt 1 ]] ; then
echo ""
echo "ERROR! : Using the ${arg} option is only allowed once"
echo ""
echo " It is possible that browser_path has been"
echo " configured via an enviroment varable."
echo ""
exit -75
fi
fi
# look ahead for passed argument parameters
if (( super_pre_index + 1 < num_args )) ; then
super_pre_next_arg="${args[super_pre_index + 1]}"
else
super_pre_next_arg=""
fi
# okay lets see whats what
if [[ "${super_pre_next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
else
echo ""
echo "ERROR! : When you specify --browser-path you must also"
echo " supply a browser path which will be used"
echo " instead of the default browser path."
echo ""
exit -164
fi
# update the browser path and other variables which depend on the browser path
export spb_browser_path="${super_pre_next_arg}"
spb_browser_path_backup="${spb_browser_path}"
spb_browser_path_externally_configured="true"
fi
# check to see if browser mode should be enabled
if [[ "${arg}" == "--browser" ]] ; then
# check they are not listed more than once
((spb_cli_browser_option_occurance_count++))
if [[ "${spb_browser_name_externally_configured}" == "true" ]] && [[ ${spb_cli_browser_option_occurance_count} -gt 1 ]] ; then
echo ""
echo "ERROR! : Using the ${arg} option is only allowed once"
echo ""
echo " It is possible that browser_name has been"
echo " configured via an enviroment varable."
echo ""
exit -75
fi
# look ahead for passed argument parameters
if (( super_pre_index + 1 < num_args )) ; then
super_pre_next_arg="${args[super_pre_index + 1]}"
else
super_pre_next_arg=""
fi
if [[ "${spb_default_multi_browser_support}" == "false" ]] && [[ "${spb_browser_path_externally_configured}" == "false" ]] ; then
echo ""
echo "ERROR! : SPB multi-browser support is not available!"
echo ""
echo " This is due to you running an older version"
echo " of BASH on your system, please update to"
echo " latest version of BASH if you would like"
echo " to use the --browser option."
echo ""
echo " If you want to use an alternative browser"
echo " but do not want to upgrade your version"
echo " of BASH, then you may configure the alt"
echo " browser by setting environment variables."
echo " It is possible to set these in the SPB"
echo " configuration file or via your shell."
echo ""
echo " Finally, it is also possible to use the "
echo " --browser-path option to specify a path"
echo " for your browser."
echo ""
echo " For addiitonal help use the command : "
echo " ${0} --help"
echo ""
exit -165
fi
# okay lets see whats what
if [[ "${super_pre_next_arg}" != "" ]] ; then
# configure the system to skip the next argument for processing
# as it is the value for this one
super_pre_skip_arg="true"
else
echo ""
echo "ERROR! : When you specify --browser you must also"
echo " supply a browser name which will be used"
echo " instead of the default browser name."
echo ""
exit -164
fi
# update the browser name and other variables which depend on the browser name
export spb_browser_name="${super_pre_next_arg}"
spb_browser_name_backup="${spb_browser_name}"
spb_browser_name_externally_configured="true"
if [[ "${spb_browser_name_default}" != "${spb_browser_name}" ]] ; then
export spb_browser_is_default="false"
fi
template_dir_parent="${template_dir_base}/${spb_browser_name}"
fi
((super_pre_index++))
done
# configure the default SPB browser name
spb_browser_name_default="brave"
spb_browser_name_externally_configured="false"
spb_browser_is_default="true"
if [[ -z "$spb_browser_name" ]] ; then
# check this value has not been configured via configuration file / environment variables
if [[ "${os_type}" == "darwin" ]] ; then
if [[ "${spb_browser_name}" == "ungoogled-chromium" ]] && [[ -d /Applications/Chromium.app ]] ; then
# check if ungoogled-chromium is installed (on macOS) - the install will share the same location and name so this is somewhat important
chromium_developer=$(spctl -a -vvv -t install /Applications/Chromium.app 2>&1 | grep "origin=Developer ID Application" | awk -F "origin=Developer ID Application: " '{print $2}')
if [[ "${chromium_developer}" != "Qian Qian (B9A88FL5XJ)" ]] ; then
echo "ERROR! : You have requested the browser : ${spb_browser_name}"
echo " However, ungoogled-chromium is not installed on your system."
exit -34
fi
fi
if [[ "${spb_browser_name}" == "chromium" ]] && [[ -d /Applications/Chromium.app ]] ; then
# check if chromium is installed
chromium_developer=$(spctl -a -vvv -t install /Applications/Chromium.app 2>&1 | grep "origin=Developer ID Application" | awk -F "origin=Developer ID Application: " '{print $2}')
if [[ "${chromium_developer}" == "Qian Qian (B9A88FL5XJ)" ]] ; then
echo "WARNING! : You have requested the browser : ${spb_browser_name}"
echo " However, ungoogled-chromium is installed on your system."
fi
fi
fi
spb_browser_name="${spb_browser_name_default}"
else
# this value has been configured via configuration file / environment variable
spb_browser_name_externally_configured="true"
fi
if [[ "${spb_browser_name_default}" != "${spb_browser_name}" ]] ; then
# this variable is used to keep track of which variables need to have been set
# sanity checks in relation to templating subsystem
# it is important to ensure the template type
# matches the specified browser
spb_browser_is_default="false"
fi
spb_external_count=0
[[ ! -z "${spb_browser_path}" ]] && spb_external_count=$((spb_external_count+1))
[[ "${spb_browser_name_externally_configured}" == "true" ]] && spb_external_count=$((spb_external_count+1))
if [[ spb_external_count -eq 1 ]] ; then
if [[ "${spb_browser_name_externally_configured}" == "false" ]] || [[ "${spb_default_multi_browser_support}" == "false" ]] ; then
if [[ "${spb_browser_path_externally_configured}" == "false" ]] ; then
echo "" ; echo "ERROR! : Unable to proceed environment variable problem!" ; echo ""
if [[ "${spb_default_multi_browser_support}" == "true" ]] ; then
# multi-broser support enabled - report the situation relating to environment variables
echo " When the 'spb_browser_path' enviroment varable is configured,"
echo " the 'spb_browser_name' varable must also be set!"
else
# multi-browser support not enabled - explain one of these has been set but not both of them
echo " Automatic multi-browser support is unavailable due to the older version of BASH!"
echo " Upgrade BASH or when configure either of the following environment variables :"
echo ""
echo " spb_browser_name or spb_browser_path"
echo ""
echo " You must also configure the other. They either must both be set or alternatively"
echo " neither variable should be externally configured."
fi
echo ""
echo " This requirement is in relation to the template"
echo " system directory organization."
echo ""
exit -176
fi
fi
fi
# List of currently supported configuration file options
# set these as exported environment variables or place them
# in the configuration file and they will automatically be
# exported when this script runs and finds the configuration
# file. Configuration file path is within the variable :
# spb_configuration_file_name (above in this script)
#
# export spb_browser_name="brave"
# export spb_browser_path="brave-browser"
# export spb_temp_data_path="/tmp"
# export spb_filesystem_sync="true"
# export spb_read_from_stdin="true"
# export spb_hook_pre_browser_cmd=""
# export spb_browser_options=""
#
# export spb_template_standard_mode="false"
# export spb_new_template_standard_mode="false"
# export spb_edit_template_standard_mode="false"
#
#
function variable_check_true_or_false () {
local varable_name="${1}"
local varable_data="${2}"
if [[ "${varable_data}" != "true" ]] && [[ "${varable_data}" != "false" ]] ; then
# no valid value is configured so exit with error
echo ""
echo "ERROR! : Invalid option set for enviroment variable : ${varable_name}"
echo ""
echo ""
echo " Valid configurations options :"
echo ""
echo " export ${varable_name}=\"true\""
echo " export ${varable_name}=\"false\""
echo ""
enviroment_varibales_true_or_false_pass="false"
fi
}
function list_defaut_configuration_enviroment_variables() {
echo ""
if [[ "${quiet_mode}" == "false" ]] ; then
if [[ "${verbose_mode}" == "true" ]] ; then
echo "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
echo ""
fi
echo "Default SPB enviroment variables : "
echo ""
if [[ "${verbose_mode}" == "true" ]] ; then
echo "These variables may be set in your enviroment or within your spb.config file"
echo "Any enviroment variables set within your configuration file will override any"
echo "spb enviroment variables which may have been set."
echo ""
fi
fi
echo "#----------------------------------------------------"
grep "# export spb_" $0 | grep -v "grep" | sed '/spb_template_standard_mode/s/^/#----------------------------------------------------\n/'
echo "#----------------------------------------------------"
if [[ "${verbose_mode}" == "true" ]] ; then
echo ""
echo "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
fi
echo ""
if [[ "${verbose_mode}" == "true" ]] ; then
echo "Currenlty configured SPB enviroment variables :"
echo ""
echo "#----------------------------------------------------------"
echo "# spb_browser_name : ${spb_browser_name}" # set by SPB at runtime and is accessable from the config file
echo "# spb_browser_path : ${spb_browser_path}"
echo "# spb_temp_data_path : ${spb_temp_data_path}"
echo "# spb_filesystem_sync : ${spb_filesystem_sync}"
echo "# spb_read_from_stdin : ${spb_read_from_stdin}"
echo "# spb_browser_options : ${spb_browser_options}"
echo "# spb_hook_pre_browser_cmd : ${spb_hook_pre_browser_cmd}" # use this to run a script or command before loading browser
echo "#----------------------------------------------------------"
echo "# spb_template_standard_mode : ${spb_template_standard_mode}"
echo "# spb_new_template_standard_mode : ${spb_new_template_standard_mode}"
echo "# spb_edit_template_standard_mode : ${spb_edit_template_standard_mode}"
echo "#----------------------------------------------------------"
echo ""
echo "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
echo ""
echo "Run-time enviroment variables exported to spb.config :"
echo ""
echo "#----------------------------------------------------------"
echo "# spb_verbose_mode : ${spb_verbose_mode}"
echo "# spb_quiet_mode : ${spb_quiet_mode}"
echo "# spb_browser_is_default : ${spb_browser_is_default}"
echo "#----------------------------------------------------------"
echo ""
echo "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
echo ""
echo "Run-time enviroment variables exported to hook scripts :"
echo ""
echo "#----------------------------------------------------------"
echo "# spb_browser_data_directory"
echo "#----------------------------------------------------------"
echo ""
echo "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
echo ""
fi
sleep 0.001 ${spb_etlfr_cmd}
rm -rf ${browser_tmp_directory}
exit 0
}
# configure the configuration file paths
spb_configuration_file_path="${template_dir_base}/${spb_configuration_file_name}" # using the template directory to store the configuration file (TODO : needs to be altered to allow changing location of the template directory more easily)
spb_configuration_file_absolute="${spb_configuration_file_path/#\~/$HOME}" # expand the home tild if needed
# edit configuration file (--edit-configuration)
if [[ "${edit_configuration_file_requested}" == "true" ]] ; then
spb_configuration_file_parent_directory_absolute=$(dirname ${spb_configuration_file_absolute})
if ! [ -d ${spb_configuration_file_parent_directory_absolute} ] ; then
mkdir -p ${spb_configuration_file_parent_directory_absolute}
if [[ ${?} != 0 ]] ; then
echo "ERROR! : Unable to create the parent directory for the configuration file!"
exit -10
fi
echo "Generated SPB Template Directory : ${spb_configuration_file_parent_directory_absolute}"
fi
if [[ "${quiet_mode}" != "true" ]] ; then
echo "Editing SPB Configuration File : ${spb_configuration_file_absolute}"
fi
${VISUAL:-${EDITOR:-nano}} ${spb_configuration_file_absolute}
exit ${?}
fi
# configuration file loading
if [ -r ${spb_configuration_file_absolute} ] ; then
# lets start with sourcing, then we can move onto parsing
source ${spb_configuration_file_absolute}
# update internal spb variables (to match published varables) - not great but this is the current approach
read_from_stdin="${spb_read_from_stdin}"
# parse configuration file to see if browser_path has been set
if [[ $(grep -v '^\s*#' ${spb_configuration_file_absolute} | grep -E "^\s*(export\s+)?spb_browser_path=") != "" ]] ; then
spb_config_file_spb_browser_path_set="true"
spb_browser_path_externally_configured="true"
if [ ! -z "${spb_browser_path_backup}" ] ; then
if [[ "${quiet_mode}" != "true" ]] ; then
echo "Enviroment Varible Notice : spb_browser_path specififed within config file ignored"
if [[ "${verbose_mode}" == "true" ]] ; then
echo " Enviroment update is due to --browser-path being specified as a CLI argument"
fi
fi
spb_browser_path="${spb_browser_path_backup}"
fi
fi
# parse configuration file to see if browser_name has been set
if [[ $(grep -v '^\s*#' ${spb_configuration_file_absolute} | grep -E "^\s*(export\s+)?spb_browser_name=") != "" ]] ; then
spb_config_file_spb_browser_name_set="true"
spb_browser_name_externally_configured="true"
if [ ! -z "${spb_browser_name_backup}" ] ; then
if [[ "${quiet_mode}" != "true" ]] ; then
echo "Enviroment Varible Notice : spb_browser_name specififed within config file ignored"
if [[ "${verbose_mode}" == "true" ]] ; then
echo " Enviroment update is due to --browser being specified as a CLI argument"
fi
fi
spb_browser_name="${spb_browser_name_backup}"
fi
fi
fi
# update the template directory parent so that it is browser specific
template_dir_parent="${template_dir_base}/${spb_browser_name}"
# set the temp_path now we have sourced the configuration file
temp_path="${spb_temp_data_path%/}/${temp_dir_name_prefix}"
# set default values for options which are not defined within the configuration file
if [ -z "${spb_filesystem_sync}" ] ; then
spb_filesystem_sync="true"
else
variable_check_true_or_false spb_filesystem_sync ${spb_filesystem_sync}
fi
if [ -z "${spb_edit_template_standard_mode}" ] ; then
spb_edit_template_standard_mode="false"
else
variable_check_true_or_false spb_edit_template_standard_mode ${spb_edit_template_standard_mode}
fi
if [ -z "${spb_new_template_standard_mode}" ] ; then
spb_new_template_standard_mode="false"
else
variable_check_true_or_false spb_new_template_standard_mode ${spb_new_template_standard_mode}
fi
if [ -z "${spb_template_standard_mode}" ] ; then
spb_template_standard_mode="false"
else
variable_check_true_or_false spb_template_standard_mode ${spb_template_standard_mode}
fi
# configure standard_mode_via_variable_flag if requirted to true (based on enviroment variables)
if [[ "${edit_tempalte_via_cli_flag}" == "true" ]] && [[ "${spb_edit_template_standard_mode}" == "true" ]] ; then standard_mode_via_variable_flag="true" ; fi
if [[ "${new_tempalte_via_cli_flag}" == "true" ]] && [[ "${spb_new_template_standard_mode}" == "true" ]] ; then standard_mode_via_variable_flag="true" ; fi
if [[ "${tempalte_via_cli_flag}" == "true" ]] && [[ "${spb_template_standard_mode}" == "true" ]] ; then standard_mode_via_variable_flag="true" ; fi
# display help if issues with enviroment variable(s) detected
if [[ "${enviroment_varibales_true_or_false_pass}" == "false" ]] && [[ "${quiet_mode}" != "true" ]]; then
echo ""
echo " Display currently configured enviroment varables : "
echo ""
echo " start-private-browser --configuration-variables --verbose"
echo ""
echo ""
echo " Edit active SPB configuration file with prefered editor : "
echo ""
echo " start-private-browser --edit-configuration"
echo ""
echo ""
fi
# updated variables and the defaults
creating_new_template="false"
spb_list_templates="false"
spb_show_about="false"
spb_show_about_url="http://github.com/henri/spb/blob/main/README_INDEX.md"
new_template_dir_name=""
edit_template_dir_name=""
use_template_dir_name=""
use_template_dir_absolute=""
template_show_progress_bar="true" # even this is set to true, the size of the template must be exceed the value set in template template_size_to_show_progress_bar before the progress bar is shown
template_size_to_show_progress_bar="180" # mesured in MB (if the tempalte is greater than this size and gcp is installed, then a progress bar is displayed during the copy)
help_wanted="no"
config_variables_wanted="no"
update_wanted="no"
valid_argument_found="false"
standard_mode="false" # when set to true, we will not default to running incognito window
force_stop_mode="false"
edit_configuration_file_requested="false"
template_browser_id_absolute="" # when creating a new template this is set to the full absolute path to the template browser_id file
# check mark
tick_mark='\xE2\x9C\x94'
##
## Argument Processing
##
# pre argument scanning (arguments which will almost always end up exiting before we actually start a browser)
for arg in "$@" ; do
# skip some parameters passed into script
if [[ "${pre_skip_arg}" == "true" ]] ; then
pre_skip_arg="false"
((pre_index++))
continue
fi
# check for version
if [[ "${arg}" == "--version" ]] ; then
installed_version=$(grep -E "^# version " ~/bin/start-private-browser.bash | tail -n 1 | awk '{print $3}')
echo "SPB (start-private-browser) version : ${installed_version}"
exit
fi
# check for help wanted
if [[ "${arg}" == "-h" ]] || [[ "${arg}" == "--help" ]] ; then
help_wanted="yes"
valid_argument_found="true"