-
Notifications
You must be signed in to change notification settings - Fork 1
/
winestarter_conf
executable file
·4339 lines (4240 loc) · 178 KB
/
winestarter_conf
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
#! /bin/bash
# #License:
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
## You can redistribute it as you wish : GPL v3
## author : wildtruc@noneltd.net
#PATH=$PATH
colors(){
if [[ -s $HOME/.winestarter/color.conf ]]; then
. $HOME/.winestarter/color.conf
fi
vb='<span color="'$main'" weight="bold" font="'$font0' '$size0'">'
vn='<span color="'$main'" weight="normal" font="'$font0' '$size0'">'
rb='<span color="'$warn'" weight="bold" font="'$font0' '$size0'">'
gb='<span color="'$freeze'" weight="bold" font="'$font0' '$size0'">'
bf='<span color="'$main'" weight="bold" font="'$font1' '$size1'">'
brf='<span color="'$warn'" weight="bold" font="'$font1' '$size1'">'
#bf='<span color="'$main'" weight="bold" font="'$font' '$(($size+4))'">'
#brf='<span color="'$warn'" weight="bold" font="'$font' '$(($size+4))'">'
nf='<span weight="bold" font="'$font0' '$size0'">'
vz='<span color=\"'$main'\" weight=\"bold\" font=\"'$size0'\">'
end='</span>'
## Script colours Vars.
#t='\e[0;39m' #default terminal colour
#r='\e[1;31m' #red
g_notif='\e[1;31m' #green
c_notif='\e[1;32m' #cyan
#j='\e[1;33m' #yellow
i_notif='\e[40m\e[1m\e[37m''\e[1;31m'
e_notif='\e[0;39m'
}
icons_set(){
png_stock=$HOME/.winestarter/png/defaults
## window bar icon
img_desktop=$png_stock/'wine48w.png'
## main window
img_wine_add=$png_stock/'new_bottle16.png'
img_wine_mod=$png_stock/'config16.png'
img_wine_mng=$png_stock/'bottle_manager16.png'
img_wine_desk_bt=$png_stock/'desktop16.png'
img_wine_colors=$png_stock/'colors16.png'
img_wine_restart=$png_stock/'reload.png'
img_wine_tools=$png_stock/'wine_tools16.png'
## scripts
img_wine_save=$png_stock/'wine_save16.png'
img_wine_kill=$png_stock/'wine_kill16.png'
## tabs
img_wine_ui=$png_stock/'wine-wine48.png'
img_wine_cfg1=$png_stock/'wine-winecfg48.png'
img_wine_cfg2=$png_stock/'wine-msiexec48.png'
img_tricks=$png_stock/'wine-winetricks48.png'
img_reged=$png_stock/'wine-winefile48.png'
img_nv_cm=$png_stock/'nvidia48.png'
img_nv_ext=$png_stock/'graphic_set48.png'
img_xrandr=$png_stock/'display48.png'
img_opti=$png_stock/'optimus48.png'
## buttons
img_tricks_bt=$png_stock/'wine16w.png'
img_reg_bt=$png_stock/'reg_manager16.png'
img_ctrlpanel_bt=$png_stock/'control_panel16.png'
## buttons other
img_winepol_bt=$png_stock/'playonlinux16.png'
img_winedis_bt=$png_stock/'wine16r.png'
img_install=$png_stock/'wine-install48.png'
## popups
img_bottle_mng=$png_stock/'bottle_manager48.png'
img_wine_desktop=$png_stock/'colors48.png'
img_wine_reload=$png_stock/'reload48.png'
img_wine_opts=$png_stock/'bottle_manager48.png'
## others
img_wine_desk_ui=$img_desktop
img_wine_final=$png_stock/'good_day.png'
}
main_code(){
default_win_design(){
[[ $code_tag = 0 ]]|| echo -e "$i_notif\n@@@@ default_win_design @@@@\n$e_notif"
## reset IFS to include white space
ifs=$IFS
IFS=$(echo -ne "\n\b")
## reset field values
unset field_list chk_list
## common sets values are represented under this form:
## base form :
## 1/ input var data (and extended data for combo);
## 2/ input var name;
## 3/ tab title (for fn_create_prefix);
## 4/ field message and information;
## 5/ field class (CHK,LBL,CB,etc);
## 6/ function name (for fn_create_prefix and tab creation);
## 7/ section tab left side image
## >> "TRUE;\2;\3;\4;\5;\6;\7"
## and catch by the following regex:
regex_0='^0;(.*;CHK;.*)'
regex_1='^1;(.*;CHK;.*)'
regex='(.*);(.*);(.*);[ ]?(.*);([A-Z]{0,4});(.*);(.*)'
## convert CHK numeric values to TRUE/FALSE
basic_sets=$(echo "$basic_sets" | sed -E -n "s/$regex_0/FALSE;\1/i;p"| \
sed -E -n "s/$regex_1/TRUE;\1/i;p")
## fields and corresponding values are then all parsed at the same time and displayed faster.
field_list=$(echo "$basic_sets" | sed -E -n "s/$regex/--field=\4:\5/p")
chk_list=$(echo "$basic_sets"| sed -E -n "s/$regex/\1/p" | \
sed -E -n "s/^([0-9],[0-9],[0-9].*)$/\1,unset/i;p")
# sortie : ';;TRUE;TRUE;FALSE;TRUE;TRUE;;;FALSE;FALSE;;;TRUE;FALSE;;;;FALSE;'
# origin regex form: regex='(.*);(.*);(.*);[ ]?(.*);([A-Z]{2,4});(.*);(.*)'
# corresponding to : "TRUE;\2;\3;\4;\5;\6;\7"
## extract basic_sets data without labeled line and get exploitable datas only.
from_basic=$(echo "$basic_sets"| egrep -v 'LBL'| sed -E -n "s/$regex/\1;\2;\3;\6;\7/p")
# ne pas tenir compte des labels
if [ $win_type = 0 ]; then
def_win=$($yad_bin --width=$w_width --title "$w_title" --image=$img_wine_ui \
--window-icon=$img_desktop --form --separator=';' --item-separator="$item_sep" $borders \
--align=left --text "$bf$w_text$end" $(echo "$field_list") $(echo "$chk_list") )
if [ $? = 1 ]; then exit 0; fi
from_output=$(echo "$def_win"| sed -n "s/;/\n/g;p"| cat -b| awk 'NF'| \
sed -E -n "s/^.*\ ([0-9]{1,3})\t(.*$)/\1#\2/;s/TRUE/1/g;s/FALSE/0/g;p")
fi
if [ $win_type = 1 ]; then
## fields and corresponding values are then all parsed at the same time and displayed faster.
field_list=( $(echo "$basic_sets" | sed -E -n "s/$regex/--field=\4:\5/p") )
chk_list=( $(echo "$basic_sets"| sed -E -n "s/$regex/\1/p" | \
sed -E -n "s/^([0-9],[0-9],[0-9].*)$/\1,unset/i;p") )
## extract basic_sets data without labeled line and get exploitable datas only.
echo "$basic_sets"| egrep -v "LBL|FBTN"| sed -E -n "s/$regex/\1;\2;\3;\6;\7/p" > $temp_a
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>> CHECK ME$e_notif"
w_width=$((594+$scale))
$yad_bin --width=$w_width $t_plug $t_rank $t_icon --text="$w_text" \
$extend_height $extend_pol --form --separator=';' --item-separator="$item_sep" $focus \
"${field_list[@]}" "${chk_list[@]}" > $temp_b &
fi
# if [ $win_type = 2 ]; then
# "${field_list[@]}" "${chk_list[@]}"
# fi
## restore IFS to previous state
IFS=$ifs
## from here, yad window is waiting for validation to go to next process.
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> $temp_a\n>>>> $(cat $temp_a)$e_notif"
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> $temp_b\n>>>> $(cat $temp_b)$e_notif"
}
default_tab_design(){
[[ $code_tag = 0 ]]|| echo -e "$i_notif\n@@@@ default_tab_design @@@@\n$e_notif"
wait_message='CREATE UI'
fn_plz_wait &
WAIT_UI_1=$(ps -A | grep "yad" | awk '{print $1}'| sed -n '1p')
# n_cfg=1
_num_tab=1
## This, represent only window tab order and making.
## compare input and output datas.
## redefine regex for new output form.
## output data to be treated are represented under this form :
## 1/ output var data;
## 2/ input>output var name;
## 3/ tab title (for fn_create_prefix);
## 6/ function name (for fn_create_prefix and tab creation);
## 7/ section tab left side image
regex='(.*);(.*);(.*);(.*);(.*)'
### valeur spécifiques
for _out_var in ${from_output}; do
_line=$(printf "$_out_var"| cut -d'#' -f1)
_val=$(printf "$_out_var"| cut -d'#' -f2)
if [[ $_val =~ TRUE|FALSE ]]; then
if [[ $_val == 'TRUE' ]]; then _val=1; else _val=0; fi
fi
if [ $(printf "$_line"| grep -c .) -gt 0 ]; then
## extract variable value by emulating cut.
_out_var=$(echo "$from_basic"| sed -n $_line\p| sed -E -n "s/$regex/\2/p" ) #/2
if [ $_val -gt 0 ]; then
## define if the basic_sets come from initial tab creation or not.
if [ $(echo "$from_basic"| sed -n $_line\p| \
sed -E -n "s/$regex/\3/p"| grep -c .) -gt 0 ]; then
_out_tab=$(echo "$from_basic"| sed -n $_line\p| sed -E -n "s/$regex/\3/p" ) #/3
_out_fun=$(echo "$from_basic"| sed -n $_line\p| sed -E -n "s/$regex/\4/p" ) #/4
_out_img=$(echo "$from_basic"| sed -n $_line\p| sed -E -n "s/$regex/\5/p" ) #/5
## prepare tab values per section and add them to tab list.
tab_set+=("$_num_tab;$_out_var;$_out_tab;$_out_fun;$_out_img")
## increment by 1 at each loop.
_num_tab=$[ $_num_tab+1 ]
fi
else
_val=0
fi
fi
## independently of any previous filters, sent output var to local script environment.
if [[ $_out_var == _extended ]]; then
export $_out_var=$_val
else
local $_out_var=$_val
fi
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> tab_set \n>>>> ${tab_set[@]}$e_notif"
done
}
default_tab_create(){
[[ $code_tag = 0 ]]|| echo -e "$i_notif\n@@@@ default_tab_create @@@@\n$e_notif"
## after each tab lists are defined, analyse them by loop to create corresponding window tabs.
## cycle between each defined tabs to prepare their temp files
for tab_vars in ${tab_set[@]}; do
## extract all vars from tab_set list.
t_num=$(printf "$tab_vars"| cut -d';' -f1)
t_var=$(printf "$tab_vars"| cut -d';' -f2)
t_name=$(printf "$tab_vars"| cut -d';' -f3)
t_fn_op=$(printf "$tab_vars"| cut -d';' -f4)
t_img=$(printf "$tab_vars"| cut -d';' -f5)
## if tab number is not null create corresponding temp files and fields data.
if [ $t_num -gt 0 ]; then
temp_a=$(mktemp --tmpdir tab$t_num.a.XXXXXXXX)
temp_b=$(mktemp --tmpdir tab$t_num.b.XXXXXXXX)
tmp_key_a=$(printf "$temp_a"|sed -n "s|^.*\.||p")
tmp_key_b=$(printf "$temp_b"|sed -n "s|^.*\.||p")
t_plug="--plug=$key"
t_rank="--tabnum=$t_num"
t_icon="--image=$t_img"
t_name=$(printf "$t_name"| tr '*' ' ')
t_display+=("--tab=$t_name")
t_val=1
else
t_val=0
fi
## add/create window tab data to be listed in extract_tmp_settings section.
tab_temp+=("$t_var;$t_val;$t_name;$temp_a;$temp_b;$tmp_key_a;$tmp_key_b")
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> tab temp\n>>>> ${tab_temp[@]}$e_notif"
## if specific function is associated, execute it to get datas.
## each time a tab is assigned, start associated function to load tab content in temp files.
if [ $t_num -gt 0 ]; then ${t_fn_op}; fi ## <<<< SOOOO, IMPORTANT
done
if [ $win_type = 1 ]; then
# ## give more time to winetricks
# while [[ $(pgrep 'winetricks') ]]; do
# sleep 1
# done
kill $WAIT_UI_1
w_width=$((800+$scale))
$yad_bin --width=$w_width --title "$w_title" --window-icon=$img_wine_desk_ui --borders=15 \
$main_height $main_scroll --notebook --key=$key --tab-pos=right --tab-border=2 \
--text="$main_tab_text" "${t_display[@]}"
e_exit=$?
## yad tabed window is displayed here.
if [ $t_var == _resume ]; then
# if [ $e_exit -ge 0 ]; then exit 0; fi
if [ $e_exit -gt 0 ]; then exit 0; else bash $bash_opt "$res_action"; fi
else
if [ $e_exit = 1 ]; then
exit 0
else
if [ $t_var == _wfirst ]; then
fn_wine_basic_feed
else
extract_tmp_settings
fi
fi
fi
fi
}
## from here, this meaning tab data are modified/set and validation button has been pressed.
extract_tmp_settings(){
[[ $code_tag = 0 ]]|| echo -e "$i_notif\n@@@@ extract_tmp_settings @@@@\n$e_notif"
wait_message='WORKING'
fn_plz_wait &
WAIT_UI_2=$(ps -A | grep "yad" | awk '{print $1}'| sed -n '1p')
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> tab temp resume :\n${tab_temp[@]}$e_notif"
for sets in "${tab_temp[@]}"; do
unset _out_conf_sets
_out_var=$(printf "$sets"| cut -d';' -f1)
_out_var_val=$(printf "$sets"| cut -d';' -f2)
_out_tmp_a=$(printf "$sets"| cut -d';' -f4)
_out_tmp_b=$(printf "$sets"| cut -d';' -f5)
fn_reconf=(reconf$_out_var)
from_basic=$(cat $_out_tmp_a)
## convert yad tab output datas to usable data for basic>output diff.
## filter per conf type first. Output analysis is not necessary the same for all.
if [ $_out_var == _tricks ]; then
from_output=$(cat $_out_tmp_b| sed -n "s/;/\n/g;p"| cat -b | grep -v "FALSE" | awk 'NF'| \
sed -E -n "s/^.*\ ([0-9]{1,3})\t(.*$)/\1#\2/;s/TRUE/1/g;p")
else
from_output=$(cat $_out_tmp_b| sed -n "s/;/\n/g;p"| cat -b | awk 'NF'| \
sed -E -n "s/^.*\ ([0-9]{1,3})\t(.*$)/\1#\2/;s/TRUE/1/g;s/FALSE/0/g;p")
fi
regex='(.*);(.*);(.*);(.*);(.*)'
ifs=$IFS
IFS=$(echo -ne "\n\b")
for _conf_var in ${from_output}; do
_line=$(printf "$_conf_var"| cut -d'#' -f1)
_val=$(printf "$_conf_var"| cut -d'#' -f2)
_out_line=$(echo "$from_basic"| sed -n $_line\p| sed -E -n "s/$regex/\2/p" )
if [[ $_out_line ]]; then
## send all output datas in a single list that be used at the beginning of reconf part.
_out_conf_sets+=($_out_line=$_val)
fi
done
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n>>>> $_out_var vars list:\n${_out_conf_sets[@]}\n$e_notif"
## define the config write method.
## If config file exist choose between 2 method:
if [ $from_config = 1 ]; then
## section already exist:
_fn_exist=$(cat $config_file| grep -wc "$_out_var")
## start the reconf section.
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> reconf section for $_out_var$e_notif"
${fn_reconf}
## If section exist, enter changes then insert it in tempory conf file.
if [ $_fn_exist -gt 0 ]; then
## define the beginning and the end of section text.
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> write temp file for $_out_var $e_notif"
_first=$(echo "$_section"| sed -n '1p'|sed -n "s|/|\\\/|g;p" )
_last=$(echo "$_section"| sed -n '$p')
## suppress previous section text from the conf file and replace it with section keyword
## in temporary conf file. FIXME ?
cat $TEMP_conf| sed -n "/$_first/,/^$_last/{;s/.*/$_out_var/};p"| uniq > $TEMP_edit
## Then replace the keyword by the modified section text.
perl -ni -pe "s|^$_out_var|$(echo "$_section")|i" $TEMP_edit
mv -f $TEMP_edit $TEMP_conf
else
## section doesn't exist: Then, just add at the end of the temporary conf file.
echo -e "$_section\n" >> $TEMP_conf
fi
else
## For new fresh conf, just write by pushing section conf text at the end of the file
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> new fresh section for $_out_var$e_notif"
${fn_reconf}
echo -e "$_section\n" >> $TEMP_conf
fi
sleep 1
IFS=$ifs
done
## if conf file is new one, define the conf name before copying.
if [ $from_config = 0 ]; then
config_file=$(printf "$bottle_prefix"| sed -n "s/^\.//p")'.conf'
cp -f -T $TEMP_conf $HOME/.winestarter/configs/$config_file
else
cp -f -T $TEMP_conf $config_file
fi
kill $WAIT_UI_2
end_game_display
if [ $? -ge 0 ]; then exit 0; fi
# if [ $e_exit -gt 0 ]; then exit 0; else bash $bash_opt "$res_action"; fi
}
## wait patiently window
fn_plz_wait(){
$yad_bin --width=200 --title "Please wait..." --text-align=center --no-buttons $on_top \
--window-icon=$img_wine_ui --progress --pulsate --auto-close \
--text="$vb\\$wait_message$end" --progress-text=""
}
## end process window and tab
end_game_display(){
unset tab_set tab_temp cfg_set t_display form_win
# launch default start window
conf_target=$(printf "$bottle_prefix"| sed -n "s/^.*[\/.\|.]\(\w*[Aa-Zz]\.\w*[Aa-Zz]*\)/\1/g;p")
w_title="Wine Starter"
main_tab_text="$bf Configuration applied to$end $brf$conf_target$end"
tab_set=("1;_resume;Resume;fn_end_game_1;$img_wine_final")
# "2;_resume;Warnings;fn_end_game_2;$img_wine_desk_ui")
# window style and function
win_type=1
focus='--focus-field=2'
# create main window variables
default_tab_create
}
fn_end_game_1(){
## --field="$vb New Wine prefix $end"#$img_wine_add
## "Create and config a fresh new Wine prefix":FBTN "$main_cmd_0" \
if [ $code_tag -gt 0 ]; then
# _dev_dir=$(echo -e "$0"| sed -En "s|^(.*)/(winestarter_conf)$|\1|g;p"
res_action="~/Devel/WINE/winestart/winestarter $conf_target.conf"
else
res_action="winestarter $conf_target.conf"
fi
w_text="$bf\All change are saved to the prefix configuration.$end\\n
$vb\\You can launch the script now by clicking validation button or from a terminal window with the command line below:$end\\n
winestarter $conf_target.conf\\n"
w_text1="\\n$nf\\Note$end$vn : Desktop file entry doesn't exist at this step, but will available after the prefix's program installation.$end"
w_text2="$nf\\Special warning$end$vn : When using this tool, you can occur window crash or freeze. This is a Yad issue that will be hopefuly fix in a near futur.$end"
# basic_sets="'';;;;LBL;;
#$res_action;;;$res_launch;FBTN;;
#'';;;;LBL;;
#'';;;$w_res_0;LBL;;"
basic_sets="'';;;;LBL;;
'';;;$w_text1;LBL;;
'';;;$w_text2;LBL;;"
item_sep='!'
# start form display
win_type=1
default_win_design
# create main window variables
# if [ $? -gt 0 ]; then exit 0; else bash $bash_opt "$res_action"; fi
}
# fn_end_game_2(){
# w_text="Blabla"
# w_res_1="Blobloblo"
# basic_sets="'';;;$w_res_1;LBL;;
#'';;;;LBL;;"
# # start form display
# win_type=1
# default_win_design
# # create main window variables
# }
reconf_wine(){
# "user_prefix bottle_prefix game_path game_dir game_exe use_winepath wine_path wine_ver"
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n##### reconf_wine $e_notif"
## send output datas to local script env.
local ${_out_conf_sets[@]}
## rewrite specifics variables for correct display and use.
for _list in ${_out_conf_sets[@]}; do
_var=$(printf "$_list"|cut -d'=' -f1)
_val=$(printf "$_list"|cut -d'=' -f2)
eval _listed='$'$_var
if [[ $_listed =~ ^$HOME[\/]?$ ]]; then
if [[ $_var != user_prefix ]]; then local $_var=''; fi
fi
if [[ $_listed == TRUE ]]; then _val=1; fi
if [[ $_listed == FALSE ]]; then _val=0; fi
case $_var in
'bottle_prefix') bottle_prefix=$(printf "$bottle_prefix"| sed -n "s|^.*/||g;p") ;;
'game_path')
game_key=$(printf "$game_path"| sed -n "s|^.*/||g;p")
if [[ $game_key =~ $USER ]]; then game_key=''; fi
if [[ $game_path == $HOME ]]; then game_path=''; fi
;;
'game_dir')
if [[ $game_key != '' ]]; then
if [ $(printf "$game_dir"| grep -c "$game_key") -gt 0 ]; then
game_dir=$(printf "$game_dir"| \
sed -n "s|^.*\w*$game_key\(.*$\)|$game_key\1|p")
fi
else
if [ $(printf "$game_dir"| grep -c "Program\ Files") -gt 0 ]; then
game_dir=$(printf "$game_dir"| \
sed -En "s|^.*Files( \(x86\))?/(.*)$|\2|p")
# sed -n "s|^.*Files$elf_ext/\(.*\)$|\1|p")
else
game_dir=$(printf "$game_dir"| sed -n "s|^.*drive_c/\(.*\)$|\1|g;p")
fi
fi
;;
'game_exe')
if [[ $game_exe =~ ^.*\.(exe|EXE)$ ]]; then
game_exe=$(printf "$game_exe"| \
sed -En "s|^.*($game_dir)/(.*)([exe|EXE]?)$|\2\3|p")
else
game_exe=''
fi
;;
esac
done
## Extended appears in tab only if extended option check box is setted.
if [ $_extended = 1 ]; then
if ! [[ -e $user_prefix/$bottle_prefix/options.log ]]; then
touch $user_prefix/$bottle_prefix/options.log
fi
for opts in ${reconf_list[@]}; do
_opt_var=$(printf "$opts"| cut -d';' -f3)
_opt_id=$(printf "$opts"| cut -d';' -f2)
eval _var='$'$_opt_var
if [ $_var -gt 0 ]; then
_args+=("-$_opt_id")
fi
if [[ $_listed == TRUE ]]; then _val=1; fi
if [[ $_listed == FALSE ]]; then _val=0; fi
done
if [ $wine_arg_msc ]; then
if [[ $wine_arg_msc != unset ]]; then
## add editable option to args list.
_args+=("$wine_arg_msc")
##* At the point wine args options list is complete and ready to be wrote.
##* Next process is for changes and write of bottle options.log.
## Check if a diff appears between present options and bottle options.log:
## Make of wine_arg_msc a usable list.
msc_arg_list=("$wine_arg_msc")
## Control last modification EPOC time.
if [[ -s $option_log ]]; then
_option_log_mod=$(stat -c %Y $option_log )
else
_option_log_mod=$(date +%s)
fi
## compare previous EPOC check and new EPOC check.
if [ $_option_log_mod -gt $_option_log_pre ]; then
## first, check if elements of wine_arg_msc are not in bottle options menu.
for _mod_line in ${reconf_list[@]}; do
_mod_id=$(printf "$_mod_line"| cut -d";" -f2)
## if option in bottle options menu list is not in wine_arg_msc,
## add it to wine_opts value for config file write.
if [ $(echo "${msc_arg_list[*]}"| grep -c "$_mod_id") -eq 0 ]; then
msc_arg_list+=("-$_mod_opt")
fi
done
fi
##* Now, we need to compare and evaluate if wine_arg_msc elements have to be add to
##* bottle options.log.
for _msc_val in ${msc_arg_list[@]}; do
## create the short tag for wine_arg_msc elements. If element has ponctuation like
## '_' or '-', remove all words before till leaving one unique word. If not
## ponctuation is detected, leave as it is.
if [ $(echo -e "$_msc_val"| egrep -c "[[:punct:]]") -gt 0 ]; then
_msc_short=$(echo -e "$_msc_val"| sed -nE "s/^.*[[:punct:]](\w*[a-z]$)/\1/p")
else
_msc_short="$_msc_val"
fi
## remove all options suffix element to create unique ID per element.
_msc_arg=$(echo -e "$_msc_val"| sed -n "s/^-//p")
_msc_var=("wine_arg_$_msc_short")
## if short tag already exist, number it to make a different ID.
if [[ $(cat $option_log| egrep -c "$_msc_var.*;") -gt 0 && \
$(cat $option_log| egrep -c "$_msc_arg;$_msc_var.*;") -eq 0 ]]; then
_msc_short=$_msc_short"_"$msc_n
_msc_var=("wine_arg_$_msc_short")
msc_n=$[ $msc_n+1 ]
fi
## Final step check if option is not present neither in bottle options.log and
## bottle menu options list, then write it to bottle options.log with a value of
## 0 (not in bottle options menu list yet)
if [ $(cat $option_log| egrep -c "$_msc_arg") -eq 0 ]; then
if [ $(echo "${reconf_list[@]}"| egrep -c "$_msc_arg") -eq 0 ]; then
## last number in file insertion tell if option is add to default menu.
printf "$_msc_short;$_msc_arg;$_msc_var;0\n" >> $option_log
fi
fi
done
else
## if global options value return 0 or 'unset'
_args+=('')
fi
wine_opts="${_args[@]}"
fi
## if tother otions need attention, manage them below
fi
_wine=1
if [ $from_config = 0 ]; then newconf_headers; fi
newconf_wine
}
newconf_wine(){
_section="## Allow extended features for winestarter configurator; off (0), on (1)
_extended=$_extended
## Allow asking for cache memory wipe at winestater boot: off (0), on (1)
## NOTICE: Cache wipe question popup only appear above 60% memory cache used.
cache_wipe=$cache_wipe\n
## default is user's home.
user_prefix=$user_prefix
## game/appli prefix name
bottle_prefix=\"$bottle_prefix\"
## default system path of the game/appli if not in the chosen Wine prefix
game_path=\"$game_path\"
## Full game dir name in Program Files or C: root.
game_dir=\"$game_dir\"
game_exe=\"$game_exe\"
## By default Winestarter set full screen Wine windowed that improve game stability.
## Set windowed mode: false (0), true (1, default)
windowed=$windowed
## set if the app is portable or to be installed in C: drive root: no (0), yes (1).
app_portable=$app_portable
## if classic wine command fail, execute .exe inside the directory
special_cmd=$special_cmd
## wine can use \"start\" command to launch apps or installer from absolute path
## useful on old or recalcitrant buggy app.
start_cmd=$start_cmd
## set a 64 bits bottle: false (0), true (1)
wine_elf=$wine_elf
## WineDbg specials:
## In some case WineDbg crash dialog popups even if finally the managed app launch correctly.
## This option prevent the crash dialog to popup on working apps start: on (1), off (0)
dbg_dialog=$dbg_dialog
## This option let application handles exceptions by itself, then WneDbg only catches exceptions that
## are not handled by the app and could make debbuging a bit easier: on (1), off (0)
dbg_handle=$dbg_handle
## In some apps, it's possible to send extended options at the end of command line.
## It can be some extra DLLs, game map, etc. Add them here.
wine_opts=\"$wine_opts\"
## to lauch winecfg at first launch
w_config=$w_config
## Do not remove or edit below except if you don't use winestarter configurator.
_wine=$_wine"
}
newconf_headers(){
## insert script headers at first config step
conf_headers="#! /bin/bash\n
## Winestarter Configurator
## Fri Feb 10 14:00:00 2017
## Copyright 2017 PirateProd
## <wildtruc@noneltd.net>
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with main.c;if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
## comments with '##' are user help comments
## comments with '#' are unset feature
"
# [[ $code_tag = 0 ]]|| echo -e "$conf_headers" > $TEMP_conf
echo -e "$conf_headers" > $TEMP_conf
}
reconf_wbin(){
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n##### reconf_wbin $e_notif"
## send output datas to local script env.
local ${_out_conf_sets[@]}
## take care that wine_path is not HOME prefix. user_prefix/winebin dir is default, but could
## different as user want.
for _list in ${_out_conf_sets[@]}; do
_var=$(printf "$_list"|cut -d'=' -f1)
_val=$(printf "$_list"|cut -d'=' -f2)
case $_var in
'use_winepath')
if ! [[ $(find /usr/{bin,local/bin} -name wine) ]]; then
use_winepath=1
fi
;;
'wine_path')
_def_val=.winebin
if [[ $_val != $HOME || $_val != $user_prefix/$_def_val ]]; then
_def_val=$(printf "$_val"| sed -n "s/^.*\///p")
_prefix=$(printf "$_val"| sed -E -n "s/^(.*)\/(.*)$/\1/p")
wine_path=$_prefix/$_def_val
else
wine_path=$user_prefix/$_def_val
fi
;;
_hq_stb0|_hq_stg0|_hq_stg1|_hq_stg2|_hq_dev0| _pol_pkg )
if [[ $_val != 'unset' ]]; then
if [[ $_var == _pol_pkg ]]; then wine_ver=$_pol_pkg; wine_pack=0 ;fi
if [[ $_var == _hq_dev0 ]]; then wine_ver=$_hq_dev0; wine_pack=1 ;fi
if [[ $_var == _hq_stb0 ]]; then wine_ver=$_hq_stb0; wine_pack=1 ;fi
if [[ $_var == _hq_stg0 ]]; then wine_ver=$_hq_stg0; wine_pack=1 ;fi
## don't display comments for unexisting listing.
if [[ $_var == _hq_stg1 ]]; then wine_ver=$_hq_stg1; wine_pack=3; cmt1='\n## WineHQ old staging < 2.4 (3)';fi
if [[ $_var == _hq_stg2 ]]; then wine_ver=$_hq_stg2; wine_pack=2; cmt2=', Wine third party staging > 3.6 (2)';fi
wine_ver=$(printf "$wine_ver"| sed -n "s/*$//g;p")
w_config=1
fi
;;
'wine_ver')
if [[ $_val =~ $_def_val$ ]]; then
wine_ver=''
else
wine_ver=$(printf "$_val"| sed -n "s|^.*/||g;p")
fi
;;
'w_config')
# if [ $from_config = 1 ]; then
# if [ $w_config -gt 0 ]; then
# sed -ni "s/^\(w_config\)=[0-9]$/\1=$w_config/g;p" $TEMP_conf
# fi
# fi
if [[ $w_config -gt 0 || $w_config == 'TRUE' ]]; then
sed -Eni "s/^(w_config)=.*$/\1=$w_config/g;p" $TEMP_conf
fi
;;
esac
done
if [ $use_winepath = 1 ]; then _wbin=1; fi
newconf_wbin
}
newconf_wbin(){
_section="## Use a specific Wine path: yes (1), no (0).
use_winepath=$use_winepath
## where is your custom Wine binary, if any
wine_path=\"$wine_path\"
## custom Wine binary name
wine_ver='$wine_ver'
## Which kind of packages do you want to use: (leave empty if already in bin directory)
## PlayOnLinux (0), WineHQ stable/staging/development > 2.4 (1)$cmt1$cmt2
wine_pack=$wine_pack
## Do not remove or edit below except if you don't use winestarter configurator.
_wbin=$_wbin"
# _section="## Use a specific Wine path: yes (1), no (0).
#use_winepath=$use_winepath
### where is your custom Wine binary, if any
#wine_path=\"$wine_path\"
### custom Wine binary name
#wine_ver='$wine_ver'
### Which kind of packages do you want to use: (leave empty if already in bin directory)
### PlayOnLinux (0), WineHQ stable/staging/development > 2.4 (1), WineHQ old staging < 2.4 (2),
### Wine third party staging > 3.3 (3)
#wine_pack=$wine_pack
### Do not remove or edit below except if you don't use winestarter configurator.
#_wbin=$_wbin"
}
reconf_install(){
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n##### reconf_install $e_notif"
M=0
local ${_out_conf_sets[@]}
for _list in ${_out_conf_sets[@]}; do
_var=$(printf "$_list"|cut -d'=' -f1)
_val=$(printf "$_list"|cut -d'=' -f2)
eval _listed='$'$_var
if [[ $_listed =~ ^$HOME[\/]?$ ]]; then
local $_var=''
fi
case $_var in
'w_exe_path')
if [[ $_listed =~ ^.*\.(exe|EXE|msi|MSI)$ ]]; then
if ! [ -s $config_file ]; then
w_install_exe=1
fi
((M++))
fi
;;
'w_tricks_opts')
if [ $_listed = 1 ]; then w_tricks_opts='--no-isolate'; else w_tricks_opts=''; fi
;;
'w_more_pkgs')
# if [[ $_listed ]]; then
if [ $(echo "$_listed"| grep -c "\,") -gt 0 ]; then
w_more_pkgs=$(echo -e "$_listed"| sed -E -n "s/,/\n/g;p")
((M++))
fi
;;
'w_install_dir')
if [[ $w_install_zip ]]; then
if [[ $(printf "$_listed"| egrep -c "^.*-") -gt 0 ]]; then
w_install_dir=$(printf "$_listed"| \
sed -En "s/([[:alnum:]]*)-.*$/\1/;s/^.*\///g;p")
fi
((M++))
else
w_install_dir=''
fi
;;
'w_download_dir')
w_download_dir=$XDG_DOWNLOAD_DIR
;;
esac
if [ $M -gt 0 ]; then
if [[ -s $user_prefix/$bottle_prefix/packages.log ]];then
check=$(printf "$_listed"| sed -n "s/^.*\///g;p")
if [ $(cat $user_prefix/$bottle_prefix/packages.log| grep -wc "$check" ) -gt 0 ]; then
w_install_exe=0
else
w_install_exe=1
fi
else
w_install_exe=1
fi
fi
done
# if [ $M -gt 0 ]; then _install=1; fi
# _install=1
if [ $w_install_exe = 1 ]; then _install=1; else _install=0; fi
newconf_install
}
newconf_install(){
if [[ $w_extra_script == $HOME/ ]]; then w_extra_script=''; fi
_section="## This option allow to install .exe or .msi through winestarter process.
## It's possible to replace file name path by an internet URL for download it.
w_install_exe=$w_install_exe
## Winetricks options, if any
w_tricks_opts='$w_tricks_opts'
## Full path of the software exe/msi file to install
w_exe_path=\"$w_exe_path\"
## Additional associated dlls or app packages list to install (if any)
w_more_pkgs='$w_more_pkgs'
## In some cases, install is provided by extractible or auto-extractible package
## This option will install them in the provided directory to the Program Files path
w_install_zip=\"$w_install_zip\"
## otherwise, you can specify the install dir from the root C: drive.
w_install_dir=\"$w_install_dir\"
## Download dir is the user default one, you can change it here.
w_download_dir=\"$w_download_dir\"
## user script: You can add here a personal or a community script (updater, logs, etc)
## It will be automaticaly pasted in the installed app directory.
## This is very optional and at your own risk
w_extra_script=\"$w_extra_script\"
## Do not remove or edit below except if you don't use winestarter configurator.
_install=$_install"
}
reconf_tricks(){
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n##### reconf_tricks $e_notif"
M=0
local ${_out_conf_sets[@]}
for _list in ${_out_conf_sets[@]}; do
_var=$(printf "$_list"|cut -d'=' -f1)
_val=$(printf "$_list"|cut -d'=' -f2)
eval _listed='$'$_var
if [[ $_var =~ (ie8|ie7|ie6) ]]; then _var="$_var wininet winhttp"; fi
if [[ $_listed = 1 ]]; then
_tricks_var+=("$_var")
fi
done
w_tricks_list_prev=$w_tricks_list
if [[ $w_tricks_list_prev == '' ]]; then
if [ ${#_tricks_var[*]} -gt 0 ]; then
w_install_tricks=1
else
w_install_tricks=0
fi
fi
w_tricks_list=$(echo -e "${_tricks_var[@]}"|tr ' ' ',')
if [[ $w_tricks_list_prev ]]; then
for _prev in ${_tricks_var[@]}; do
if [ $(printf "$w_tricks_list_prev"| grep -c "$_prev") -eq 0 ]; then
_tricks_var_new+=("$_prev")
fi
done
_tricks_list_new=$(echo -e "${_tricks_var_new[@]}"|tr ' ' ',')
# w_tricks_list=$(printf "$w_tricks_list_prev"| sed -E -n "s/^(.*)/\1,$_tricks_list_new/p")
if [ ${#_tricks_var_new[*]} -gt 0 ]; then
w_tricks_list=$(printf "$w_tricks_list_prev"| sed -E -n "s/^(.*)/\1,$_tricks_list_new/p")
w_install_tricks=1
else
w_tricks_list=$w_tricks_list_prev
w_install_tricks=0
fi
fi
if [ $(printf "$w_tricks_list"| grep -c .) -gt 0 ]; then _tricks=1; else _tricks=0; fi
newconf_tricks
}
newconf_tricks(){
_section="## (0) first install launch and prefix creation already set, (1) first launch
w_install_tricks=$w_install_tricks
## Winetricks components list
w_tricks_list=\"$w_tricks_list\"
## Do not remove or edit below except if you don't use winestarter configurator.
_tricks=$_tricks"
}
reconf_reged(){
[[ $code_tag = 0 ]]|| echo -e "$g_notif\n##### reconf_reged $e_notif"
M=0
R=0
unset _reged_var
## extract first here the editable regedit field into a readable list
user_edit=$(echo "$from_output"| grep "HKEY_CURRENT_USER"| cut -d'#' -f2)
local ${_out_conf_sets[@]}
for _list in ${_out_conf_sets[@]}; do
_var=$(printf "$_list"|cut -d'=' -f1)
_val=$(printf "$_list"|cut -d'=' -f2)
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> ${_reged_var[*]} $e_notif"
if ! [[ $_var =~ ^dll*|^mime* ]]; then
if [[ $_var == user_reg ]]; then
if [[ $user_reg =~ ^\[.*\]$ ]]; then unset -v user_reg; _val='unset'; fi
fi
if [[ $_val != unset ]]; then
if [[ $_var == csmt ]]; then
if [[ $_val == enabled ]]; then _val='00000001'; else _val='00000000'; fi
fi
if [[ $_val =~ [0-9]{8} ]]; then
_reged_var+=("\"$_var\"=dword:$_val")
else
_reged_var+=("\"$_var\"=\"$_val\"")
fi
# else
# _reged_unset+=($_var)
fi
else
if [ $_extended = 1 ]; then
if [ $_val != unset ]; then
case $_var in
'Selected_Files')
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> $_var $e_notif"
selected_files_list=( $(echo "$_val"| sed -n "s/,/\n/g;p") )
for Files in ${selected_files_list[@]}; do
if [ $(printf "$local_association"| grep -c .) -gt 0 ]; then
prev_asso="$local_association,"
file_ext=$(printf "$Files"| sed -n "s/^.*\.//g;p")
if [ $(printf "$local_association"| grep -c "$file_ext") -eq 0 ]; then
mime_type=$(xdg-mime query filetype $Files)
if [ $(printf " $mime_type"| grep -c .) -gt 0 ]; then
## define the the reg mime type elements
_filetype=$(printf "$Files"|sed -n "s/^.*\.//g;p")
_doctype=$(printf "$_filetype"|sed -n "s/.*/\U&/p")'file'
## add them to the resource list
res_mime=$HOME/.winestarter/resources/mime-type.lst
if [ $(cat $res_mime |grep -c "_doctype") -eq 0 ]; then
printf "$_filetype:$_doctype:$mime_type\n" >> $res_mime
fi
## add the file extension to the config file type section
FileType_list+=( "$_filetype" )
fi
fi
else
FileType_list+=( $(printf "$Files"|sed -n "s/^.*\.//g;p") )
fi
done
_val=$prev_asso$(printf "${FileType_list[*]}"| tr ' ' ',')
;;
'mime_preset')
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> $_var $e_notif"
mime_preset_list=( "$_val" )
if [ $(printf "$local_association"| grep -c .) -gt 0 ]; then
for preset in ${mime_preset_list[@]}; do
if [ $(printf "$local_association"| grep -c "$preset") -eq 0 ]; then
mime_preset_add+=("$preset")
fi
done
if [ ${#mime_preset_add[@]} -gt 0 ]; then _sep=','; ((M++)); fi
prev_asso="$local_association$_sep"
_val=$prev_asso$(printf "${mime_preset_add[*]}"| tr ' ' ',')
_val=$prev_asso${mime_preset_add[*]}
else
_val=$(echo "$mime_preset"| tr ' ' ','); ((M++))
fi
local local_association=$_val
;;
'dll_reg_type')
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> $_var $e_notif"
if [[ $_val == register ]]; then _reg_class=1; else _reg_class=0; fi; ((R++))
;;
'dll_elf_type')
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> $_var $e_notif"
if [[ $_val == both ]]; then
_reg_elf=2
else
if [[ $_val == wine32 ]];then _reg_elf=0; else _reg_elf=1; fi
fi
;;
'dll_file_list')
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> $_var $e_notif"
if [[ $_val =~ \.(dll|DLL)$ ]]; then
_dlls_list=$(printf "$_val"| tr ',' '\n')
for _dlls in ${_dlls_list[@]}; do
_conf_dlls+=( "$(printf "$_dlls"| sed -n "s/^.*\///g;p")," )
done
[[ $code_tag = 0 ]]|| echo -e "$g_notif >>>>> ${_conf_dlls[@]} $e_notif"
_reg_dlls=$(echo "${_conf_dlls[@]}"| sed -n "s/\ //g;s/\,$//p")
fi
;;
esac
if [ $R -gt 0 ]; then
dll_reg_manager="$_reg_class,$_reg_elf,$_reg_dlls"; ((M++))
else
dll_reg_manager=''
fi
else
local $_var=''
fi
fi
fi
done
if [[ $(printf "$user_edit"| grep -c .) -gt 0 || \
$(printf "$user_edit"| grep -c "option_set") -gt 0 ]]; then
for _new_reg in $(echo -e "$user_edit"); do
## form: "DirectDrawRenderer"="gdi"
## for regex form: (")(DirectDrawRenderer)(")=(")(gdi)(?>:0..1)(")
regex='([\"]?)(\w*)([\"]?)=([\"]?)(\w*)([:[0-9]*]?)([\"]?)$'
_var=$(echo "$_new_reg"| sed -E -n "s/$regex/\2/p")
_val=$(echo "$_new_reg"| sed -E -n "s/$regex/\5\6/p")
## check first if editable values are not previously unset before adding anything to reg.
eval _pre_var='$'$_var
if [[ $_pre_var != unset ]]; then
if [ $(echo "${_reged_var[*]}"| grep -c "$_var" ) -eq 0 ]; then
if [[ $_val =~ dword: ]]; then
_reged_var+=("\"$_var\"=$_val")
else
_reged_var+=("\"$_var\"=\"$_val\"")
fi
fi
fi
done
fi
if [ ${#_reged_var[*]} -gt 0 ]; then
# reg_final=$(echo -e "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]\n${_reged_var[*]}")
reg_final=$(echo -e "[HKEY_CURRENT_USER\\\\\\\Software\\\\\\\Wine\\\\\\\Direct3D]\n${_reged_var[*]}")
((M++))
else
reg_final=''
fi
if [ $M -gt 0 ]; then _reged=1; fi
# _reged=1
newconf_reged
}
newconf_reged(){
_section="## extra wine registry specific entry