-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.tcl.in
1045 lines (933 loc) · 34.9 KB
/
install.tcl.in
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
#install.tcl.in @@
# install.tcl.in
# © Copyright 2007-2013 Christian Rapp <christianrapp@users.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
if {[catch {package require Tcl 8.5}]} {
catch {puts "Program error. You'll need Tcl version 8.5 or higher.
Found version: [info patchlevel]
Have a closer look to the user guide for the system requirements.
If you've installed more than one version of Tcl, the symlink tclsh
might not point to the correct location.
/usr/bin/tclsh is pointing to:
[file readlink /usr/bin/tclsh]
"
}
exit 1
}
#This section sets the variables and values for the installation. All
#necessary changes will be made by the configure tcl script.
set where_is "[file dirname [file dirname [file normalize [file join [info script] bogus]]]]"
set prefix FOO
set eprefix FOO
set bindir FOO
set bintarget FOO
set libdir FOO
set datadir FOO
set mandir FOO
set docdir FOO
set arch FOO
set tktray FOO
set tclkit FOO
set tclkitbin FOO
if {[file exists $where_is/data/release_version.tcl]} {
source $where_is/data/release_version.tcl
} else {
puts "
FATAL ERROR
Could not read file
$where_is/data/release_version.tcl
EXIT 1"
exit 1
}
array set start_options {--uninstall 0 --help 0 --quiet 0}
foreach command_argument $argv {
if {[string first = $command_argument] == -1 } {
set i [string first - $command_argument]
set key $command_argument
set start_options($key) 1
} else {
set i [string first = $command_argument]
set key [string range $command_argument 0 [expr {$i-1}]]
set value [string range $command_argument [expr {$i+1}] end]
set start_options($key) 1
set start_values($key) $value
}
}
if {[array size start_options] != 3} {
puts "
TV-Viewer [lindex $option(release_version) 0] Build [lindex $option(release_version) 1]
unkown option(s): $argv
configuration:
--uninstall uninstall TV-Viewer
--help print this help and exit
--quiet do not print all messages to stdout
"
exit 1
}
if {$start_options(--help)} {
puts "
TV-Viewer [lindex $option(release_version) 0] Build [lindex $option(release_version) 1]
configuration:
--uninstall uninstall TV-Viewer
--help print this help and exit
--quiet do not print all messages to stdout
"
exit 0
}
proc agrep {switch input modifier} {
foreach line [split "$input" \n] {
if {"$switch" == "-m"} {
if {[string match -nocase *$modifier "$line"] || [string match -nocase *$modifier* "$line"] || [string match -nocase $modifier* "$line"]} {
lappend return_value "$line"
}
}
if {"$switch" == "-w"} {
if {[lsearch "$line" "$modifier"] != -1} {
lappend return_value "$line"
}
}
}
if {[info exists return_value]} {
if {[llength $return_value] > 1} {
set return_value [join $return_value \n]
return -code 0 "$return_value"
} else {
set return_value [join $return_value]
return -code 0 "$return_value"
}
} else {
return -code 1 "agrep could not find $modifier in $input"
}
}
proc install_uninstall {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch tktray tclkit tclkitbin} {
if {[file isdirectory "$datadir/tv-viewer/"]} {
set status_uninstall [catch {file delete -force -- pathname "$datadir/tv-viewer/"} resultat_uninstall]
if { $status_uninstall != 0} {
puts "
can't uninstall TV-Viewer
$resultat_uninstall
folder is owned by [file attributes $datadir/tv-viewer/ -owner]
you are $::tcl_platform(user)
"
exit 1
} else {
foreach symlink {tv-viewer tv-viewer_lirc tv-viewer_recext tv-viewer_diag tv-viewer_scheduler} {
catch {file delete -force "$bindir/$symlink"}
}
catch {file delete -force "$datadir/applications/tv-viewer.desktop"}
catch {file delete -force "$datadir/pixmaps/tv-viewer.png"}
catch {file delete -force "$mandir/man1/tv-viewer.1.gz"}
catch {file delete -force "$docdir/README"}
if {$tktray} {
set tray {tktray1.2 tktray1.3.3 tktray1.3.8 tktray1.3.9}
foreach elem $tray {
if {[file exists "$libdir/$elem/tv_extension.tcl"]} {
catch {file delete -force -- pathname "$libdir/$elem"}
}
}
}
puts "TV-Viewer has been uninstalled successfully
config directory is still present in your home directory"
exit 0
}
} else {
puts "TV-Viewer is not installed!"
exit 1
}
}
proc install_welcomeMsg {} {
puts "
installation of TV-Viewer [lindex $::option(release_version) 0] Build [lindex $::option(release_version) 1]
"
}
proc install_checkScheduler {} {
set status_schedlinkread [catch {file readlink "$::env(HOME)/.tv-viewer/tmp/scheduler_lockfile.tmp"} resultat_schedlinkread]
if {$status_schedlinkread == 0} {
catch {exec ps -eo "%p"} read_ps
set status_greppid_sched [catch {agrep -w "$read_ps" $resultat_schedlinkread} resultat_greppid_sched]
if { $status_greppid_sched == 0 } {
puts "scheduler is running, will stop it"
after 1000
catch {exec kill $resultat_schedlinkread}
catch {file delete "$::option(where_is_home)/tmp/scheduler_lockfile.tmp"}
}
}
}
proc install_createFolders {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set dir_list [list "$datadir/tv-viewer/" "$datadir/tv-viewer/data/" "$datadir/tv-viewer/extensions/" "$datadir/tv-viewer/extensions/autoscroll/" "$datadir/tv-viewer/extensions/callib/" "$datadir/tv-viewer/extensions/fsdialog/" "$datadir/tv-viewer/extensions/tclkit/" "$datadir/tv-viewer/icons/" "$datadir/tv-viewer/icons/16x16/" "$datadir/tv-viewer/icons/22x22/" "$datadir/tv-viewer/icons/32x32/" "$datadir/tv-viewer/icons/extras/" "$datadir/tv-viewer/license/" "$datadir/tv-viewer/msgs/" "$datadir/tv-viewer/themes/" "$datadir/tv-viewer/themes/plastik/" "$datadir/tv-viewer/themes/plastik/plastik/" "$datadir/tv-viewer/themes/keramik/" "$datadir/tv-viewer/themes/keramik/keramik/" "$datadir/tv-viewer/themes/keramik/keramik_alt/"]
if {[file isdirectory "$datadir/tv-viewer"]} {
set status_dir [catch {file delete -force -- pathname "$datadir/tv-viewer/"} result_dir]
if {$status_dir != 0} {
puts "
can't erase folder
$result_dir
folder is owned by [file attributes $datadir/tv-viewer/ -owner]
you are $::tcl_platform(user).
"
exit 1
} else {
foreach dir $dir_list {
file mkdir "$dir"
}
puts -nonewline "
creating folders"
}
} else {
puts -nonewline "
creating folders"
foreach dir $dir_list {
set status_dir [catch {file mkdir "$dir"} result_dir]
if {$status_dir != 0} {
puts "
can't create necessary folder: $dir
$result_dir
you probably have to be root
"
exit 1
}
}
}
puts -nonewline "\rprocessing folders \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyData {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set filelist [lsort [glob "$where_is/data/*"]]
set delements [expr [llength $filelist] + 1]
set pincr [format %.2f [expr 100.0 / $delements.0]]
set percentage 0
foreach dfile [file normalize $filelist ] {
if {[string match *tv-viewer.desktop "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"]} {
# do not copy file tv-viewer.desktop to data folder, because it has not to be there
continue
}
set status_dfile [catch {file copy -force "$dfile" "$datadir/tv-viewer/data/"} resultat_dfile]
if { $status_dfile != 0 } {
puts "
could not copy file: $dfile
$resultat_dfile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing data \[${percentage}%\]\033\[K"
flush stdout
if {[string match *diag_runtime* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *lirc_emitter* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *scheduler* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *recorder* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *record_external* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *tv-viewer_main* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"] || [string match *notifyd* "$datadir/tv-viewer/data/[lindex [file split $dfile] end]"]} {
set status_permissions_dfile [catch {file attributes "$datadir/tv-viewer/data/[lindex [file split $dfile] end]" -permissions rwxr-xr-x} resultat_permissions_dfile]
} else {
set status_permissions_dfile [catch {file attributes "$datadir/tv-viewer/data/[lindex [file split $dfile] end]" -permissions rw-r--r--} resultat_permissions_dfile]
}
if {$status_permissions_dfile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/data/[lindex [file split $dfile] end]
$resultat_permissions_dfile"
exit 1
}
after 10
}
}
if {[file isdirectory "$datadir/applications"] == 0} {
file mkdir "$datadir/applications/"
}
set status_desktop [catch {file copy -force "$where_is/data/tv-viewer.desktop" "$datadir/applications/"} result_desktop]
if { $status_desktop != 0 } {
puts "
could not copy file: $where_is/data/tv-viewer.desktop
$result_desktop
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing data \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_desktop [catch {file attributes "$datadir/applications/tv-viewer.desktop" -permissions rw-r--r--} resultat_permissions_desktop]
if {$status_permissions_desktop != 0} {
puts "
could not change permissions for: $datadir/applications/tv-viewer.desktop
$resultat_permissions_desktop"
exit 1
}
}
puts -nonewline "\rprocessing data \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyExtensions {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch tktray} {
if {$tktray} {
set filelist_tray [lsort [glob "$where_is/extensions/tktray/$arch/*"]]
} else {
set filelist_tray ""
}
set filelist_scroll [lsort [glob "$where_is/extensions/autoscroll/*"]]
set filelist_cal [lsort [glob "$where_is/extensions/callib/*"]]
set filelist_fsd [lsort [glob "$where_is/extensions/fsdialog/*"]]
set elements [expr [llength $filelist_tray] + [llength $filelist_scroll] + [llength $filelist_cal] + [llength $filelist_fsd]]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
if {$tktray} {
set tray {tktray1.2 tktray1.3.3 tktray1.3.8 tktray1.3.9}
foreach elem $tray {
if {[file exists "$libdir/$elem/tv_extension.tcl"]} {
catch {file delete -force -- pathname "$libdir/$elem"}
}
}
file mkdir "$libdir/tktray1.3.9/"
if {$arch == 32} {
foreach tfile32 [file normalize $filelist_tray] {
set status_tfile32 [catch {file copy -force "$tfile32" "$libdir/tktray1.3.9/"} resultat_tfile32]
if { $status_tfile32 != 0 } {
puts "
could not copy file: $tfile32
$resultat_tfile32
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing extensions \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_tfile32 [catch {file attributes "$libdir/tktray1.3.9/[lindex [file split $tfile32] end]" -permissions rwxr-xr-x} resultat_permissions_tfile32]
if {$status_permissions_tfile32 != 0} {
puts "
could not change permissions for: $libdir/tktray1.3.9/[lindex [file split $tfile32] end]
$resultat_permissions_tfile32"
exit 1
}
}
after 10
}
}
if {$arch == 64} {
foreach tfile64 [file normalize $filelist_tray] {
set status_tfile64 [catch {file copy -force "$tfile64" "$libdir/tktray1.3.9/"} resultat_tfile64]
if { $status_tfile64 != 0 } {
puts "
could not copy file: $tfile64
$resultat_tfile64
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing extensions \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_tfile64 [catch {file attributes "$libdir/tktray1.3.9/[lindex [file split $tfile64] end]" -permissions rwxr-xr-x} resultat_permissions_tfile64]
if {$status_permissions_tfile64 != 0} {
puts "
could not change permissions for: $libdir/tktray1.3.9/[lindex [file split $tfile64] end]
$resultat_permissions_tfile64"
exit 1
}
}
after 10
}
}
}
foreach aufile [file normalize $filelist_scroll] {
set status_aufile [catch {file copy -force "$aufile" "$datadir/tv-viewer/extensions/autoscroll/"} resultat_aufile]
if { $status_aufile != 0 } {
puts "
could not copy file: $aufile
$resultat_aufile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing extensions \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_aufile [catch {file attributes "$datadir/tv-viewer/extensions/autoscroll/[lindex [file split $aufile] end]" -permissions rwxr-xr-x} resultat_permissions_aufile]
if {$status_permissions_aufile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/extensions/autoscroll/[lindex [file split $aufile] end]
$resultat_permissions_aufile"
exit 1
}
}
after 10
}
foreach calfile [file normalize $filelist_cal] {
set status_calfile [catch {file copy -force "$calfile" "$datadir/tv-viewer/extensions/callib/"} resultat_calfile]
if { $status_calfile != 0 } {
puts "
could not copy file: $calfile
$resultat_calfile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing extensions \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_calfile [catch {file attributes "$datadir/tv-viewer/extensions/callib/[lindex [file split $calfile] end]" -permissions rwxr-xr-x} resultat_permissions_calfile]
if {$status_permissions_calfile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/extensions/callib/[lindex [file split $calfile] end]
$resultat_permissions_calfile"
exit 1
}
}
after 10
}
foreach fsfile [file normalize $filelist_fsd] {
set status_fsfile [catch {file copy -force "$fsfile" "$datadir/tv-viewer/extensions/fsdialog/"} resultat_fsfile]
if { $status_fsfile != 0 } {
puts "
could not copy file: $fsfile
$resultat_fsfile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing extensions \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_fsfile [catch {file attributes "$datadir/tv-viewer/extensions/fsdialog/[lindex [file split $fsfile] end]" -permissions rwxr-xr-x} resultat_permissions_fsfile]
if {$status_permissions_fsfile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/extensions/fsdialog/[lindex [file split $fsfile] end]
$resultat_permissions_fsfile"
exit 1
}
}
after 10
}
puts -nonewline "\rprocessing extensions \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyIcons {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set filelist_ico16 [lsort [glob "$where_is/icons/16x16/*"]]
set filelist_ico22 [lsort [glob "$where_is/icons/22x22/*"]]
set filelist_ico32 [lsort [glob "$where_is/icons/32x32/*"]]
set filelist_icoex [lsort [glob "$where_is/icons/extras/*"]]
set elements [expr [llength $filelist_ico16] + [llength $filelist_ico22] + [llength $filelist_ico32] + [llength $filelist_icoex] + 1]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
foreach ifile [file normalize $filelist_ico16] {
set status_ifile [catch {file copy -force "$ifile" "$datadir/tv-viewer/icons/16x16/"} resultat_ifile]
if { $status_ifile != 0 } {
puts "
could not copy file: $ifile
$resultat_ifile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing icons \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_ifile [catch {file attributes "$datadir/tv-viewer/icons/16x16/[lindex [file split $ifile] end]" -permissions rw-r--r--} resultat_permissions_ifile]
if {$status_permissions_ifile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/icons/16x16/[lindex [file split $ifile] end]
$resultat_permissions_ifile"
exit 1
}
}
after 10
}
foreach ifile [file normalize $filelist_ico22] {
set status_ifile [catch {file copy -force "$ifile" "$datadir/tv-viewer/icons/22x22/"} resultat_ifile]
if { $status_ifile != 0 } {
puts "
could not copy file: $ifile
$resultat_ifile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing icons \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_ifile [catch {file attributes "$datadir/tv-viewer/icons/22x22/[lindex [file split $ifile] end]" -permissions rw-r--r--} resultat_permissions_ifile]
if {$status_permissions_ifile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/icons/22x22/[lindex [file split $ifile] end]
$resultat_permissions_ifile"
exit 1
}
}
after 10
}
foreach ifile [file normalize $filelist_ico32] {
set status_ifile [catch {file copy -force "$ifile" "$datadir/tv-viewer/icons/32x32/"} resultat_ifile]
if { $status_ifile != 0 } {
puts "
could not copy file: $ifile
$resultat_ifile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing icons \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_ifile [catch {file attributes "$datadir/tv-viewer/icons/32x32/[lindex [file split $ifile] end]" -permissions rw-r--r--} resultat_permissions_ifile]
if {$status_permissions_ifile != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/icons/32x32/[lindex [file split $ifile] end]
$resultat_permissions_ifile"
exit 1
}
}
after 10
}
foreach ifile [file normalize $filelist_icoex] {
set status_ifile [catch {file copy -force "$ifile" "$datadir/tv-viewer/icons/extras/"} resultat_ifile]
if { $status_ifile != 0 } {
puts "
could not copy file: $ifile
$resultat_ifile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing icons \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_ifile [catch {file attributes "$datadir/tv-viewer/icons/extras/[lindex [file split $ifile] end]" -permissions rw-r--r--} resultat_permissions_ifile]
if {$status_permissions_ifile != 0} {
puts "
Could not change permissions for: $datadir/tv-viewer/icons/extras/[lindex [file split $ifile] end]
Error message: $resultat_permissions_ifile"
exit 1
}
}
after 10
}
if {[file isdirectory "$datadir/pixmaps/"] == 0} {
file mkdir "$datadir/pixmaps/"
}
set status_tvicon [catch {file copy -force "$where_is/icons/extras/tv-viewer_icon.png" "$datadir/pixmaps/"} result_tvicon]
if { $status_tvicon != 0 } {
puts "
could not copy file: $where_is/icons/extras/tv-viewer_icon.png
$result_tvicon
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing icons \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_tvicon [catch {file attributes "$datadir/pixmaps/tv-viewer_icon.png" -permissions rw-r--r--} resultat_permissions_tvicon]
if {$status_permissions_tvicon != 0} {
puts "
could not change permissions for: $datadir/pixmaps/tv-viewer_icon.png
$resultat_permissions_tvicon"
exit 1
}
catch {file rename -force "$datadir/pixmaps/tv-viewer_icon.png" "$datadir/pixmaps/tv-viewer.png"}
}
puts -nonewline "\rprocessing icons \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyLicense {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set filelist [glob "$where_is/license/*"]
set elements [llength $filelist]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
foreach lfile $filelist {
set status_file_lic [catch {file copy -force "$lfile" "$datadir/tv-viewer/license/"} resultat_file_lic]
if { $status_file_lic != 0 } {
puts "
Could not copy file: $lfile
Error message: $resultat_file_lic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing license informations \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_lfile [catch {file attributes "$datadir/tv-viewer/license/[lindex [file split $lfile] end]" -permissions rw-r--r--} resultat_permissions_lfile]
if {$status_permissions_lfile != 0} {
puts "
Could not change permissions for: $datadir/tv-viewer/license/[lindex [file split $lfile] end]
Error message: $resultat_permissions_lfile"
exit 1
}
}
after 10
}
puts -nonewline "\rprocessing license informations \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyMan {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
if {[file isdirectory "$mandir/man1"] == 0} {
file mkdir "$mandir/man1/"
}
set status_file_man [catch {file copy -force "$where_is/man/tv-viewer.1.gz" "$mandir/man1/"} resultat_file_man]
if { $status_file_man != 0 } {
puts "
could not copy file: $where_is/man/tv-viewer.1.gz
$resultat_file_man
"
exit 1
}
if {[file isdirectory "$docdir/"] == 0} {
file mkdir "$docdir/"
}
set status_file_doc [catch {file copy -force "$where_is/README" "$docdir/README"} resultat_file_doc]
if { $status_file_doc != 0 } {
puts "
could not copy file: $where_is/README
$resultat_file_doc
"
exit 1
}
puts -nonewline "\rprocessing manpage / doc \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyMsgs {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set filelist_msg [lsort [glob -directory "$where_is/msgs" *.msg *.txt]]
set elements [llength $filelist_msg]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
foreach mfile [file normalize $filelist_msg] {
set status_mfile [catch {file copy -force "$mfile" "$datadir/tv-viewer/msgs/"} resultat_mfile]
if { $status_mfile != 0 } {
puts "
could not copy file: $mfile
$resultat_mfile
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing language files \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_mfile [catch {file attributes "$datadir/tv-viewer/msgs/[lindex [file split $mfile] end]" -permissions rw-r--r--} resultat_permissions_mfile]
if {$status_permissions_mfile != 0} {
puts "
Could not change permissions for: $datadir/tv-viewer/msgs/[lindex [file split $mfile] end]
Error message: $resultat_permissions_mfile"
exit 1
}
}
after 10
}
puts -nonewline "\rprocessing language files \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyThemes {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch} {
set filelist_plt [lsort [glob "$where_is/themes/plastik/*.tcl"]]
set filelist_plg [lsort [glob "$where_is/themes/plastik/plastik/*.gif"]]
set filelist_ket [lsort [glob "$where_is/themes/keramik/*.tcl"]]
set filelist_keg [lsort [glob "$where_is/themes/keramik/keramik/*.gif"]]
set filelist_keag [lsort [glob "$where_is/themes/keramik/keramik_alt/*.gif"]]
set elements [expr [llength $filelist_plt] + [llength $filelist_plg] + [llength $filelist_ket] + [llength $filelist_keg] + [llength $filelist_keag]]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
foreach plastik [file normalize $filelist_plt] {
set status_file_plastik [catch {file copy -force "$plastik" "$datadir/tv-viewer/themes/plastik/"} resultat_file_plastik]
if { $status_file_plastik != 0 } {
puts "
could not copy file: $plastik
$resultat_file_plastik
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing themes \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_plastik [catch {file attributes "$datadir/tv-viewer/themes/plastik/[lindex [file split $plastik] end]" -permissions rwxr-xr-x} resultat_permissions_plastik]
if {$status_permissions_plastik != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/themes/plastik/[lindex [file split $plastik] end]
$resultat_permissions_plastik"
exit 1
}
}
after 10
}
foreach plastik [file normalize $filelist_plg] {
set status_file_plastik [catch {file copy -force "$plastik" "$datadir/tv-viewer/themes/plastik/plastik/"} resultat_file_plastik]
if { $status_file_plastik != 0 } {
puts "
could not copy file: $plastik
$resultat_file_plastik
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing themes \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_plastik [catch {file attributes "$datadir/tv-viewer/themes/plastik/plastik/[lindex [file split $plastik] end]" -permissions rw-r--r--} resultat_permissions_plastik]
if {$status_permissions_plastik != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/themes/plastik/plastik/[lindex [file split $plastik] end]
$resultat_permissions_plastik"
exit 1
}
}
after 10
}
foreach keramik [file normalize $filelist_ket] {
set status_file_keramik [catch {file copy -force "$keramik" "$datadir/tv-viewer/themes/keramik/"} resultat_file_keramik]
if { $status_file_keramik != 0 } {
puts "
could not copy file: $keramik
$resultat_file_keramik
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing themes \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_keramik [catch {file attributes "$datadir/tv-viewer/themes/keramik/[lindex [file split $keramik] end]" -permissions rwxr-xr-x} resultat_permissions_keramik]
if {$status_permissions_keramik != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/themes/keramik/[lindex [file split $keramik] end]
$resultat_permissions_keramik"
exit 1
}
}
after 10
}
foreach keramik [file normalize $filelist_keg] {
set status_file_keramik [catch {file copy -force "$keramik" "$datadir/tv-viewer/themes/keramik/keramik/"} resultat_file_keramik]
if { $status_file_keramik != 0 } {
puts "
could not copy file: $keramik
$resultat_file_keramik
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing themes \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_keramik [catch {file attributes "$datadir/tv-viewer/themes/keramik/keramik/[lindex [file split $keramik] end]" -permissions rwxr-xr-x} resultat_permissions_keramik]
if {$status_permissions_keramik != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/themes/keramik/keramik/[lindex [file split $keramik] end]
$resultat_permissions_keramik"
exit 1
}
}
after 10
}
foreach keramik [file normalize $filelist_keag] {
set status_file_keramik [catch {file copy -force "$keramik" "$datadir/tv-viewer/themes/keramik/keramik_alt/"} resultat_file_keramik]
if { $status_file_keramik != 0 } {
puts "
could not copy file: $keramik
$resultat_file_keramik
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing themes \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_keramik [catch {file attributes "$datadir/tv-viewer/themes/keramik/keramik_alt/[lindex [file split $keramik] end]" -permissions rwxr-xr-x} resultat_permissions_keramik]
if {$status_permissions_keramik != 0} {
puts "
could not change permissions for: $datadir/tv-viewer/themes/keramik/keramik_alt/[lindex [file split $keramik] end]
$resultat_permissions_keramik"
exit 1
}
}
after 10
}
puts -nonewline "\rprocessing themes \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_copyTclkit {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch tclkit tclkitbin} {
set filelist [list "$where_is/extensions/tclkit/$tclkitbin" "$where_is/extensions/tclkit/tclkitstarter.sh"]
set elements [llength $filelist]
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
foreach tcfile $filelist {
# be carefull, different way of copying files. using system cp \
command, because of possible vfs.
set status_file_tc [catch {exec cp -f "$tcfile" "$datadir/tv-viewer/extensions/tclkit"} resultat_file_tc]
if { $status_file_tc != 0 } {
puts "
Could not copy file: $tcfile
Error message: $resultat_file_tc
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing tclkit \[${percentage}%\]\033\[K"
flush stdout
set status_permissions_tcfile [catch {file attributes "$datadir/tv-viewer/extensions/tclkit/[lindex [file split $tcfile] end]" -permissions rwxr-xr-x} resultat_permissions_tcfile]
if {$status_permissions_tcfile != 0} {
puts "
Could not change permissions for: $datadir/tv-viewer/extensions/tclkit/[lindex [file split $tcfile] end]
Error message: $resultat_permissions_tcfile"
exit 1
}
}
after 10
}
puts -nonewline "\rprocessing tclkit \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_createSymbolic {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch tclkit tclkitbin} {
catch {file delete -force "$bindir/tv-viewer" "$bindir/tv-viewer_diag" "$bindir/tv-viewer_lirc" "$bindir/tv-viewer_recext" "$bindir/tv-viewer_scheduler"}
if {[file isdirectory "$bindir"] == 0} {
file mkdir "$bindir/"
}
set elements 5
set pincr [format %.2f [expr 100.0 / $elements.0]]
set percentage 0
if {$tclkit == 1} {
catch {exec ln -s "$bintarget/extensions/tclkit/tclkitstarter.sh" "$bindir/tv-viewer"}
} else {
catch {exec ln -s "$bintarget/data/tv-viewer_main.tcl" "$bindir/tv-viewer"}
}
set status_symbolic [catch {file link "$bindir/tv-viewer"} resultat_symbolic]
if { $status_symbolic != 0 } {
puts "
could not create symbolic link 'tv-viewer'.
$resultat_symbolic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing symbolic links \[${percentage}%\]\033\[K"
flush stdout
after 25
}
if {$tclkit == 1} {
catch {exec ln -s "$bintarget/extensions/tclkit/tclkitstarter.sh" "$bindir/tv-viewer_diag"}
} else {
catch {exec ln -s "$bintarget/data/diag_runtime.tcl" "$bindir/tv-viewer_diag"}
}
set status_symbolic [catch {file link "$bindir/tv-viewer_diag"} resultat_symbolic]
if { $status_symbolic != 0 } {
puts "
could not create symbolic link 'tv-viewer_diag'.
$resultat_symbolic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing symbolic links \[${percentage}%\]\033\[K"
flush stdout
after 25
}
if {$tclkit == 1} {
catch {exec ln -s "$bintarget/extensions/tclkit/tclkitstarter.sh" "$bindir/tv-viewer_lirc"}
} else {
catch {exec ln -s "$bintarget/data/lirc_emitter.tcl" "$bindir/tv-viewer_lirc"}
}
set status_symbolic [catch {file link "$bindir/tv-viewer_lirc"} resultat_symbolic]
if { $status_symbolic != 0 } {
puts "
could not create symbolic link 'tv-viewer_lirc'.
$resultat_symbolic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing symbolic links \[${percentage}%\]\033\[K"
flush stdout
after 25
}
if {$tclkit == 1} {
catch {exec ln -s "$bintarget/extensions/tclkit/tclkitstarter.sh" "$bindir/tv-viewer_recext"}
} else {
catch {exec ln -s "$bintarget/data/record_external.tcl" "$bindir/tv-viewer_recext"}
}
set status_symbolic [catch {file link "$bindir/tv-viewer_recext"} resultat_symbolic]
if { $status_symbolic != 0 } {
puts "
could not create symbolic link 'tv-viewer_recext'.
$resultat_symbolic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing symbolic links \[${percentage}%\]\033\[K"
flush stdout
after 25
}
if {$tclkit == 1} {
catch {exec ln -s "$bintarget/extensions/tclkit/tclkitstarter.sh" "$bindir/tv-viewer_scheduler"}
} else {
catch {exec ln -s "$bintarget/data/scheduler.tcl" "$bindir/tv-viewer_scheduler"}
}
set status_symbolic [catch {file link "$bindir/tv-viewer_scheduler"} resultat_symbolic]
if { $status_symbolic != 0 } {
puts "
could not create symbolic link 'tv-viewer_scheduler'.
$resultat_symbolic
"
exit 1
} else {
set percentage [format %.2f [expr $percentage + $pincr]]
puts -nonewline "\rprocessing symbolic links \[${percentage}%\]\033\[K"
flush stdout
after 25
}
puts -nonewline "\rprocessing symbolic links \[\033\[0;1;32mDONE\033\[0m\]\033\[K"
flush stdout
}
proc install_steps {where_is prefix eprefix bindir bintarget libdir datadir mandir docdir arch tktray tclkit tclkitbin} {
install_welcomeMsg
after 500
install_checkScheduler
install_createFolders $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch
after 100
puts -nonewline "
processing data \[00%\]"
after 100
install_copyData $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch
puts -nonewline "
processing extensions \[00%\]"
after 100
install_copyExtensions $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch $tktray
puts -nonewline "
processing icons \[00%\]"
after 1250
install_copyIcons $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch
puts -nonewline "
processing licenses \[00%\]"
after 100
install_copyLicense $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch
puts -nonewline "
processing man page \[00%\]"
after 100
install_copyMan $where_is $prefix $eprefix $bindir $bintarget $libdir $datadir $mandir $docdir $arch
puts -nonewline "
processing language files \[00%\]"
after 100