This repository was archived by the owner on Mar 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhistutilities
More file actions
executable file
·880 lines (855 loc) · 43.4 KB
/
histutilities
File metadata and controls
executable file
·880 lines (855 loc) · 43.4 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
#!/bin/bash
# Version: 1.7
set -euo pipefail
hi_exit() {
rm -rf "$TEMPPATH"
if [[ "$exit_flag" == "0" ]]; then
listoptions "Restart HLU?" "Yes|No"
if [[ "$select_ans" == "1" ]]; then exec "$hlu_path"; fi
elif [[ $exit_flag == "2" ]]; then
if [[ -w "$(dirname "$hlu_path")" ]]; then
cp "$HIPATH/hist-linux-utilities/histutilities" "$(dirname "$hlu_path")"
chmod +x "$(dirname "$hlu_path")/histutilities"
else
sudo cp "$HIPATH/hist-linux-utilities/histutilities" "$(dirname "$hlu_path")"
sudo chmod +x "$(dirname "$hlu_path")/histutilities"
fi
if [[ -d "$HIPATH/hist-linux-utilities" ]]; then rm -rf "$HIPATH/hist-linux-utilities"; fi
else echo -e "\n${rec}Exit${noc}\n"; fi
}
generalinput() {
if [[ "$1" == *'|'* ]]; then
gi_name="$(echo "$1" | cut -d'|' -f1)"
gi_options="$(echo "$1" | cut -d'|' -f2)"
else gi_name="$1"; gi_options="none"; fi
if [[ "$gi_name" == *' ___ '* ]]; then
gi_default="$(echo "$gi_name" | awk -F" ___ " '{print $2}')"
gi_name="$(echo "$gi_name" | awk -F" ___ " '{print $1}')"
else gi_default="none"; fi
gi_file="$HISTORYPATH/.$gi_name"
if [[ "$gi_options" == *"continue"* ]]; then gi_exit_string="/${grc}reset${noc}"; else gi_exit_string=""; fi
if [[ ! -f "$gi_file" ]]; then touch "$gi_file"; fi
history -r "$gi_file"
if [[ "$gi_default" == "none" ]]; then echo -e "\nEnter $2 (${cyc}q|Q${noc} for ${grc}exit${noc}$gi_exit_string):"
else echo -e "\nEnter $2 (Default: ${cyc}$gi_default${noc}) (${cyc}d|D${noc} for ${grc}default${noc}, ${cyc}q|Q${noc} for ${grc}exit${noc}$gi_exit_string):"; fi; read -re "input_ans"
input_ans=${input_ans//\\/}
if [[ "$input_ans" == [qQ] ]]; then
if [[ "$gi_options" == *"continue"* ]]; then input_ans="none"; else exit; fi
elif [[ "$input_ans" == [dD] && "${gi_default}" != "none" ]]; then input_ans="${gi_default}"
elif [[ "$input_ans" == "" ]]; then generalinput "$1" "$2"
else
sed -i "\#${input_ans}#d" "$gi_file"
echo "$input_ans" >> "$gi_file"; fi
history -c
}
readfiles() {
rf_count=0; unset file_names; unset file_dirs
if [[ "$1" == *'|'* ]]; then
file_title="$(echo "$1" | cut -d'|' -f1)"
file_sort="$(echo "$1" | cut -d'|' -f2)"
else file_title="$1"; file_sort="cat"; fi
if [[ -s "$2" ]]; then
echo -e "\n ${mac}$file_title${noc}\n"
while read -r line; do
if echo "$line" | grep -qo " | "; then
file_names[$rf_count]="$(echo "$line" | awk -F" [|] " '{print $1}')"
file_dirs[$rf_count]="$(echo "$line" | awk -F" [|] " '{print $2}')"
echo -e " ${cyc}$((rf_count+=1))${noc} - ${grc}${file_names[rf_count-1]}${noc} - ${blc}${file_dirs[rf_count-1]}${noc}"
else
file_dirs[$rf_count]="$line"
echo -e " ${cyc}$((rf_count+=1))${noc} - ${grc}${line}${noc}"; fi; done < <($file_sort "$2")
echo -e "\nChoose ${cyc}item${noc} from the ${grc}list${noc} above (${cyc}q|Q${noc} for ${grc}exit${noc}):"; read -r -e "select_ans"
if [[ "$select_ans" == [qQйЙ] ]]; then exit
elif [[ "$select_ans" == *[!0-9]* ]] || [[ "$select_ans" -gt "$((rf_count))" || "$select_ans" -lt "1" ]]; then readfiles "$1" "$2"
else
if [[ -n "${file_names[select_ans-1]:+x}" ]]; then read_result_name="${file_names[select_ans-1]}"; fi
read_result_dir="${file_dirs[select_ans-1]}"; fi
else echo -e "\n${grc}File${noc} is ${rec}empty${noc}"; exit; fi
}
addlines() {
add_text="${cyc}path${noc} to the ${grc}$1${noc} folder"
generalinput "$1" "$add_text"; line_path="$input_ans"
if [[ ! -d "$line_path" ]]; then mkdir -p "$line_path"; fi
echo -e "$line_path" >> "$2"
}
deletelines() {
readfiles "$1|sort" "$2"; line_path="$read_result_dir"
sed -i "\#${line_path}#d" "$2"
if [[ -d "$read_result_dir" ]]; then
if [[ "$3" == "force" ]]; then select_ans="1"
else listoptions "Delete folder from filesystem?" "Yes|No"; fi
if [[ "$select_ans" == "1" ]]; then rm -rf "$line_path"; fi; fi
if [[ ! -s "$2" ]]; then rm "$2"; fi
}
listoptions() {
if [[ "$1" == *'|'* ]]; then
list_title="$(echo "$1" | cut -d'|' -f1)"
list_settings="$(echo "$1" | cut -d'|' -f2)"
else list_title="$1"; list_settings="none"; fi
if [[ "$2" == *' ___ '* ]]; then
list_items="$(echo "$2" | awk -F" ___ " '{print $1}')"
list_values="$(echo "$2" | awk -F" ___ " '{print $2}')"
else list_items="$2"; list_values="none"; fi
if [[ -n "$list_items" ]]; then
IFS="|"; lo_count=0; sa_count=0
echo -e "\n ${mac}$list_title${noc}\n"
for item in $list_values; do
status_array[$sa_count]="$item"; ((sa_count+=1)); done
for option in $list_items; do
if [[ "$list_values" != "none" && -n "${!status_array[lo_count]:+nex}" ]]; then
if [[ "${!status_array[lo_count]}" != "on" ]]; then status_check=" - ${grc}ON${noc}${cyc} (${!status_array[lo_count]})${noc}"
else status_check=" - ${cyc}ON${noc}"; fi
elif [[ "$list_values" != "none" ]]; then
status_check=" - ${rec}OFF${noc}"; else status_check=""; fi
if [[ "$option" == "Reset Options" ]]; then status_check=""; fi
list_array[$lo_count]="$option"
echo -e " ${cyc}$((lo_count+=1))${noc}${status_check} - ${grc}$option${noc}"; done
IFS="$Def_IFS"
if [[ "$list_items" == "Yes|No" ]]; then echo -e "\nChoose ${cyc}Option${noc} from the list above:"
else echo -e "\nChoose ${cyc}Option${noc} from the list above (${cyc}q|Q${noc} for ${grc}exit${noc}):"; fi; read -r -e "select_ans"
if [[ "$select_ans" == [qQйЙ] && "$list_items" != "Yes|No" ]]; then
if [[ "$list_settings" == *"continue"* ]]; then list_result_name="none"; list_result_number="0"
elif [[ "$list_settings" == *"exit"* ]]; then exit_flag="1"; exit
else exit; fi
elif [[ "$select_ans" == *[!0-9]* ]] || [[ "$select_ans" -gt "$lo_count" || "$select_ans" -lt "1" ]]; then listoptions "$1" "$2"
else list_result_name="${list_array[select_ans-1]}"; list_result_number="$select_ans"; fi
else echo -e "\n${grc}List${noc} is ${mac}empty${noc}\n"; exit; fi
}
git-latest() {
git_count=0
for item in $(curl --silent "https://api.github.com/repos/$1/releases" | grep "$2" | grep '"name"' | cut -d'"' -f4); do
if (( $git_count < 10 )) ; then
git_names="${git_names:-}$(basename -s "$2" "$item")|"
let "git_count+=1"
else break; fi
done
for item in $(curl --silent "https://api.github.com/repos/$1/releases" | grep "$2" | grep '"browser_download_url"' | cut -d'"' -f4); do
git_urls+=("$item")
done
listoptions "Packages" "$git_names"
git_package=${git_urls[$list_result_number-1]}
}
runnerfinder() {
IFS="|"
for item in $1; do
if [[ -f "$item" ]]; then
while read -r line; do
if [[ -d "$line" || -f "$line" ]]; then
if [[ $(find "$line" -type f -name 'proton_dist*') ]]; then
proton_tar=$(find "$line" -type f -name 'proton_dist*'); proton_tar_dir=$(dirname "$proton_tar")
if [[ -d "$proton_tar_dir/dist" ]]; then
if ! cmp -s "$proton_tar_dir/version" "$proton_tar_dir/dist/version"; then
rm -rf "$proton_tar_dir/dist"; mkdir "$proton_tar_dir/dist"
tar -xf "$proton_tar" -C "$proton_tar_dir/dist/"
cat "$proton_tar_dir/version" > "$proton_tar_dir/dist/version"; fi
else
mkdir "$proton_tar_dir/dist"
tar -xf "$proton_tar" -C "$proton_tar_dir/dist/"; fi; fi
if [[ $(find "$line" -type f -name "wine") ]]; then
runner_path="$(find "$line" -type f -name "wine")"
if [[ -f "$line/version" ]]; then runner_version="$(cut -d' ' -f2 < "$line/version")"
else runner_version="$($runner_path --version)"; fi
echo "$runner_version | $runner_path" >> "$TEMPPATH/.runnerslist"; fi
fi; done < "$item"; fi; done
IFS="$Def_IFS"
}
prefixfinder() {
IFS="|"
for item in $1; do
if [[ -f "$item" ]]; then
while read -r line; do
if [[ -d "$line" ]]; then
cd "$line"
if [[ $(find "$(pwd -P)" -type d -name "drive_c") ]]; then
prefix_path="$(find "$(pwd -P)" -type d -name "drive_c")"
IFS=$'\n'
for i in $prefix_path; do
echo "$(basename "$(dirname "$i")") | $(dirname "$i")" >> "$TEMPPATH/.prefixeslist"
done
fi
fi
done < "$item"
fi
done
IFS="$Def_IFS"
}
servicefinder() {
IFS="|"
for item in $1; do
if [[ -f "$item" ]]; then
while read -r line; do
if [[ "$line" == *'/'* ]]; then service_name="$(basename "$line")"
else service_name="${line}"; fi; service_name="${service_name// /}"
service_full_name="$service_name"; service_name="${service_name//.*/}"
service_path_user="$(systemctl show --user -p FragmentPath "$service_full_name" | sed "s/FragmentPath=//g")"
service_path_root="$(systemctl show -p FragmentPath "$service_full_name" | sed "s/FragmentPath=//g")"
if [[ "${service_path_user}" != "" ]]; then service_type="user"; service_path="$service_path_user"
elif [[ "${service_path_root}" != "" ]]; then service_type="root"; service_path="$service_path_root"; fi
if [[ -n "${service_type:+x}" ]]; then
if [[ "$service_type" == "user" ]]; then service_type="--user"; else service_type=""; fi
service_status="$(eval "systemctl $service_type show -p ActiveState $service_full_name | sed 's/ActiveState=//g'")"
if [[ "$service_status" == "active" ]]; then servc="$lgrc"
elif [[ "$service_status" == "inactive" ]]; then servc="$lblc"
else servc="$rec"; fi
service_string="${servc}${service_status^}${noc} - ${grc}${service_name^}${noc} | $service_path $service_type"
grep -Fq "$service_string" "$TEMPPATH/.serviceslist" || echo "$service_string" >> "$TEMPPATH/.serviceslist"; fi
done < "$item"
fi; done
IFS="$Def_IFS"
}
serviceinit() {
selected_service=""
while : ; do
if [[ -f "$TEMPPATH/.serviceslist" ]]; then rm "$TEMPPATH/.serviceslist"; fi
touch "$TEMPPATH/.serviceslist"
servicefinder "$HIPATH/services.cfg"
echo "Add service" >> "$TEMPPATH/.serviceslist"
readfiles "Services" "$TEMPPATH/.serviceslist"
if [[ "$read_result_dir" == "Add service" ]]; then
generalinput "service|continue" "${grc}service's${noc} ${cyc}name${noc} or full ${cyc}path${noc} to ${grc}service${noc} file"
if [[ "$input_ans" != "none" ]]; then echo "$input_ans" >> "$HIPATH/services.cfg"; fi
else
selected_service_type="$(echo "$read_result_dir" | cut -d' ' -f2)"
selected_service_name="$(basename "$(echo "$read_result_dir" | cut -d' ' -f1)")"
selected_service="$selected_service_type $selected_service_name"
break; fi; done
}
runnerinit() {
selected_runner=""; selected_runner_path=""
while : ; do
if [[ "$1" != "proton" ]]; then
echo "$(/usr/bin/wine --version) | /usr/bin/wine" > "$TEMPPATH/.runnerslist"
if [[ -d "$PACKPATH/wine-ge-custom" ]]; then
echo "Wine-GE | $PACKPATH/wine-ge-custom/Wine-GE/bin/wine" >> "$TEMPPATH/.runnerslist"
fi
fi
if [[ "$1" == "all" ]]; then runnerfinder "$HIPATH/addrun.cfg|$TEMPPATH/.steamrun"
elif [[ "$1" == "wine" ]]; then runnerfinder "$HIPATH/addrun.cfg"
elif [[ "$1" == "proton" ]]; then runnerfinder "$TEMPPATH/.steamrun"; fi
if [[ "$1" != "proton" ]]; then echo "Add new runner" >> "$TEMPPATH/.runnerslist"; fi
readfiles "Runners" "$TEMPPATH/.runnerslist"
if [[ "$read_result_dir" == "Add new runner" ]]; then addlines "runner" "$HIPATH/addrun.cfg"
else selected_runner="$read_result_dir"; selected_runner_path=$(dirname "$read_result_dir"); break; fi; done
}
prefixinit() {
selected_prefix=""
while : ; do
echo "Default prefix | $HOME/.wine" > "$TEMPPATH/.prefixeslist"
prefixfinder "$HIPATH/addpfx.cfg"
echo "Add new prefix" >> "$TEMPPATH/.prefixeslist"
echo "Create new prefix" >> "$TEMPPATH/.prefixeslist"
readfiles "Prefixes" "$TEMPPATH/.prefixeslist"
if [[ "$read_result_dir" == "Add new prefix" ]]; then addlines "prefix" "$HIPATH/addpfx.cfg"
elif [[ "$read_result_dir" == "Create new prefix" ]]; then prefixcreator "all"
else selected_prefix="$read_result_dir"; break; fi; done
}
prefixcreator() {
if [[ "$1" == "all" ]]; then addlines "prefix" "$HIPATH/addpfx.cfg"; pfx_path="$line_path"
elif [[ "$1" == "proton" ]]; then pfx_path="${line_path}"; if [[ ! -d "$pfx_path" ]]; then mkdir -p "$pfx_path"; fi; fi
if [[ ! -d "${pfx_path}/drive_c" ]]; then
if [[ -z "${selected_runner:+x}" ]]; then runnerinit "$1"; fi
if [[ "$1" == "proton" ]]; then select_ans="2"
else listoptions "Prefix Version" "32bit|64bit"; fi
if [[ "$select_ans" == "1" ]]; then
WINEARCH=win32 WINEPREFIX="$pfx_path" "$selected_runner" wineboot -u
elif [[ "$select_ans" == "2" ]]; then
WINEPREFIX="$pfx_path" "$selected_runner" wineboot -u; fi
else echo -e "\n ${grc}Prefix${noc} already ${mac}exist${noc}\n"; fi
}
prefixcommands() {
listoptions "Wine Functions" "Wine Config|Control Panel|Task Manager|Explorer|Install/Uninstall Apps|Registry Editor|Kill Running Apps|Force Kill Running Apps|Custom command"
case "$select_ans" in
"1")
command_func="winecfg"
;;
"2")
command_func="control"
;;
"3")
command_func="taskmgr"
;;
"4")
command_func="explorer"
;;
"5")
command_func="uninstaller"
;;
"6")
command_func="regedit"
;;
"7")
command_func="wineserver -k"
;;
"8")
command_func="wineserver -k9"
;;
"9")
generalinput "prefixcommand" "${cyc}custom command${noc} (Example: ${cyc}notepad.exe${noc})"; command_func="$input_ans"
esac
if [[ "$command_func" == "wineserver -k" || "$command_func" == "wineserver -k9" ]]; then eval "WINEPREFIX=\"$selected_prefix\" $command_func"
else
if [[ "$1" == "proton" ]]; then runnerinit "proton"; else runnerinit "all"; fi
eval "WINEPREFIX=\"$selected_prefix\" \"$selected_runner\" $command_func"; fi
}
packsinstaller() {
packagetype=""; packageurl=""; packagearg=""; packagename=""; packagever=""
find "$INSTPATH" -maxdepth 1 -mindepth 1 -type d | while read -r line; do basename "$line" >> "$TEMPPATH/.packsfolders"; done
if [[ "$osversion" != "ArchLinux" ]]; then sed -i "/TKG/d" "$TEMPPATH/.packsfolders"; fi
readfiles "Categories|sort" "$TEMPPATH/.packsfolders"
selected_package_type="$read_result_dir"
find "$INSTPATH/$selected_package_type" -maxdepth 1 -mindepth 1 -type f | while read -r line; do basename "$line" >> "$TEMPPATH/.packs"; done
readfiles "Packages|sort" "$TEMPPATH/.packs"
selected_package_name="$read_result_dir"
selected_package="$INSTPATH/$selected_package_type/$selected_package_name"
. "$selected_package"
cd "$PACKPATH"
case "$packagetype" in
"branch")
name=$(basename -s .git "$packageurl")
listoptions "Options" "Install/Reinstall ${noc} - ${blc}Check \"${cyc}$packageurl${blc}\" for additional information or necessary dependencies${noc}|Update|Uninstall"
if [[ -f "$selected_package" ]]; then
if [[ "$select_ans" == "1" ]]; then
if [[ -d "$name" ]]; then rm -rf "$name"; fi
if grep -oq "packagearg" "$selected_package"; then eval "git clone $packagearg $packageurl"
else eval "git clone $packagearg $packageurl"; fi
cd "$name"
if grep -oq "packageinstall" "$selected_package"; then packageinstall; fi
elif [[ "$select_ans" == "2" ]]; then
if [[ -d "$name" ]]; then
cd "$name"; git reset --hard; git pull "$packageurl"
if grep -oq "packageinstall" "$selected_package"; then
listoptions "Install? " "Yes|No"
if [[ $select_ans == "1" ]]; then
packageinstall; fi; fi
else echo -e "\n${grc}Package${noc} ${rec}not installed${noc}!\n"; fi
elif [[ "$select_ans" == "3" ]]; then
if [[ -d "$name" ]]; then
if grep -oq "packageuninstall" "$selected_package"; then cd "$name"; packageuninstall; cd ..; fi
rm -rf "$name"
else echo -e "\nFirst install the ${grc}package${noc}\n"; fi; fi
else echo -e "\n${grc}Config file${noc} is ${mac}empty${noc}\n"; fi
;;
"release")
name=$(basename -s .git "$packagename")
listoptions "Options" "Install/Update|Uninstall"
if [[ -f "$selected_package" ]]; then
if [[ "$select_ans" == "1" ]]; then
if [[ ! -d "$name" ]]; then mkdir -p "$name"; fi
cd "$name"; git-latest "$packagename" "$packagever"
eval "wget \"$git_package\""
if grep -oq "packageinstall" "$selected_package"; then packageinstall; fi
elif [[ "$select_ans" == "2" ]]; then
if grep -oq "packageuninstall" "$selected_package"; then packageuninstall; fi
rm -rf "$name"; fi
else echo -e "\n${grc}Config file${noc} is ${mac}empty${noc}\n"; fi
esac
}
steamlauchoptions() {
steam_command="%command%"; launcher_type="steam"
settingsinit
IFS='|'
for item in $settings_overall_values; do
if [[ "$item" == "custom_args" ]]; then steam_command="$steam_command ${!item}"
else steam_command="${!item} $steam_command"; fi; done
IFS="$Def_IFS"
echo -e "\nCopy ${cyc}this${noc} to ${grc}steam game${noc} properties:\n${cyc}$steam_command${noc}\n"
}
steamfinder() {
if [[ -f "$HOME/.steam/root/steamapps/libraryfolders.vdf" ]]; then
numbers=$(grep -no "path" "$HOME/.steam/root/steamapps/libraryfolders.vdf" | cut -d: -f1)
for item in $numbers; do
steam_folder=$(sed -n "${item}p" "$HOME/.steam/root/steamapps/libraryfolders.vdf" | cut -d\" -f4)
for item2 in "${steam_folder}/steamapps/appmanifest_"*'.acf'; do
if [[ -f "$item2" ]]; then
steam_name=$(grep '"name"' "$item2" | cut -d\" -f4)
steam_appid=$(grep '"appid"' "$item2" | cut -d\" -f4)
steam_dirname=$(grep '"installdir"' "$item2" | cut -d\" -f4)
case $steam_name in
*"Proton"* | *"Runtime"* | *"Steamworks"*)
if [[ "$steam_dirname" == *"Proton"* ]]; then echo -e "$steam_folder/steamapps/common/$steam_dirname" >> "$TEMPPATH/.steamrun"; fi
;;
*)
echo -e "$steam_name | $steam_appid" >> "$TEMPPATH/.steamapps"
echo -e "$steam_name | $steam_folder/steamapps/common/$steam_dirname" >> "$TEMPPATH/.steamdirs"
if [[ -d "$steam_folder/steamapps/compatdata/$steam_appid/pfx" ]]; then
echo -e "$steam_name | $steam_folder/steamapps/compatdata/$steam_appid/pfx" >> "$TEMPPATH/.steampfx"
echo -e "$steam_name | $steam_folder/steamapps/compatdata/$steam_appid" >> "$TEMPPATH/.steamgamecompat"; fi
esac; fi
done; done; fi
if [[ -d "/usr/share/steam/compatibilitytools.d/" ]]; then
find "/usr/share/steam/compatibilitytools.d/" -maxdepth 1 -mindepth 1 | while read -r line; do
echo -e "$line" >> "$TEMPPATH/.steamrun"; done; fi
if [[ -d "$HOME/.steam/root/compatibilitytools.d" ]]; then
find "$HOME/.steam/root/compatibilitytools.d" -maxdepth 1 -mindepth 1 | while read -r line; do
echo -e "$line" >> "$TEMPPATH/.steamrun"; done; fi
find "$HOME/.steam/steam/userdata/" -name "localconfig.vdf" | while read -r line; do
steam_profile_name=$(grep '"PersonaName"' "$line" | cut -d\" -f4)
echo -e "${steam_profile_name} | ${line}" >> "$TEMPPATH/.lcfiles"; done
}
epicfinder() {
case $1 in
'installed')
legendary list-installed &> "$TEMPPATH/.epic${1}info"
epic_installed=$(grep '\*' "$TEMPPATH/.epic${1}info" | cut -d'*' -f2 | cut -d'|' -f1 | awk '{$1=$1};1')
echo -e "${epic_installed//\(App name:/|}" > "$TEMPPATH/.epic${1}apps"
;;
'all')
legendary list &> "$TEMPPATH/.epic${1}info"
epic_all=$(grep '\*' "$TEMPPATH/.epic${1}info" | cut -d'*' -f2 | cut -d'|' -f1 | awk '{$1=$1};1')
echo -e "${epic_all//\(App name:/|}" > "$TEMPPATH/.epic${1}apps"
;;
esac
readfiles "Legendary Apps|sort" "$TEMPPATH/.epic${1}apps"
}
execinit() {
generalinput "execfiles" "${cyc}path${noc} to the ${grc}folder with executable${noc} or ${cyc}full path${noc} to ${grc}executable${noc}"
if [[ -f $(echo "$input_ans" | awk '{$1=$1};1') ]]; then
input_ans="$(echo "$input_ans" | awk '{$1=$1};1')"
init_result_name="$(basename -s .exe "$input_ans")"; init_result_dir=$(dirname "$input_ans"); init_result="$input_ans"
else
case "$1" in
"wine")
find "$input_ans" -name "*.exe" -o -name "*.msi" | while read -r line; do echo -e "$(basename -s .exe "$line") | $line" >> "$TEMPPATH/.${1}files"; done
;;
"linux")
find "$input_ans" -perm /111 -type f ! -name "*.dll" ! -name "*.so" | while read -r line; do echo -e "$(basename "$line") | $line" >> "$TEMPPATH/.${1}files"; done
esac
if [[ -s "$TEMPPATH/.${1}files" ]]; then
readfiles "${1^} Executables|sort" "$TEMPPATH/.${1}files"
init_result_name="$read_result_name"; init_result_dir=$(dirname "$read_result_dir"); init_result="$read_result_dir"
else echo -e "\n ${grc}Executable${noc} ${mac}not found${noc}\n"; exit; fi; fi
}
launchercreator() {
launcher_type="$1"
if [[ "$launcher_type" != "linux" ]]; then prefixinit; runnerinit "all"; fi
if [[ "$launcher_type" != "epic" ]]; then
execinit "$launcher_type"
launcher_name=$init_result_name; launcher_exec_dir="$init_result_dir"; launcher_exec="$init_result"
else
epicfinder "installed"
launcher_name="$read_result_name"; launcher_exec="$read_result_dir"
fi
generalinput "launchername ___ $launcher_name" "${cyc}name${noc} of the ${grc}launcher${noc}"
launcher_name="${input_ans//.*/}"
settingsinit; launchercompleteinit "created"
}
launchereditor () {
launcher_name="$1"
. "$LAUNCHPATH/${launcher_name}.hlu" "read_vars"
if [[ "$launcher_type" == "wine" ]]; then
listoptions "Launcher Setup" "Change launch Options|Change prefix|Change runner|Change prefix and runner|Change executable"
if [[ "$select_ans" == "1" ]]; then
settingsinit
elif [[ "$select_ans" == "2" ]]; then
prefixinit
elif [[ "$select_ans" == "3" ]]; then
runnerinit "all"
elif [[ "$select_ans" == "4" ]]; then
prefixinit; runnerinit "all"
elif [[ "$select_ans" == "5" ]]; then
execinit "$launcher_type"; launcher_exec_dir="$init_result_dir"; launcher_exec="$init_result"; fi
elif [[ "$launcher_type" == "linux" ]]; then
listoptions "Launcher Setup" "Change launch Options|Change executable"
if [[ "$select_ans" == "1" ]]; then
settingsinit
elif [[ "$select_ans" == "2" ]]; then
execinit "$launcher_type"; launcher_exec_dir="$init_result_dir"; launcher_exec="$init_result"; fi
elif [[ "$launcher_type" == "epic" ]]; then
listoptions "Launcher Setup" "Change launch Options|Change prefix|Change runner|Change prefix and runner"
if [[ "$select_ans" == "1" ]]; then
settingsinit
elif [[ "$select_ans" == "2" ]]; then
prefixinit
elif [[ "$select_ans" == "3" ]]; then
runnerinit "all"
elif [[ "$select_ans" == "4" ]]; then
prefixinit; runnerinit "all"; fi
fi
launchercompleteinit "updated"
}
launchercompleteinit() {
if [[ "$launcher_exec" == *".msi" ]]; then launcher_msi=" msiexec /i"; else launcher_msi=""; fi
if [[ "$launcher_type" == "wine" ]]; then
launcher_vars=" launcher_type=\"$launcher_type\"\n launcher_exec_dir=\"$launcher_exec_dir\"\n selected_runner=\"$selected_runner\"\n selected_prefix=\"$selected_prefix\"\n launcher_exec=\"$launcher_exec\"\n"
elif [[ "$launcher_type" == "linux" ]]; then
launcher_vars=" launcher_type=\"$launcher_type\"\n launcher_exec_dir=\"$launcher_exec_dir\"\n launcher_exec=\"$launcher_exec\"\n"
elif [[ "$launcher_type" == "epic" ]]; then
launcher_vars=" launcher_type=\"$launcher_type\"\n selected_runner=\"$selected_runner\"\n selected_prefix=\"$selected_prefix\"\n launcher_exec=\"$launcher_exec\"\n"; fi
if [[ "$launcher_type" == "wine" ]]; then
launcher_command="WINEPREFIX=\\\"\$selected_prefix\\\" \\\"\$selected_runner\\\"${launcher_msi}wine_vd \\\"\${launcher_exec}\\\""
elif [[ "$launcher_type" == "linux" ]]; then
launcher_command="\${launcher_exec}"
elif [[ "$launcher_type" == "epic" ]]; then
launcher_command="legendary launch --wine \\\"\${selected_runner}\\\" --wine-prefix \\\"\${selected_prefix}\\\" \${launcher_exec}"; fi
if [[ "${settings_overall_values:-x}" != *"wine_vd"* ]]; then launcher_command=${launcher_command//wine_vd/}; fi
if [[ -n "${settings_overall_values:+x}" ]]; then
launcher_settings=" settings_overall_values=\"$settings_overall_values\"\n"
IFS='|'
for item in ${settings_overall_values}; do
settings_item="\${$item}"
if [[ "$item" == "custom_args" ]]; then launcher_command="$launcher_command $settings_item"
elif [[ "$item" == "wine_vd" ]]; then
wine_vd_full="${!item}"
wine_vd_part_before="$(echo "$wine_vd_full" | cut -d"'" -f2)"
wine_vd_part_after="${wine_vd_part_before// /_}"
wine_vd="${wine_vd_full//$wine_vd_part_before/$wine_vd_part_after}"; export wine_vd
launcher_command="${launcher_command//wine_vd/ \$$item}"
elif [[ "${!item:=}" != "on" ]]; then
launcher_command="$settings_item $launcher_command"
fi
launcher_settings="$launcher_settings $item=\"${!item}\"\n"; done; IFS="$Def_IFS"
fi
if [[ "${settings_overall_values:-x}" != *"debug_switch"* ]]; then
launcher_command="$launcher_command &> \\\"/dev/null\\\""
else
launcher_command="$launcher_command &> \\\"$LOGPATH/${launcher_name// /_}.log\\\""
fi
if [[ $launcher_type == "epic" ]]; then
legendary info $launcher_exec &> "$TEMPPATH/.epicappinfo"
epic_cloud_status=$(grep 'Cloud saves supported' "$TEMPPATH/.epicappinfo" | cut -d':' -f2 | awk '{$1=$1};1')
epic_install_path=$(grep 'Install path' "$TEMPPATH/.epicappinfo" | cut -d':' -f2 | awk '{$1=$1};1')
if [[ $epic_cloud_status != "False" ]]; then
epic_save_path=$(grep 'Cloud save folder (Windows)' "$TEMPPATH/.epicappinfo" | cut -d':' -f2 | awk '{$1=$1};1')
if [[ $selected_runner == *[Pp]"roton"* ]]; then
user_save="steamuser"
else
user_save="$USER"
fi
epic_save_path=${epic_save_path//\{AppData\}/${selected_prefix}/drive_c/users/${user_save}/AppData/Local}
epic_save_path=${epic_save_path//\{UserSavedGames\}/${selected_prefix}/drive_c/users/${user_save}/Saved Games}
epic_save_path=${epic_save_path//\{UserDir\}/${selected_prefix}/drive_c/users/${user_save}/Documents}
epic_save_path=${epic_save_path//\{InstallDir\}/$epic_install_path}
epic_save_path=${epic_save_path//\{EpicID\}/$epic_account_id}
launcher_command="yes | legendary sync-saves --skip-upload --save-path \\\"\$epic_save_path\\\" \${launcher_exec}; $launcher_command"
launcher_vars="$launcher_vars epic_save_path=\"$epic_save_path\"\n"
fi
launcher_command="yes | legendary update --update-only \${launcher_exec}; $launcher_command"
fi
launcher_complete_command="#!/bin/bash\n${launcher_vars:=}\n${launcher_settings:=}\nif [[ \$1 != \"read_vars\" ]]; then\n\tcd \"\${launcher_exec_dir}\"\n\teval \"${launcher_command:=}\"\nfi"
launcher_name="$launcher_name.hlu"
echo -e "$launcher_complete_command" > "$LAUNCHPATH/$launcher_name"
chmod +x "$LAUNCHPATH/$launcher_name"
echo -e "\nLauncher ${grc}${launcher_name}${noc} successfully $1 in the ${grc}$LAUNCHPATH${noc} folder."
}
settingsinit() {
while read -r line; do
settings_menu="${settings_menu:=}|$(basename -s '.cfg' "$line" | cut -d'_' -f2) options"
done < <(find "$CONFPATH" -maxdepth 1 -mindepth 1 -type f | sort -n)
settings_menu=${settings_menu:1}
while : ; do
listoptions "Launcher setup|continue" "$settings_menu"
if [[ "$list_result_name" != "none" ]]; then
settings_name="$(echo "$list_result_name" | cut -d' ' -f1)"
settings_file="$(find "$CONFPATH" -name "*${settings_name}.cfg")"
sa_count=0; sf_count=0
settings_items="";settings_items_values=""
while read -r line; do
((sf_count+=1))
if [[ "$line" == "#-->"* ]]; then settings_item_begin_string[$sa_count]="$sf_count"; ((sa_count+=1)); fi
done < "$settings_file"
for ((i=0; i<sa_count; i++)); do
settings_items="${settings_items}|$(sed -n "$((settings_item_begin_string[i]+1))p" "$settings_file")"
settings_items_values="${settings_items_values}|$(sed -n "$((settings_item_begin_string[i]+2))p" "$settings_file")"
done
settings_items=${settings_items:1}; settings_items_values=${settings_items_values:1}
while : ; do
listoptions "$settings_name|continue" "$settings_items ___ $settings_items_values"
if [[ "$list_result_name" != "none" ]]; then
settings_item_name="$(sed -n "$((settings_item_begin_string[list_result_number-1]+2))p" "$settings_file")"
settings_item_limit="$(sed -n "$((settings_item_begin_string[list_result_number-1]+3))p" "$settings_file")"
settings_item_limit_string="$(sed -n "$((settings_item_begin_string[list_result_number-1]+4))p" "$settings_file")"
settings_item_input_text="$(sed -n "$((settings_item_begin_string[list_result_number-1]+5))p" "$settings_file")"
settings_item_value="$(sed -n "$((settings_item_begin_string[list_result_number-1]+6))p" "$settings_file")"
settings_item_default="$(sed -n "$((settings_item_begin_string[list_result_number-1]+7))p" "$settings_file")"
settings_item_input_limit="$(sed -n "$((settings_item_begin_string[list_result_number-1]+8))p" "$settings_file")"
if [[ "$settings_item_limit" == "none" ]]; then settings_item_limit='[[ "none" == "none" ]]'; fi
if eval "$settings_item_limit"; then
if [[ "$settings_item_input_text" != "none" ]]; then
settings_item_input_value=""
for ((i=1; i<=$(grep -o ' <|> ' <<< "$settings_item_input_text" | grep -c .)+1; i++)); do
settings_item_input_text_temp="$(echo -e "${settings_item_input_text// <|> /\\n}" | sed -n "${i}p")"
settings_item_value_temp="$(echo -e "${settings_item_value// <|> /\\n}" | sed -n "${i}p")"
settings_item_default_temp="$(echo -e "${settings_item_default// <|> /\\n}" | sed -n "${i}p")"
settings_item_input_limit_temp="$(echo -e "${settings_item_input_limit// <|> /\\n}" | sed -n "${i}p")"
while : ; do
generalinput "$settings_item_name-$i ___ $settings_item_default_temp|continue" "$settings_item_input_text_temp"
if [[ "$settings_item_input_limit_temp" == "none" ]] || [[ "$input_ans" == "none" ]] || eval "$settings_item_input_limit_temp"; then
break; fi
done
if [[ "$input_ans" != "none" ]]; then
settings_item_input_value="$settings_item_input_value${settings_item_value_temp//gi_value/$input_ans}"
else settings_item_input_value="none"; break; fi
done
else settings_item_input_value="none"; fi
if [[ "$settings_item_input_value" != "none" ]]; then
eval "$settings_item_name=\"$settings_item_input_value\""
elif [[ "$settings_item_value" != "none" && "$settings_item_input_text" == "none" ]]; then
if [[ -n "${!settings_item_name:+nex}" ]]; then eval "$settings_item_name=\"\""
else eval "$settings_item_name=\"$settings_item_value\""; fi
elif [[ "$settings_item_input_text" != "none" && "$settings_item_input_value" == "none" ]]; then
eval "$settings_item_name=\"\""; fi
else echo -e "\n $settings_item_limit_string\n"; fi
else break; fi
done
IFS='|'
for item in $settings_items_values; do
if [[ -n ${!item:+x} && ${!item:+x} != "" && "${settings_overall_values:-}" != *"$item"* ]]
then settings_overall_values="${settings_overall_values:=}|$item"; fi
done
if [[ "${settings_overall_values:-}" == "|"* ]]; then
settings_overall_values="${settings_overall_values:1}"; fi
if [[ -n "${settings_overall_values:+x}" ]]; then
for item in $settings_overall_values; do
if [[ ${!item:+x} == "" ]]; then
settings_overall_values=${settings_overall_values//$item/}; settings_overall_values=${settings_overall_values//||/|}
fi
done
IFS="$Def_IFS"
fi
if [[ "${settings_overall_values:-x}" == "|"* ]]; then
settings_overall_values="${settings_overall_values:1}"; fi
if [[ "${settings_overall_values:-x}" == *"|" ]]; then
settings_overall_values="${settings_overall_values::-1}"; fi
else break; fi
done
}
trap hi_exit EXIT; exit_flag="0"
Def_IFS=$'\n'; IFS=$Def_IFS
hlu_path="$0"
HIPATH="$HOME/Hist"
HISTORYPATH="$HIPATH/.historyfiles"
LAUNCHPATH="$HIPATH/Launchers"
TEMPPATH="$HIPATH/.temp"
INSTPATH="$HIPATH/Installers"
PACKPATH="$HIPATH/Packages"
CONFPATH="$HIPATH/Configs"
LOGPATH="$HIPATH/.logs";
if [[ ! -d "$HIPATH" ]]; then
mkdir -p "$HIPATH"
cd "$HIPATH"; git clone https://github.com/sergeyhist/hist-linux-utilities
cp -r "$HIPATH/hist-linux-utilities/Configs" "$HIPATH"
cp -r "$HIPATH/hist-linux-utilities/Installers" "$HIPATH"
rm -rf "$HIPATH/hist-linux-utilities"
fi
if [[ ! -d "$HISTORYPATH" ]]; then mkdir -p "$HISTORYPATH"; fi
if [[ ! -d "$LAUNCHPATH" ]]; then mkdir -p "$LAUNCHPATH"; fi
if [[ ! -d "$TEMPPATH" ]]; then mkdir -p "$TEMPPATH"
else rm -rf "$TEMPPATH"; mkdir -p "$TEMPPATH"; fi
if [[ ! -d "$PACKPATH" ]]; then mkdir -p "$PACKPATH"; fi
if [[ ! -d "$LOGPATH" ]]; then mkdir -p "$LOGPATH"; fi
noc="\e[0m"; rec="\e[31m"; grc="\e[32m"; blc="\e[34m"; cyc="\e[36m"; mac="\e[91m"; lgrc="\e[92m"; lblc="\e[94m"
eval "hostnamectl > \"$TEMPPATH/.osinfo\""
osversion="$(grep "Operating System" "$TEMPPATH/.osinfo" | cut -d: -f2)"; osversion=${osversion// /}
if [[ -d "$HOME/.steam" ]]; then steamfinder; fi
if [[ -f "$HOME/.config/legendary/user.json" ]]; then
epic_account_id=$(grep 'account_id' "$HOME/.config/legendary/user.json" | cut -d'"' -f4)
else
epic_account_id="none"
fi
listoptions "Hist Linux Utilities|exit" "Launcher Controller|Wine Helper|Steam Helper|Legendary Helper|Package Installer|Systemd Controller|HLU Updater"
case "$select_ans" in
"1") #Launcher Controller
cd "$LAUNCHPATH"
find "$PWD" -maxdepth 1 -mindepth 1 -type f -name "*.hlu" | while read -r line; do
if [[ -f "$line" ]]; then echo "$(basename "${line//.hlu/}")" >> "$TEMPPATH/.launcherslist"; fi; done
listoptions "Launcher Controller" "Create launcher|Edit launcher|Delete launcher|Open launcher in default editor|Open launcher in spicific editor|Run launcher"
if [[ "$select_ans" == "1" ]]; then
listoptions "Launcher Creator" "Wine App|Linux App|Legendary App"
if [[ "$select_ans" == "1" ]]; then
launchercreator "wine"
elif [[ "$select_ans" == "2" ]]; then
launchercreator "linux"
elif [[ "$select_ans" == "3" ]]; then
if [[ -f "/usr/local/bin/legendary" || -f "/usr/bin/legendary" ]]; then
if [[ $epic_account_id != "none" ]]; then
launchercreator "epic"
else
echo -e "\n${grc}Legendary${noc} not authenticated! Sign in in the ${grc}Legendary Helper${noc} menu"
fi
else
echo -e "\n${grc}Legendary${noc} not installed!"
fi
fi
elif [[ "$select_ans" == "2" ]]; then
readfiles "Launchers|sort" "$TEMPPATH/.launcherslist"
launchereditor "$read_result_dir"
elif [[ "$select_ans" == "3" ]]; then
readfiles "Launchers|sort" "$TEMPPATH/.launcherslist"
eval "rm \"$LAUNCHPATH/${read_result_dir}.hlu\""
elif [[ "$select_ans" == "4" ]]; then
readfiles "Launchers|sort" "$TEMPPATH/.launcherslist"
eval "$EDITOR \"$LAUNCHPATH/${read_result_dir}.hlu\""
elif [[ "$select_ans" == "5" ]]; then
readfiles "Launchers|sort" "$TEMPPATH/.launcherslist"
generalinput "editorname" "${cyc}command${noc} for run desired ${grc}text editor${noc} (Example: ${cyc}nano${noc})"
eval "$input_ans \"$LAUNCHPATH/${read_result_dir}.hlu\""
elif [[ "$select_ans" == "6" ]]; then
readfiles "Launchers|sort" "$TEMPPATH/.launcherslist"
eval "sh \"$LAUNCHPATH/${read_result_dir}.hlu\""
fi
;;
"2") #Wine Helper
listoptions "Wine Utilities" "Prefix commands|Winetricks|Dxvk|Vkd3d|Install MF|Install MF-Cab|Install mfplat.dll|Prefixes manager|Runners manager|Reset default prefix"
if [[ "$select_ans" == "1" ]]; then
prefixinit; prefixcommands "all"
elif [[ "$select_ans" == "2" ]]; then
prefixinit; runnerinit "all"
generalinput "winetricks ___ --gui" "${cyc}winetricks arguments${noc} (Example: ${cyc}vcrun2019${noc})"
eval "WINEPREFIX=\"$selected_prefix\" WINE=\"$selected_runner\" winetricks $input_ans"
elif [[ "$select_ans" == "3" ]]; then
if [[ -d "$PACKPATH/dxvk" ]]; then
listoptions "Options List" "Install|Uninstall"
if [[ "$select_ans" == "1" ]]; then update_option="install"
elif [[ "$select_ans" == "2" ]]; then update_option="uninstall"; fi
prefixinit; runnerinit "all"
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/dxvk/dlls/dxvk-master/setup_dxvk.sh\" $update_option"
else echo -e "\nInstall ${grc}Dxvk${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "4" ]]; then
if [[ -d "$PACKPATH/vkd3d-proton" ]]; then
listoptions "Options List" "Install|Uninstall"
if [[ "$select_ans" == "1" ]]; then update_option="install"
elif [[ "$select_ans" == "2" ]]; then update_option="uninstall"; fi
prefixinit; runnerinit "all"
if [[ ! -f "$selected_prefix/drive_c/windows/system32/d3d12.dll" ]]; then touch "$selected_prefix/drive_c/windows/system32/d3d12.dll"
elif [[ ! -f "$selected_prefix/drive_c/windows/syswow64/d3d12.dll" ]]; then touch "$selected_prefix/drive_c/windows/syswow64/d3d12.dll"; fi
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/vkd3d-proton/dlls/vkd3d-proton-master/setup_vkd3d_proton.sh\" $update_option"
else echo -e "\nInstall ${grc}Vkd3d${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "5" ]]; then
if [[ -d "$PACKPATH/mf-install" ]]; then
prefixinit; runnerinit "all"
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/mf-install/mf-install.sh\""
else echo -e "\nInstall ${grc}MF${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "6" ]]; then
if [[ -d "$PACKPATH/mf-installcab" ]]; then
prefixinit;runnerinit "all"
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/mf-installcab/install-mf-64.sh\""
else echo -e "\nInstall ${grc}MF-Cab${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "7" ]]; then
if [[ -d "$PACKPATH/mf-installcab" ]]; then execinit "wine"; cp "$PACKPATH/mf-installcab/mfplat.dll" "$init_result_dir"
else echo -e "\nInstall ${grc}MF-Cab${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ $select_ans == "8" ]]; then
listoptions "Lists Manager" "Add prefix|Create prefix|Delete prefix"
if [[ "$select_ans" == "1" ]]; then addlines "prefix" "$HIPATH/addpfx.cfg"
elif [[ "$select_ans" == "2" ]]; then prefixcreator "all"
elif [[ "$select_ans" == "3" ]]; then deletelines "Prefixes" "$HIPATH/addpfx.cfg" "none"; fi
elif [[ $select_ans == "9" ]]; then
listoptions "Lists Manager" "Add runner|Delete runner"
if [[ "$select_ans" == "1" ]]; then addlines "runner" "$HIPATH/addrun.cfg"
elif [[ "$select_ans" == "2" ]]; then deletelines "Runners" "$HIPATH/addrun.cfg" "none"; fi
elif [[ $select_ans == "10" ]]; then
listoptions "Are you sure?" "Yes|No"
if [[ "$select_ans" == "1" ]]; then
rm -rf "$HOME/.wine"; mkdir "$HOME/.wine"
eval "WINEPREFIX=\"$HOME/.wine\" wine wineboot -u"; fi; fi
;;
"3") #Steam Helper
listoptions "Steam Helper" "Set game launch options|Game prefix commands|Winetricks|Reset game prefix|Install MF|Install MFCab|Install mfplat.dll|Steam Rom Manager"
if [[ $select_ans == "1" ]]; then steamlauchoptions
elif [[ $select_ans == "2" ]]; then
readfiles "Steam game prefixes|sort" "$TEMPPATH/.steampfx"; selected_prefix="$read_result_dir"; prefixcommands "proton"
elif [[ $select_ans == "3" ]]; then
readfiles "Steam game prefixes|sort" "$TEMPPATH/.steampfx"; selected_prefix="$read_result_dir"; runnerinit "proton"
generalinput "winetricks ___ --gui" "${cyc}winetricks arguments${noc}"
eval "WINEPREFIX=\"$selected_prefix\" WINE=\"$selected_runner\" winetricks $input_ans"
elif [[ $select_ans == "4" ]]; then deletelines "Steam game prefixes" "$TEMPPATH/.steamgamecompat" "none"
elif [[ $select_ans == "5" ]]; then
if [[ -d "$PACKPATH/mf-install" ]]; then
readfiles "Steam game prefixes|sort" "$TEMPPATH/.steampfx"; selected_prefix="$read_result_dir"; runnerinit "proton"
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/mf-install/mf-install.sh\""
else echo -e "\nInstall ${grc}MF${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ $select_ans == "6" ]]; then
if [[ -d "$PACKPATH/mf-installcab" ]]; then
readfiles "Steam game prefixes|sort" "$TEMPPATH/.steampfx"; selected_prefix="$read_result_dir"; runnerinit "proton"
eval "WINEPREFIX=\"$selected_prefix\" PATH=\"$selected_runner_path:\$PATH\" WINELOADER=\"$selected_runner\" \"$PACKPATH/mf-installcab/install-mf-64.sh\""
else echo -e "\nInstall ${grc}MF-Cab${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "7" ]]; then
if [[ -d "$PACKPATH/mf-installcab" ]]; then
readfiles "Steam games|sort" "$TEMPPATH/.steamdirs"
find "$read_result_dir" -name "*.exe" | while read -r line; do echo -e "$(basename -s .exe "$line") | $line" >> "$TEMPPATH/.steamexes"; done
readfiles "Exe files|sort" "$TEMPPATH/.steamexes"
cp "$PACKPATH/mf-installcab/mfplat.dll" "$(dirname "$read_result_dir")"
else echo -e "\nInstall ${grc}MF-Cab${noc} from ${grc}Packages Installer${noc}!"; fi
elif [[ "$select_ans" == "8" ]]; then
if [[ -f "$PACKPATH/steam-rom-manager/Steam-ROM-Manager.AppImage" ]]; then
eval "cd "$PACKPATH/steam-rom-manager"; ./Steam-ROM-Manager.AppImage"
else
echo -e "\nFirst install ${grc}Steam-Rom-Manager${noc} from ${grc}Package Installer -> Tools${noc} menu"
fi
fi
;;
"4") #Legendary Helper
if [[ -f "/usr/local/bin/legendary" || -f "/usr/bin/legendary" ]]; then
if [[ $epic_account_id != "none" ]]; then
listoptions "Legendary Helper" "Sign out|Import game|Install game|Verify game|Repair game|Update game|Move game|Uninstall game|Check updates|Upload cloud saves|Fix cloud saves|Game info"
if [[ $select_ans == "1" ]]; then
eval "legendary auth --delete"
elif [[ $select_ans == "2" ]]; then
epicfinder "all"
generalinput "epicinstallpath" "${cyc}path${noc} to the ${grc}game${noc} folder"
eval "legendary import $read_result_dir \"$input_ans\""
elif [[ $select_ans == "3" ]]; then
epicfinder "all"
generalinput "epicinstallpath" "the ${cyc}path${noc} where the ${grc}game${noc} will be installed"
eval "legendary install --base-path \"$input_ans\" $read_result_dir"
elif [[ $select_ans == "4" ]]; then
epicfinder "installed"
eval "legendary verify $read_result_dir"
elif [[ $select_ans == "5" ]]; then
epicfinder "installed"
eval "legendary repair $read_result_dir"
elif [[ $select_ans == "6" ]]; then
epicfinder "installed"
eval "legendary update $read_result_dir"
elif [[ $select_ans == "7" ]]; then
epicfinder "installed"
eval "legendary move $read_result_dir"
elif [[ $select_ans == "8" ]]; then
epicfinder "installed"
eval "legendary uninstall $read_result_dir"
elif [[ $select_ans == "9" ]]; then
eval "legendary list-installed --check-updates"
elif [[ $select_ans == "10" ]]; then
eval "legendary sync-saves --skip-download --disable-filters"
elif [[ $select_ans == "11" ]]; then
eval "legendary clean-saves"
elif [[ $select_ans == "12" ]]; then
epicfinder "all"
eval "legendary info $read_result_dir"
fi
else
listoptions "Legendary Helper" "Sign out|Import game|Install game|Verify game|Repair game|Update game|Move game|Uninstall game|Check updates|Upload cloud saves|Fix cloud saves|Game info"
if [[ $select_ans == "1" ]]; then
eval "legendary auth"
elif [[ $select_ans == [2-12] ]]; then
echo -e "\n${grc}Legendary${noc} not authenticated!"
fi
fi
else
echo -e "\n${grc}Legendary${noc} not installed!"
fi
;;
"5") #Packages Installer
if [[ -f "/usr/bin/git" ]]; then packsinstaller
else echo -e "\n ${grc}Git ${mac}must be installed!${noc}"; fi
;;
"6") #Systemd Controller
while : ; do
serviceinit
listoptions "Select option|continue" "Start|Stop|Restart|Enable|Disable|Status|Unlist"
if [[ "$select_ans" == "1" ]]; then eval "systemctl start $selected_service"
elif [[ "$select_ans" == "2" ]]; then eval "systemctl stop $selected_service"
elif [[ "$select_ans" == "3" ]]; then eval "systemctl restart $selected_service"
elif [[ "$select_ans" == "4" ]]; then eval "systemctl enable $selected_service"
elif [[ "$select_ans" == "5" ]]; then eval "systemctl disable $selected_service"
elif [[ "$select_ans" == "6" ]]; then eval "systemctl status $selected_service"
elif [[ "$select_ans" == "7" ]]; then sed -i "\#$selected_service_name#d" "$HIPATH/services.cfg"; fi; done
;;
"7") #HLU Updater
if [[ -d "$HIPATH/hist-linux-utilities" ]]; then rm -rf "$HIPATH/hist-linux-utilities"; fi
cd "$HIPATH"; git clone https://github.com/sergeyhist/hist-linux-utilities
rm -rf "$HIPATH/Configs"
rm -rf "$HIPATH/Installers"
cp -r "$HIPATH/hist-linux-utilities/Configs" "$HIPATH"
cp -r "$HIPATH/hist-linux-utilities/Installers" "$HIPATH"
exit_flag=2
esac