-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheasy_e17.sh
executable file
·1521 lines (1385 loc) · 47.1 KB
/
easy_e17.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
#############################################################################
# This script is a result of the ideas from the people of different e #
# channels at irc.freenode.net #
# It will checkout the repository and compile e17. #
# #
# License: BSD licence #
# Get the latest version at http://omicron.homeip.net/projects/#easy_e17.sh #
# Coded by Brian 'morlenxus' Miculcy ([email protected]) #
# #
version="1.4.1" #
version_mark="dev" #
#############################################################################
# Internal variables, run easy_e17.sh --help to get a cleaner way!
tmp_path="/tmp/easy_e17"
logs_path="$tmp_path/install_logs"
status_path="$tmp_path/status"
src_cache_path="$tmp_path/src_cache"
src_path="$HOME/e17_src"
src_url="http://svn.enlightenment.org/svn/e/trunk"
src_rev="HEAD"
conf_files="/etc/easy_e17.conf $HOME/.config/easy_e17/easy_e17.conf $HOME/.easy_e17.conf $PWD/.easy_e17.conf"
efl_basic="efl evas_generic_loaders e_dbus azy elementary"
efl_extra="imlib2 enlil etrophy geneet python-evas python-ecore python-e_dbus python-edje python-emotion python-elementary shellementary"
bin_basic="exchange e"
bin_extra="clouseau e_cho e-type easyui eblock econcentration econnman editje edje_viewer eenvader.fractal efbb emote empower enjoy enki entrance ephoto eskiss espionnage etypers exactness expedite exquisite eyelight rage shotgun terminology"
e_modules_efl="libeweather"
e_modules_bin="emprint exalt"
e_modules_extra="alarm comp-scale cpu deskshow diskio elfe empris engage eooorg everything-aspell everything-mpris everything-pidgin everything-places everything-shotgun everything-skeleton everything-tracker everything-wallpaper everything-websearch eweather exalt-client exebuf execwatch flame forecasts iiirk itask mail mem moon mpdule net news penguins photo places rain rmb screenshot skel slideshow snow taskbar tclock uptime weather winlist-ng winselector wlan"
e_themes="23oz b_and_w darkness detourious efenniht klok"
packages_basic="$efl_basic $bin_basic $e_themes"
packages_half="$efl_basic $bin_basic $e_themes $e_modules_efl $e_modules_bin $e_modules_extra"
packages_full="$efl_basic $efl_extra $bin_basic $e_themes $e_modules_efl $e_modules_bin $e_modules_extra $bin_extra"
packagelist="basic"
packages=$packages_basic
cmd_src_test="svn info"
cmd_src_list="svn list -r"
cmd_src_checkout="svn checkout -r "
cmd_src_update_conflicts_solve="svn update --accept theirs-full -r"
cmd_src_update_conflicts_ask="svn update -r"
src_mode="packages"
ignore_dirs="devs DOCS E16 EXAMPLES TEST web"
autogen_args="" # evas:--enable-gl-x11
linux_distri="" # if your distribution is wrongly detected, define it here
nice_level=0 # nice level (19 == low, -20 == high)
os=$(uname) # operating system
threads=2 # make -j <threads>
deps_bin="automake byacc g++ gcc libtool pkg-config"
deps_dev="dbus-1 fontconfig freetype GL jpeg lua|lua5.1 png rsvg-2 udev xml2 X11 Xext Xrandr xcb"
animation="star"
online_source="http://omicron.homeip.net/projects/easy_e17/easy_e17.sh" # URL of latest stable release
#############################################################################
function logo ()
{
clear
if [ "$version_mark" ]; then
echo -e "\033[1m-------------------------------\033[7m Easy_e17.sh $version-$version_mark \033[0m\033[1m--------------------------\033[0m"
else
echo -e "\033[1m-------------------------------\033[7m Easy_e17.sh $version \033[0m\033[1m------------------------------\033[0m"
fi
echo -e "\033[1m Updates:\033[0m http://omicron.homeip.net/projects/#easy_e17.sh"
echo -e "\033[1m Support:\033[0m #e.de (irc.freenode.net)"
echo -e " [email protected] (Brian 'morlenxus' Miculcy)"
echo -e "\033[1m Patches:\033[0m Generally accepted, please contact me!"
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
echo -e "\033[1m-----------------------------\033[7m Current Configuration \033[0m\033[1m----------------------------\033[0m"
echo " Install path: $install_path"
echo " Logs path: $logs_path"
echo " Source path: $src_path"
echo " Source url: $src_url (Revision: $src_rev)"
echo " Source mode: $src_mode (Packagelist: $packagelist)"
if [ "$linux_distri" ]; then
echo " OS: $os (Distribution: $linux_distri)"
else
echo " OS: $os"
fi
if [ "$skip" ]; then echo " Skipping: $skip"; fi
if [ "$only" ]; then echo " Only: $only"; fi
if [ -z "$action" ]; then action="MISSING!"; fi
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
if [ "$action" == "script" ]; then return; fi
if [ $1 == 0 ]; then
if [ "$2" ]; then
echo -e "\033[1m-------------------------------\033[7m Bad script argument \033[0m\033[1m----------------------------\033[0m"
echo -e " \033[1m$2\033[0m"
fi
else
echo -e "\033[1m--------------------------------\033[7m Build phase $1/3 \033[0m\033[1m-------------------------------\033[0m"
fi
if [ -z "$2" ]; then
case $1 in
0)
if [ "$os" == "not supported" ]; then
echo -e "\033[1m-------------------------------\033[7m Not supported OS \033[0m\033[1m------------------------------\033[0m"
echo " Your operating system '$(uname)' is not supported by this script."
echo " If possible please provide a patch."
else if [ -z "$fullhelp" ]; then
echo -e "\033[1m-----------------\033[7m Short help 'easy_e17.sh <ACTION> <OPTIONS...>' \033[0m\033[1m---------------\033[0m"
echo " -i, --install = install efl+e17"
echo " -u, --update = update your installed software"
echo
echo " --packagelist=<list> = software package list:"
echo " - basic (efl+e17)"
echo " - half (efl+e17+e17modules)"
echo " - full (efl+e17+e17modules+apps)"
echo
echo " --help = full help, many more options"
else
echo -e "\033[1m-----------------\033[7m Full help 'easy_e17.sh <ACTION> <OPTIONS...>' \033[0m\033[1m----------------\033[0m"
echo -e " \033[1mACTION (ONLY SELECT ONE):\033[0m"
echo " -i, --install = install efl+e17"
echo " -u, --update = update installed software"
echo " --only=<name1>,<name2>,... = install ONLY named libs/apps"
echo " --srcupdate = update only the sources"
echo " -v, --check-script-version = check for a newer release of easy_e17"
echo " --help = this help"
echo
echo -e " \033[1mPACKAGELIST:\033[0m"
echo " --packagelist=<listname> = software package list:"
echo " - basic ($packages_basic)"
echo " - half ($packages_half)"
echo " - full ($packages_full)"
echo
echo -e " \033[1mOPTIONS:\033[0m"
echo " --conf=<file> = use an alternate configuration file"
echo " --instpath=<path> = change the default install path"
echo " --srcpath=<path> = change the default source path"
echo " --srcurl=<url> = change the default source url"
echo " --srcmode=<packages/full> = checkout only required package source"
echo " or simply everthing (huge)"
echo " --srcrev=<revision> = set the default source revision"
echo " --asuser = do everything as the user, not as root"
echo " --no-sudopwd = sudo don't need a password..."
echo " -c, --clean = clean the sources before building"
echo " (more --cleans means more cleaning, up"
echo " to a maximum of three, which will"
echo " uninstall e17)"
echo " -s, --skip-srcupdate = don't update sources"
echo " -a, --ask-on-src-conflicts = ask what to do with a conflicting"
echo " source file"
echo " --skip=<name1>,<name2>,... = this will skip installing the named"
echo " libs/apps"
echo " -d, --docs = generate programmers documentation"
echo " --postscript=<name> = full path to a script to run as root"
echo " after installation"
echo " -e, --skip-errors = continue compiling even if there is"
echo " an error"
echo " -w, --wait = don't exit the script after finishing,"
echo " this allows 'xterm -e ./easy_e17.sh -i'"
echo " without closing the xterm"
echo " --anim=<animation> = build animation:"
echo " - star: rotating star (default)"
echo " - weeh: waving man"
echo " -n --disable-notification = disable the osd notification"
echo " -k, --keep = don't delete the temporary dir"
echo
echo " -l, --low = use lowest nice level (19, slowest,"
echo " takes more time to compile, select"
echo " this if you need to work on the pc"
echo " while compiling)"
echo " --normal = default nice level ($nice_level),"
echo " will be automatically used"
echo " -h, --high = use highest nice level (-20, fastest,"
echo " slows down the pc)"
echo " --cache = Use a common configure cache and"
echo " ccache if available"
echo " --threads=<int> = 'make' can use threads, recommended on"
echo " smp systems (default: 2 threads)"
echo " --autogen_args=<n1>:<o1>+<o2>,. = pass some options to autogen:"
echo " <name1>:<opt1>+<opt2>,<name2>:<opt1>+..."
echo " --cflags=<flag1>,<flag2>,... = pass cflags to the gcc"
echo " --ldflags=<flag1>,<flag2>,... = pass ldflags to the gcc"
echo " --pkg_config_path=<path1>,... = pass pkg-config path"
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
echo -e "\033[1m----------------------\033[7m Configurationfile '~/.easy_e17.conf' \033[0m\033[1m--------------------\033[0m"
echo " Just create this file and save your favourite arguments."
echo " Example: If you use a diffent source path, add this line:"
echo " --srcpath=$HOME/enlightenment/e17_src"
fi fi
;;
1)
echo "- running some basic system checks"
echo "- source checkout/update"
;;
2)
echo "- lib-compilation and installation"
echo "- apps-compilation and installation"
;;
3)
echo "- cleaning"
echo "- install notes"
;;
esac
fi
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
echo
}
function define_os_vars ()
{
case $os in
Darwin)
install_path="/opt/e17"
# ldconfig="/sbin/ldconfig" # FIXME: Someone with Darwin seeing this should check availability!
make="make"
export ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I /opt/local/share/aclocal"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig"
export CPPFLAGS="$CPPFLAGS -I/opt/local/include"
export LDFLAGS="$LDFLAGS -Wl,-L/opt/local/lib"
;;
FreeBSD)
install_path="/usr/local/e17"
ldconfig="/sbin/ldconfig"
make="gmake"
export ACLOCAL_FLAGS=" -I /usr/local/share/aclocal"
export CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/X11R6/include -I$install_path/include"
export CFLAGS="$CFLAGS -lintl -liconv -L/usr/local/lib -L/usr/X11R6/lib -L$install_path/lib -I/usr/local/include -I/usr/X11R6/include -I$install_path/include" # FIXME: Someone with FreeBSD seeing this should check if includes are needed here!
export LDFLAGS="$LDFLAGS -lexecinfo"
;;
NetBSD)
install_path="/usr/pkg/e17"
ldconfig="config"
make="make"
export CFLAGS="$CFLAGS -I/usr/pkg/include -I/usr/X11R7/include"
export CPPFLAGS="$CPPFLAGS -I/usr/pkg/include -I/usr/X11R7/include"
export LDFLAGS="$LDFLAGS -L/usr/pkg/include -L/usr/pkg/lib -L/usr/X11R7/lib"
;;
Linux)
install_path="/opt/e17"
ldconfig="/sbin/ldconfig"
make="make"
export CFLAGS="$CFLAGS -fvisibility=hidden"
if [ -z "$linux_distri" ]; then
if [ -e "/etc/debian_version" ]; then linux_distri="debian"; fi
if [ -e "/etc/gentoo-release" ]; then linux_distri="gentoo"; fi
if [ -e "/etc/redhat-release" ]; then linux_distri="redhat"; fi
if [ -e "/etc/SuSE-release" ]; then linux_distri="suse"; fi
fi
;;
SunOS)
install_path="/opt/e17"
ldconfig="$(which crle) -u" # there is no command like ldconfig on solaris! "crle" does nearly the same.
make="make"
;;
*)
os="not supported"
logo 0
set_title
exit 0
;;
esac
}
function find_src_path ()
{
package=$1
subdir=$2
depth=$3
cachefile=$src_cache_path/cache_`echo "$subdir" | tr '/' '_'`
if [ $depth -gt 3 ]; then return; fi
if [ ! -e "$cachefile" ]; then
$cmd_src_list $src_rev "$src_url/$subdir" | egrep "/$" >$cachefile
fi
contents=`cat $cachefile`
for dir in $contents; do
if [ "$dir" == "$package/" ]; then
echo "$subdir/$dir"
return
fi
done
for dir in $contents; do
found=0
for pkg in $packages; do
if [ "$dir" == "$pkg/" ]; then found=1; fi
done
if [ $found == 1 ]; then continue; fi
for idir in $ignore_dirs; do
if [ "$dir" == "$idir/" ]; then found=1; fi
done
if [ $found == 1 ]; then continue; fi
svn_path=`find_src_path $package "$subdir/$dir" $(($depth+1))`
if [ "$svn_path" ]; then
echo "$svn_path"
return
fi
done
}
function find_local_path ()
{
name=$1
path=""
for dir in `find "$src_path" -maxdepth 3 -type d -name "$name" | awk -F "$src_path" '{print $2}'`; do
found=0
for idir in $ignore_dirs; do
topdir=`echo "$dir" | cut -d'/' -f1`
if [ "$topdir" == "$idir" ]; then found=1; fi
done
if [ $found == 1 ]; then continue; fi
if [ "${#dir}" -lt "${#path}" ] || [ -z "$path" ]; then
path=$dir
fi
done
if [ "$path" ]; then echo "$src_path/$path"; fi
}
function backoff_loop
{
src_cmd=$1
backoff=30
attempt=1;
while [ 1 ]; do
$src_cmd | tee -a "$tmp_path/source_update.log"
if [ "${PIPESTATUS[0]}" -gt 0 ]; then
attempt=$(($attempt + 1))
set_title "Source update failed, trying again in $backoff seconds..."
for (( i = $backoff / 2; i > 0; i-- )) do
echo -n -e "\rFAILED! Next attempt $attempt in \033[1m$i\033[0m seconds"
sleep 1
done
echo -n -e "\r \r"
else
break
fi
done
}
function get_src ()
{
cd "$src_path"
if [ "$src_mode" == "packages" ]; then
package=$1
src_path_pkg="$src_path$package"
mkdir -p "$src_path_pkg" 2>/dev/null
if [ "`$cmd_src_test $src_path_pkg &>/dev/null; echo $?`" == 0 ]; then
set_title "Updating sources in '$src_path_pkg' ..."
echo "- updating sources in '$src_path_pkg' ..."
if [ "$ask_on_src_conflicts" ]; then
backoff_loop "$cmd_src_update_conflicts_ask $src_rev $package"
else backoff_loop "$cmd_src_update_conflicts_solve $src_rev $package"; fi
else
set_title "Checkout sources in '$src_path_pkg' ..."
echo "- searching for direct source url for '$package' ..."
path=`find_src_path $package '' 1`
if [ "$path" ]; then
src_url_pkg="$src_url/$path"
echo "- checkout sources in '$src_path_pkg' ..."
backoff_loop "$cmd_src_checkout $src_rev $src_url_pkg $src_path_pkg"
else
echo "- direct source url not found, package moved to OLD/?"
fi
fi
elif [ "$src_mode" == "full" ]; then
if [ "`$cmd_src_test &>/dev/null; echo $?`" == 0 ]; then
set_title "Updating sources in '$src_path' ..."
echo "- updating sources in '$src_path' ..."
if [ "$ask_on_src_conflicts" ]; then
backoff_loop "$cmd_src_update_conflicts_ask $src_rev"
else backoff_loop "$cmd_src_update_conflicts_solve $src_rev"; fi
else
set_title "Checkout sources in '$src_path' ..."
echo "- checkout sources in '$src_path' ..."
backoff_loop "$cmd_src_checkout $src_rev $src_url $src_path"
fi
fi
}
function run_command ()
{
name=$1
path=$2
title=$3
log_title=$4
mode_needed=$5
cmd=$6
set_title "$name: $title ($pkg_pos/$pkg_total)"
echo -n "$log_title"
logfile_banner "$cmd" "$logs_path/$name.log"
if [ $mode_needed == "rootonly" ]; then
mode_needed=$mode
else
if [ $nice_level -ge 0 ]; then
mode_needed="user"
fi
fi
rm -f $status_path/$name.noerrors
case "$mode_needed" in
"sudo")
echo "$sudopwd" | sudo -S PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PYTHONPATH="$PYTHONPATH" \
nice -n $nice_level $cmd >> "$logs_path/$name.log" 2>&1 && touch $status_path/$name.noerrors &
;;
*)
nice -n $nice_level $cmd >> "$logs_path/$name.log" 2>&1 && touch $status_path/$name.noerrors &
;;
esac
pid="$!"
rotate "$pid" "$name"
}
function write_appname ()
{
name=$1
hidden=$2
cnt=${#name}
max=27
if [ "$hidden" ]; then
c=-3
while [ ! $c = $cnt ]; do
echo -n " "
c=$(($c+1))
done
else
echo -n "- $name "
fi
while [ ! $cnt = $max ]; do
echo -n "."
cnt=$(($cnt+1))
done
echo -n " "
}
function compile ()
{
name=$1
write_appname "$name"
for one in $skip; do
if [ "$name" == "$one" ]; then
echo "SKIPPED"
touch $status_path/$name.skipped
return
fi
done
if [ "$only" ] || [ "$action" == "update" ]; then
found=""
for one in $only; do
if [ "$name" == "$one" ]; then found=1; fi
done
if [ -z "$found" ]; then
echo "SKIPPED"
touch $status_path/$name.skipped
return
else
rm -rf $status_path/$name.skipped
fi
fi
pkg_pos=$(($pkg_pos+1))
if [ -e "$status_path/$name.installed" ]; then
echo "previously installed"
return
fi
path=`find_local_path $name`
if [ ! -d "$path" ]; then
echo "SOURCEDIR NOT FOUND"
set_notification "critical" "Package '$name': sourcedir not found"
return
fi
cd "$path"
rm -f "$status_path/$name.noerrors"
rm -f "$logs_path/$name.log"
if [ $clean -ge 1 ]; then
if [ -e "Makefile" ]; then
if [ $clean -eq 1 ]; then
run_command "$name" "$path" "clean" "clean : " "$mode" "$make -j $threads clean"
if [ ! -e "$status_path/$name.noerrors" ]; then
if [ "$skip_errors" ]; then
write_appname "$name" "hidden" # clean might fail, that's ok
else
return
fi
fi
fi
if [ $clean -eq 2 ]; then
run_command "$name" "$path" "distclean" "distcln: " "$mode" "$make -j $threads clean distclean"
if [ ! -e "$status_path/$name.noerrors" ]; then
if [ "$skip_errors" ]; then
write_appname "$name" "hidden" # distclean might fail, that's ok
else
return
fi
fi
fi
if [ $clean -ge 3 ]; then
run_command "$name" "$path" "uninstall" "uninst : " "rootonly" "$make -j $threads uninstall clean distclean"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
# It's no longer installed if we just uninstalled it.
# Even if the uninstall failed, it's best to mark it as uninstalled so that a partial uninstall gets fixed later.
rm -f $status_path/$name.installed
fi
fi
fi
# get autogen arguments
args=""
for app_arg in `echo $autogen_args | tr -s '\,' ' '`; do
app=`echo $app_arg | cut -d':' -f1`
if [ "$app" == "$name" ]; then
args="$args `echo $app_arg | cut -d':' -f2- | tr -s '+' ' '`"
fi
done
if [ -e "autogen.sh" ]; then
run_command "$name" "$path" "autogen" "autogen: " "$mode" "./autogen.sh --prefix=$install_path $accache $args"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
elif [ -e "bootstrap" ]; then
run_command "$name" "$path" "bootstrap" "bootstr: " "$mode" "./bootstrap"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "configure" "config: " "$mode" "./configure --prefix=$install_path $accache $args"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
elif [ -e "Makefile.PL" ]; then
run_command "$name" "$path" "perl" "perl: " "$mode" "perl Makefile.PL prefix=$install_path $args"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
elif [ -e "setup.py" ]; then
run_command "$name" "$path" "python" "python: " "$mode" "python setup.py build build_ext --include-dirs=$PYTHONINCLUDE $args"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "install" "install: " "rootonly" "python setup.py install --prefix=$install_path install_headers --install-dir=$PYTHONINCLUDE"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
elif [ -e "Makefile" ]; then
make_extra="PREFIX=$install_path"
run_command "$name" "$path" "make" "make: " "$mode" "$make $make_extra -j $threads"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
run_command "$name" "$path" "install" "install: " "rootonly" "$make $make_extra install"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
elif [ -e "build.sh" ]; then
run_command "$name" "$path" "build" "build: " "$mode" "./build.sh -i"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
else
echo "no build system"
set_notification "critical" "Package '$name': no build system"
touch $status_path/$name.nobuild
return
fi
if [ "$gen_docs" ]; then
if [ -e "gendoc" ]; then
run_command "$name" "$path" "docs" "docs : " "$mode" "sh gendoc"
if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
fi
fi
# All done, mark it as installed OK.
touch $status_path/$name.installed
rm -f $status_path/$name.noerrors
echo "ok"
set_notification "normal" "Package '$name': build successful"
}
function rotate ()
{
pid=$1
name=$2
animation_state=1
log_line=""
case $animation in
"weeh") echo -n " " ;;
*) echo -n " " ;;
esac
while [ "`ps -p $pid -o comm=`" ]; do
last_line=`tail -1 "$logs_path/$name.log"`
if [ ! "$log_line" = "$last_line" ]; then
case $animation in
"weeh")
# waving man
echo -e -n "\b\b\b\b\b"
case $animation_state in
1)
echo -n "["
echo -n -e "\033[1m"
echo -n "\\o\\"
echo -n -e "\033[0m"
echo -n "]"
animation_state=2
;;
2)
echo -n "["
echo -n -e "\033[1m|o|\033[0m"
echo -n "]"
animation_state=3
;;
3)
echo -n "["
echo -n -e "\033[1m/o/\033[0m"
echo -n "]"
animation_state=4
;;
4)
echo -n "["
echo -n -e "\033[1m|o|\033[0m"
echo -n "]"
animation_state=5
;;
5)
echo -n "["
echo -n -e "\033[1m"
echo -n "\\o/"
echo -n -e "\033[0m"
echo -n "]"
animation_state=6
;;
6)
echo -n "["
echo -n -e "\033[1m|o|\033[0m"
echo -n "]"
animation_state=1
;;
esac
;;
*)
# rotating star
echo -e -n "\b\b\b"
case $animation_state in
1)
echo -n "["
echo -n -e "\033[1m|\033[0m"
echo -n "]"
animation_state=2
;;
2)
echo -n "["
echo -n -e "\033[1m/\033[0m"
echo -n "]"
animation_state=3
;;
3)
echo -n "["
echo -n -e "\033[1m-\033[0m"
echo -n "]"
animation_state=4
;;
4)
echo -n "["
echo -n -e "\033[1m"
echo -n "\\"
echo -n -e "\033[0m"
echo -n "]"
animation_state=1
;;
esac
;;
esac
log_line=$last_line
fi
sleep 1
done
if [ -e "$status_path/$name.noerrors" ]; then
case $animation in
"weeh") del_lines 14 ;;
*) del_lines 12 ;;
esac
else
case $animation in
"weeh") del_lines 5 ;;
*) del_lines 3 ;;
esac
echo -e "\033[1mERROR!\033[0m"
set_notification "critical" "Package '$name': build failed"
if [ ! "$skip_errors" ]; then
set_title "$name: ERROR"
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
echo -e "\033[1m-----------------------------------\033[7m Last loglines \033[0m\033[1m------------------------------\033[0m"
echo -n -e "\033[1m"
tail -25 "$logs_path/$name.log"
echo -n -e "\033[0m"
echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
echo
echo "-> Get more informations by checking the log file '$logs_path/$name.log'!"
echo
# exit script or wait?
if [ "$wait" ]; then
echo
echo -e -n "\033[1mThe script is waiting here - simply press [enter] to exit.\033[0m"
read
fi
set_title
exit 2
fi
fi
}
function del_lines ()
{
cnt=0
max=$1
while [ ! "$cnt" == "$max" ]; do
echo -n -e "\b \b"
cnt=$(($cnt+1))
done
}
function error ()
{
echo -e "\n\n\033[1mERROR: $1\033[0m\n\n"
set_title "ERROR: $1"
set_notification "critical" "Error: $1"
exit 2
}
function set_title ()
{
if [ "$1" ]; then message="- $1"; fi
if [ "$DISPLAY" ]; then
case "$TERM" in
xterm*|rxvt*|Eterm|eterm|Aterm|aterm)
echo -ne "\033]0;Easy_e17.sh $message\007"
;;
esac
fi
}
function set_notification ()
{
if [ -z "$DISPLAY" ] || [ "$notification_disabled" ]; then return; fi
notifier="$install_path/bin/e-notify-send"
urgency=$1
text=$2
if [ -e "$notifier" ]; then
$notifier -u "$urgency" -t 5000 -i "$install_path/share/enlightenment/data/images/enlightenment.png" \
-n "easy_e17.sh" "easy_e17.sh" "$text" &>/dev/null
fi
}
function logfile_banner ()
{
cmd=$1
logfile=$2
echo "-------------------------------------------------------------------------------" >> "$logfile"
echo "EASY_E17 $version CMD: $cmd" >> "$logfile"
echo "-------------------------------------------------------------------------------" >> "$logfile"
}
function cnt_pkgs () {
pkg_total=0
pkg_pos=0
if [ -n "$only" ]; then
pkg_total=`echo "$only" | wc -w`
else
pkg_total=`echo "$packages" | wc -w`
fi
}
function check_script_version ()
{
echo "- local version .............. $version"
echo -n "- downloading script ......... "
remote_version=`wget $online_source -q -U "easy_e17.sh/$version" -O - | grep -m 2 -o [0-9]\.[0-9]\.[0-9] | sort -n | head -n 1`
if [ "$remote_version" ]; then
echo "ok"
echo "- remote version ............. $remote_version"
remote_ver=`echo "$remote_version" | tr -d '.'`
local_ver=`echo "$version" | tr -d '.'`
echo
echo -n "- update available ........... "
if [ $remote_ver -gt $local_ver ]; then
echo -e "\033[1mYES!\033[0m"
else echo "no"; fi
else
echo -e "\033[1mERROR!\033[0m"
fi
}
# SCRIPT:
EASY_PWD=`pwd`
set_title
define_os_vars
accache=""
easy_options=""
command_options=$@
clean=0
# Check for alternate conf file first.
test_options=$command_options
for arg in $test_options; do
option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
if [ "$value" == "$option" ]; then value=""; fi
if [ "$option" == "--conf" ]; then conf_files="$conf_files $value"; fi
done
# remove duplicated configfile entries
for filea in $conf_files; do
exists=0
for fileb in $tmp_conf_files; do
if [ "$filea" == "$fileb" ]; then
exists=1
break
fi
done
if [ $exists -eq 0 ]; then tmp_conf_files="$tmp_conf_files $filea"; fi
done
conf_files=$tmp_conf_files
for file in $conf_files; do
if [ -e "$file" ]; then
# load configfile
for option in `cat "$file"`; do
easy_options="$easy_options $option"
done
fi
done
# append arguments
easy_options="$easy_options $command_options"
# check options
for arg in $easy_options
do
option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
if [ "$value" == "$option" ]; then value=""; fi
# $action can't be set twice
if [ "$action" ]; then
if [ "$option" == "-i" ] ||
[ "$option" == "--install" ] ||
[ "$option" == "-u" ] ||
[ "$option" == "--update" ] ||
[ "$option" == "--only" ] ||
[ "$option" == "--srcupdate" ] ||
[ "$option" == "-v" ] ||
[ "$option" == "--check-script-version" ]; then
logo 0 "Only one action allowed! (currently using '--$action' and '$option')"
exit 1
fi
fi
case "$option" in
-i|--install) action="install" ;;
-u|--update) action="update" ;;
--packagelist)
packagelist=$value
case $value in
"half") packages="$packages_half" ;;
"full") packages="$packages_full" ;;
*) packages="$packages_basic" ;;
esac
;;
--conf) ;; # FIXME
--only)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
action="only"
only="`echo "$value" | tr -s '\,' '\ '` $only"
;;
-v|--check-script-version) action="script" ;;
--srcupdate)
action="srcupdate"
skip="$packages"
;;
--instpath) install_path="$value" ;;
--srcpath) src_path="$value" ;;
--srcurl) src_url="$value" ;;
--srcmode)
case $value in
"packages") src_mode="packages" ;;
"full") src_mode="full" ;;
*) src_mode="packages" ;;
esac
;;
--srcrev)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
src_rev="$value"
;;
--asuser) asuser=1 ;;
--no-sudopwd) no_sudopwd=1 ;;
-c|--clean) clean=$(($clean + 1)) ;;
-d|--docs) gen_docs=1 ;;
--postscript) easy_e17_post_script="$value" ;;
-s|--skip-srcupdate) skip_srcupdate=1 ;;
-a|--ask-on-src-conflicts) ask_on_src_conflicts=1 ;;
--skip)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
skip="`echo "$value" | tr -s '\,' '\ '` $skip"
;;
-e|--skip-errors) skip_errors=1 ;;
-w|--wait) wait=1 ;;
--anim)
case $value in
"weeh") animation="weeh" ;;
*) animation="star" ;;
esac
;;
-n|--disable-notification) notification_disabled=1 ;;
-k|--keep) keep=1 ;;
-l|--low) nice_level=19 ;;
--normal) ;;
-h|--high) nice_level=-20 ;;
--cache)
accache=" --cache-file=$tmp_path/easy_e17.cache"
ccache=`whereis ccache`
if [ ! "$ccache" = "ccache:" ]; then
export CC="ccache gcc"
fi
;;
--threads)
if [ -z "$value" ] || ! expr "$value" : "[0-9]*$" >/dev/null || [ "$value" -lt 1 ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
threads=$value
;;
--autogen_args)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
autogen_args="$value"
;;
--cflags)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
CFLAGS="$CFLAGS `echo "$value" | tr -s '\,' '\ '`"
;;
--ldflags)
if [ -z "$value" ]; then
logo 0 "Missing value for argument '$option'!"
exit 1
fi
LDFLAGS="$LDFLAGS `echo "$value" | tr -s '\,' '\ '`"