PageRenderTime 65ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/easy-e17/easy_e17.sh

https://bitbucket.org/kaendfinger/aur-mirror
Shell | 1522 lines | 1347 code | 136 blank | 39 comment | 282 complexity | d1a83fccac1ded91003874251e7a1242 MD5 | raw file
Possible License(s): LGPL-2.0, Unlicense, AGPL-1.0, BitTorrent-1.0, EPL-1.0, GPL-3.0, BSD-3-Clause, GPL-2.0, MIT, CC-BY-SA-3.0, BSD-2-Clause, MPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, JSON, AGPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0, LGPL-2.1, ISC, CC-BY-3.0, WTFPL, 0BSD, CC0-1.0, LGPL-3.0, Cube, Apache-2.0
  1. #!/usr/bin/env bash
  2. #############################################################################
  3. # This script is a result of the ideas from the people of different e #
  4. # channels at irc.freenode.net #
  5. # It will checkout the repository and compile e17. #
  6. # #
  7. # License: BSD licence #
  8. # Get the latest version at http://omicron.homeip.net/projects/#easy_e17.sh #
  9. # Coded by Brian 'morlenxus' Miculcy (morlenxus@gmx.net) #
  10. # #
  11. version="1.4.1" #
  12. version_mark="dev" #
  13. #############################################################################
  14. # Internal variables, run easy_e17.sh --help to get a cleaner way!
  15. tmp_path="/tmp/easy_e17"
  16. logs_path="$tmp_path/install_logs"
  17. status_path="$tmp_path/status"
  18. src_cache_path="$tmp_path/src_cache"
  19. src_path="$HOME/e17_src"
  20. src_url="https://svn.enlightenment.org/svn/e/trunk"
  21. src_rev="HEAD"
  22. conf_files="/etc/easy_e17.conf $HOME/.config/easy_e17/easy_e17.conf $HOME/.easy_e17.conf $PWD/.easy_e17.conf"
  23. efl_basic="efl evas_generic_loaders ecore edbus e_dbus efreet eio eeze edje azy ethumb elementary"
  24. efl_extra="imlib2 emotion enlil ephysics etrophy libast python-evas python-ecore python-e_dbus python-edje python-emotion python-elementary shellementary"
  25. bin_basic="exchange e"
  26. bin_extra="clouseau e_cho e-type eblock econcentration econnman editje edje_viewer eenvader.fractal efbb efx emote empower enjoy enki entrance ephoto eskiss espionnage Eterm etypers exactness expedite exquisite eyelight rage terminology"
  27. e_modules_efl="libeweather"
  28. e_modules_bin="emprint exalt"
  29. e_modules_extra="alarm comp-scale cpu deskshow diskio eektool 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"
  30. e_themes="23oz b_and_w darkness detourious efenniht"
  31. packages_basic="$efl_basic $bin_basic $e_themes"
  32. packages_half="$efl_basic $bin_basic $e_themes $e_modules_efl $e_modules_bin $e_modules_extra"
  33. packages_full="$efl_basic $efl_extra $bin_basic $e_themes $e_modules_efl $e_modules_bin $e_modules_extra $bin_extra"
  34. packagelist="basic"
  35. packages=$packages_basic
  36. cmd_src_test="svn info"
  37. cmd_src_list="svn list -r"
  38. cmd_src_checkout="svn checkout -r "
  39. cmd_src_update_conflicts_solve="svn update --accept theirs-full -r"
  40. cmd_src_update_conflicts_ask="svn update -r"
  41. src_mode="packages"
  42. ignore_dirs="devs DOCS E16 EXAMPLES TEST web"
  43. autogen_args="" # evas:--enable-gl-x11
  44. linux_distri="" # if your distribution is wrongly detected, define it here
  45. nice_level=0 # nice level (19 == low, -20 == high)
  46. os=$(uname) # operating system
  47. threads=2 # make -j <threads>
  48. deps_bin="automake yacc g++ gcc libtool pkg-config"
  49. deps_dev="dbus-1 fontconfig freetype GL jpeg lua png rsvg-2 udev xml2 X11 Xext Xrandr xcb"
  50. animation="star"
  51. online_source="http://omicron.homeip.net/projects/easy_e17/easy_e17.sh" # URL of latest stable release
  52. #############################################################################
  53. function logo ()
  54. {
  55. clear
  56. if [ "$version_mark" ]; then
  57. echo -e "\033[1m-------------------------------\033[7m Easy_e17.sh $version-$version_mark \033[0m\033[1m--------------------------\033[0m"
  58. else
  59. echo -e "\033[1m-------------------------------\033[7m Easy_e17.sh $version \033[0m\033[1m------------------------------\033[0m"
  60. fi
  61. echo -e "\033[1m Updates:\033[0m http://omicron.homeip.net/projects/#easy_e17.sh"
  62. echo -e "\033[1m Support:\033[0m #e.de (irc.freenode.net)"
  63. echo -e " morlenxus@gmx.net (Brian 'morlenxus' Miculcy)"
  64. echo -e "\033[1m Patches:\033[0m Generally accepted, please contact me!"
  65. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  66. echo
  67. echo -e "\033[1m-----------------------------\033[7m Current Configuration \033[0m\033[1m----------------------------\033[0m"
  68. echo " Install path: $install_path"
  69. echo " Logs path: $logs_path"
  70. echo " Source path: $src_path"
  71. echo " Source url: $src_url (Revision: $src_rev)"
  72. echo " Source mode: $src_mode (Packagelist: $packagelist)"
  73. if [ "$linux_distri" ]; then
  74. echo " OS: $os (Distribution: $linux_distri)"
  75. else
  76. echo " OS: $os"
  77. fi
  78. if [ "$skip" ]; then echo " Skipping: $skip"; fi
  79. if [ "$only" ]; then echo " Only: $only"; fi
  80. if [ -z "$action" ]; then action="MISSING!"; fi
  81. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  82. echo
  83. if [ "$action" == "script" ]; then return; fi
  84. if [ $1 == 0 ]; then
  85. if [ "$2" ]; then
  86. echo -e "\033[1m-------------------------------\033[7m Bad script argument \033[0m\033[1m----------------------------\033[0m"
  87. echo -e " \033[1m$2\033[0m"
  88. fi
  89. else
  90. echo -e "\033[1m--------------------------------\033[7m Build phase $1/3 \033[0m\033[1m-------------------------------\033[0m"
  91. fi
  92. if [ -z "$2" ]; then
  93. case $1 in
  94. 0)
  95. if [ "$os" == "not supported" ]; then
  96. echo -e "\033[1m-------------------------------\033[7m Not supported OS \033[0m\033[1m------------------------------\033[0m"
  97. echo " Your operating system '$(uname)' is not supported by this script."
  98. echo " If possible please provide a patch."
  99. else if [ -z "$fullhelp" ]; then
  100. echo -e "\033[1m-----------------\033[7m Short help 'easy_e17.sh <ACTION> <OPTIONS...>' \033[0m\033[1m---------------\033[0m"
  101. echo " -i, --install = install efl+e17"
  102. echo " -u, --update = update your installed software"
  103. echo
  104. echo " --packagelist=<list> = software package list:"
  105. echo " - basic (efl+e17)"
  106. echo " - half (efl+e17+e17modules)"
  107. echo " - full (efl+e17+e17modules+apps)"
  108. echo
  109. echo " --help = full help, many more options"
  110. else
  111. echo -e "\033[1m-----------------\033[7m Full help 'easy_e17.sh <ACTION> <OPTIONS...>' \033[0m\033[1m----------------\033[0m"
  112. echo -e " \033[1mACTION (ONLY SELECT ONE):\033[0m"
  113. echo " -i, --install = install efl+e17"
  114. echo " -u, --update = update installed software"
  115. echo " --only=<name1>,<name2>,... = install ONLY named libs/apps"
  116. echo " --srcupdate = update only the sources"
  117. echo " -v, --check-script-version = check for a newer release of easy_e17"
  118. echo " --help = this help"
  119. echo
  120. echo -e " \033[1mPACKAGELIST:\033[0m"
  121. echo " --packagelist=<listname> = software package list:"
  122. echo " - basic ($packages_basic)"
  123. echo " - half ($packages_half)"
  124. echo " - full ($packages_full)"
  125. echo
  126. echo -e " \033[1mOPTIONS:\033[0m"
  127. echo " --conf=<file> = use an alternate configuration file"
  128. echo " --instpath=<path> = change the default install path"
  129. echo " --srcpath=<path> = change the default source path"
  130. echo " --srcurl=<url> = change the default source url"
  131. echo " --srcmode=<packages/full> = checkout only required package source"
  132. echo " or simply everthing (huge)"
  133. echo " --srcrev=<revision> = set the default source revision"
  134. echo " --asuser = do everything as the user, not as root"
  135. echo " --no-sudopwd = sudo don't need a password..."
  136. echo " -c, --clean = clean the sources before building"
  137. echo " (more --cleans means more cleaning, up"
  138. echo " to a maximum of three, which will"
  139. echo " uninstall e17)"
  140. echo " -s, --skip-srcupdate = don't update sources"
  141. echo " -a, --ask-on-src-conflicts = ask what to do with a conflicting"
  142. echo " source file"
  143. echo " --skip=<name1>,<name2>,... = this will skip installing the named"
  144. echo " libs/apps"
  145. echo " -d, --docs = generate programmers documentation"
  146. echo " --postscript=<name> = full path to a script to run as root"
  147. echo " after installation"
  148. echo " -e, --skip-errors = continue compiling even if there is"
  149. echo " an error"
  150. echo " -w, --wait = don't exit the script after finishing,"
  151. echo " this allows 'xterm -e ./easy_e17.sh -i'"
  152. echo " without closing the xterm"
  153. echo " --anim=<animation> = build animation:"
  154. echo " - star: rotating star (default)"
  155. echo " - weeh: waving man"
  156. echo " -n --disable-notification = disable the osd notification"
  157. echo " -k, --keep = don't delete the temporary dir"
  158. echo
  159. echo " -l, --low = use lowest nice level (19, slowest,"
  160. echo " takes more time to compile, select"
  161. echo " this if you need to work on the pc"
  162. echo " while compiling)"
  163. echo " --normal = default nice level ($nice_level),"
  164. echo " will be automatically used"
  165. echo " -h, --high = use highest nice level (-20, fastest,"
  166. echo " slows down the pc)"
  167. echo " --cache = Use a common configure cache and"
  168. echo " ccache if available"
  169. echo " --threads=<int> = 'make' can use threads, recommended on"
  170. echo " smp systems (default: 2 threads)"
  171. echo " --autogen_args=<n1>:<o1>+<o2>,. = pass some options to autogen:"
  172. echo " <name1>:<opt1>+<opt2>,<name2>:<opt1>+..."
  173. echo " --cflags=<flag1>,<flag2>,... = pass cflags to the gcc"
  174. echo " --ldflags=<flag1>,<flag2>,... = pass ldflags to the gcc"
  175. echo " --pkg_config_path=<path1>,... = pass pkg-config path"
  176. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  177. echo
  178. echo -e "\033[1m----------------------\033[7m Configurationfile '~/.easy_e17.conf' \033[0m\033[1m--------------------\033[0m"
  179. echo " Just create this file and save your favourite arguments."
  180. echo " Example: If you use a diffent source path, add this line:"
  181. echo " --srcpath=$HOME/enlightenment/e17_src"
  182. fi fi
  183. ;;
  184. 1)
  185. echo "- running some basic system checks"
  186. echo "- source checkout/update"
  187. ;;
  188. 2)
  189. echo "- lib-compilation and installation"
  190. echo "- apps-compilation and installation"
  191. ;;
  192. 3)
  193. echo "- cleaning"
  194. echo "- install notes"
  195. ;;
  196. esac
  197. fi
  198. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  199. echo
  200. echo
  201. }
  202. function define_os_vars ()
  203. {
  204. case $os in
  205. Darwin)
  206. install_path="/opt/e17"
  207. # ldconfig="/sbin/ldconfig" # FIXME: Someone with Darwin seeing this should check availability!
  208. make="make"
  209. export ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I /opt/local/share/aclocal"
  210. export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig"
  211. export CPPFLAGS="$CPPFLAGS -I/opt/local/include"
  212. export LDFLAGS="$LDFLAGS -Wl,-L/opt/local/lib"
  213. ;;
  214. FreeBSD)
  215. install_path="/usr/local/e17"
  216. ldconfig="/sbin/ldconfig"
  217. make="gmake"
  218. export ACLOCAL_FLAGS=" -I /usr/local/share/aclocal"
  219. export CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/X11R6/include -I$install_path/include"
  220. 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!
  221. export LDFLAGS="$LDFLAGS -lexecinfo"
  222. ;;
  223. NetBSD)
  224. install_path="/usr/pkg/e17"
  225. ldconfig="config"
  226. make="make"
  227. export CFLAGS="$CFLAGS -I/usr/pkg/include -I/usr/X11R7/include"
  228. export CPPFLAGS="$CPPFLAGS -I/usr/pkg/include -I/usr/X11R7/include"
  229. export LDFLAGS="$LDFLAGS -L/usr/pkg/include -L/usr/pkg/lib -L/usr/X11R7/lib"
  230. ;;
  231. Linux)
  232. install_path="/opt/e17"
  233. ldconfig="/sbin/ldconfig"
  234. make="make"
  235. export CFLAGS="$CFLAGS -fvisibility=hidden"
  236. if [ -z "$linux_distri" ]; then
  237. if [ -e "/etc/debian_version" ]; then linux_distri="debian"; fi
  238. if [ -e "/etc/gentoo-release" ]; then linux_distri="gentoo"; fi
  239. if [ -e "/etc/redhat-release" ]; then linux_distri="redhat"; fi
  240. if [ -e "/etc/SuSE-release" ]; then linux_distri="suse"; fi
  241. fi
  242. ;;
  243. SunOS)
  244. install_path="/opt/e17"
  245. ldconfig="$(which crle) -u" # there is no command like ldconfig on solaris! "crle" does nearly the same.
  246. make="make"
  247. ;;
  248. *)
  249. os="not supported"
  250. logo 0
  251. set_title
  252. exit 0
  253. ;;
  254. esac
  255. }
  256. function find_src_path ()
  257. {
  258. package=$1
  259. subdir=$2
  260. depth=$3
  261. cachefile=$src_cache_path/cache_`echo "$subdir" | tr '/' '_'`
  262. if [ $depth -gt 3 ]; then return; fi
  263. if [ ! -e "$cachefile" ]; then
  264. $cmd_src_list $src_rev "$src_url/$subdir" | egrep "/$" >$cachefile
  265. fi
  266. contents=`cat $cachefile`
  267. for dir in $contents; do
  268. if [ "$dir" == "$package/" ]; then
  269. echo "$subdir/$dir"
  270. return
  271. fi
  272. done
  273. for dir in $contents; do
  274. found=0
  275. for pkg in $packages; do
  276. if [ "$dir" == "$pkg/" ]; then found=1; fi
  277. done
  278. if [ $found == 1 ]; then continue; fi
  279. for idir in $ignore_dirs; do
  280. if [ "$dir" == "$idir/" ]; then found=1; fi
  281. done
  282. if [ $found == 1 ]; then continue; fi
  283. svn_path=`find_src_path $package "$subdir/$dir" $(($depth+1))`
  284. if [ "$svn_path" ]; then
  285. echo "$svn_path"
  286. return
  287. fi
  288. done
  289. }
  290. function find_local_path ()
  291. {
  292. name=$1
  293. path=""
  294. for dir in `find "$src_path" -maxdepth 3 -type d -name "$name" | awk -F "$src_path" '{print $2}'`; do
  295. found=0
  296. for idir in $ignore_dirs; do
  297. topdir=`echo "$dir" | cut -d'/' -f1`
  298. if [ "$topdir" == "$idir" ]; then found=1; fi
  299. done
  300. if [ $found == 1 ]; then continue; fi
  301. if [ "${#dir}" -lt "${#path}" ] || [ -z "$path" ]; then
  302. path=$dir
  303. fi
  304. done
  305. if [ "$path" ]; then echo "$src_path/$path"; fi
  306. }
  307. function backoff_loop
  308. {
  309. src_cmd=$1
  310. backoff=30
  311. attempt=1;
  312. while [ 1 ]; do
  313. $src_cmd | tee -a "$tmp_path/source_update.log"
  314. if [ "${PIPESTATUS[0]}" -gt 0 ]; then
  315. attempt=$(($attempt + 1))
  316. set_title "Source update failed, trying again in $backoff seconds..."
  317. for (( i = $backoff / 2; i > 0; i-- )) do
  318. echo -n -e "\rFAILED! Next attempt $attempt in \033[1m$i\033[0m seconds"
  319. sleep 1
  320. done
  321. echo -n -e "\r \r"
  322. else
  323. break
  324. fi
  325. done
  326. }
  327. function get_src ()
  328. {
  329. cd "$src_path"
  330. if [ "$src_mode" == "packages" ]; then
  331. package=$1
  332. src_path_pkg="$src_path$package"
  333. mkdir -p "$src_path_pkg" 2>/dev/null
  334. if [ "`$cmd_src_test $src_path_pkg &>/dev/null; echo $?`" == 0 ]; then
  335. set_title "Updating sources in '$src_path_pkg' ..."
  336. echo "- updating sources in '$src_path_pkg' ..."
  337. if [ "$ask_on_src_conflicts" ]; then
  338. backoff_loop "$cmd_src_update_conflicts_ask $src_rev $package"
  339. else backoff_loop "$cmd_src_update_conflicts_solve $src_rev $package"; fi
  340. else
  341. set_title "Checkout sources in '$src_path_pkg' ..."
  342. echo "- searching for direct source url for '$package' ..."
  343. path=`find_src_path $package '' 1`
  344. if [ "$path" ]; then
  345. src_url_pkg="$src_url/$path"
  346. echo "- checkout sources in '$src_path_pkg' ..."
  347. backoff_loop "$cmd_src_checkout $src_rev $src_url_pkg $src_path_pkg"
  348. else
  349. echo "- direct source url not found, package moved to OLD/?"
  350. fi
  351. fi
  352. elif [ "$src_mode" == "full" ]; then
  353. if [ "`$cmd_src_test &>/dev/null; echo $?`" == 0 ]; then
  354. set_title "Updating sources in '$src_path' ..."
  355. echo "- updating sources in '$src_path' ..."
  356. if [ "$ask_on_src_conflicts" ]; then
  357. backoff_loop "$cmd_src_update_conflicts_ask $src_rev"
  358. else backoff_loop "$cmd_src_update_conflicts_solve $src_rev"; fi
  359. else
  360. set_title "Checkout sources in '$src_path' ..."
  361. echo "- checkout sources in '$src_path' ..."
  362. backoff_loop "$cmd_src_checkout $src_rev $src_url $src_path"
  363. fi
  364. fi
  365. }
  366. function run_command ()
  367. {
  368. name=$1
  369. path=$2
  370. title=$3
  371. log_title=$4
  372. mode_needed=$5
  373. cmd=$6
  374. set_title "$name: $title ($pkg_pos/$pkg_total)"
  375. echo -n "$log_title"
  376. logfile_banner "$cmd" "$logs_path/$name.log"
  377. if [ $mode_needed == "rootonly" ]; then
  378. mode_needed=$mode
  379. else
  380. if [ $nice_level -ge 0 ]; then
  381. mode_needed="user"
  382. fi
  383. fi
  384. rm -f $status_path/$name.noerrors
  385. case "$mode_needed" in
  386. "sudo")
  387. echo "$sudopwd" | sudo -S PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PYTHONPATH="$PYTHONPATH" \
  388. nice -n $nice_level $cmd >> "$logs_path/$name.log" 2>&1 && touch $status_path/$name.noerrors &
  389. ;;
  390. *)
  391. nice -n $nice_level $cmd >> "$logs_path/$name.log" 2>&1 && touch $status_path/$name.noerrors &
  392. ;;
  393. esac
  394. pid="$!"
  395. rotate "$pid" "$name"
  396. }
  397. function write_appname ()
  398. {
  399. name=$1
  400. hidden=$2
  401. cnt=${#name}
  402. max=27
  403. if [ "$hidden" ]; then
  404. c=-3
  405. while [ ! $c = $cnt ]; do
  406. echo -n " "
  407. c=$(($c+1))
  408. done
  409. else
  410. echo -n "- $name "
  411. fi
  412. while [ ! $cnt = $max ]; do
  413. echo -n "."
  414. cnt=$(($cnt+1))
  415. done
  416. echo -n " "
  417. }
  418. function compile ()
  419. {
  420. name=$1
  421. write_appname "$name"
  422. for one in $skip; do
  423. if [ "$name" == "$one" ]; then
  424. echo "SKIPPED"
  425. touch $status_path/$name.skipped
  426. return
  427. fi
  428. done
  429. if [ "$only" ] || [ "$action" == "update" ]; then
  430. found=""
  431. for one in $only; do
  432. if [ "$name" == "$one" ]; then found=1; fi
  433. done
  434. if [ -z "$found" ]; then
  435. echo "SKIPPED"
  436. touch $status_path/$name.skipped
  437. return
  438. else
  439. rm -rf $status_path/$name.skipped
  440. fi
  441. fi
  442. pkg_pos=$(($pkg_pos+1))
  443. if [ -e "$status_path/$name.installed" ]; then
  444. echo "previously installed"
  445. return
  446. fi
  447. path=`find_local_path $name`
  448. if [ ! -d "$path" ]; then
  449. echo "SOURCEDIR NOT FOUND"
  450. set_notification "critical" "Package '$name': sourcedir not found"
  451. return
  452. fi
  453. cd "$path"
  454. rm -f "$status_path/$name.noerrors"
  455. rm -f "$logs_path/$name.log"
  456. if [ $clean -ge 1 ]; then
  457. if [ -e "Makefile" ]; then
  458. if [ $clean -eq 1 ]; then
  459. run_command "$name" "$path" "clean" "clean : " "$mode" "$make -j $threads clean"
  460. if [ ! -e "$status_path/$name.noerrors" ]; then
  461. if [ "$skip_errors" ]; then
  462. write_appname "$name" "hidden" # clean might fail, that's ok
  463. else
  464. return
  465. fi
  466. fi
  467. fi
  468. if [ $clean -eq 2 ]; then
  469. run_command "$name" "$path" "distclean" "distcln: " "$mode" "$make -j $threads clean distclean"
  470. if [ ! -e "$status_path/$name.noerrors" ]; then
  471. if [ "$skip_errors" ]; then
  472. write_appname "$name" "hidden" # distclean might fail, that's ok
  473. else
  474. return
  475. fi
  476. fi
  477. fi
  478. if [ $clean -ge 3 ]; then
  479. run_command "$name" "$path" "uninstall" "uninst : " "rootonly" "$make -j $threads uninstall clean distclean"
  480. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  481. # It's no longer installed if we just uninstalled it.
  482. # Even if the uninstall failed, it's best to mark it as uninstalled so that a partial uninstall gets fixed later.
  483. rm -f $status_path/$name.installed
  484. fi
  485. fi
  486. fi
  487. # get autogen arguments
  488. args=""
  489. for app_arg in `echo $autogen_args | tr -s '\,' ' '`; do
  490. app=`echo $app_arg | cut -d':' -f1`
  491. if [ "$app" == "$name" ]; then
  492. args="$args `echo $app_arg | cut -d':' -f2- | tr -s '+' ' '`"
  493. fi
  494. done
  495. if [ -e "autogen.sh" ]; then
  496. run_command "$name" "$path" "autogen" "autogen: " "$mode" "./autogen.sh --prefix=$install_path $accache $args"
  497. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  498. run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
  499. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  500. run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
  501. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  502. elif [ -e "bootstrap" ]; then
  503. run_command "$name" "$path" "bootstrap" "bootstr: " "$mode" "./bootstrap"
  504. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  505. run_command "$name" "$path" "configure" "config: " "$mode" "./configure --prefix=$install_path $accache $args"
  506. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  507. run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
  508. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  509. run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
  510. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  511. elif [ -e "Makefile.PL" ]; then
  512. run_command "$name" "$path" "perl" "perl: " "$mode" "perl Makefile.PL prefix=$install_path $args"
  513. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  514. run_command "$name" "$path" "make" "make: " "$mode" "$make -j $threads"
  515. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  516. run_command "$name" "$path" "install" "install: " "rootonly" "$make install"
  517. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  518. elif [ -e "setup.py" ]; then
  519. run_command "$name" "$path" "python" "python: " "$mode" "python setup.py build build_ext --include-dirs=$PYTHONINCLUDE $args"
  520. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  521. run_command "$name" "$path" "install" "install: " "rootonly" "python setup.py install --prefix=$install_path install_headers --install-dir=$PYTHONINCLUDE"
  522. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  523. elif [ -e "Makefile" ]; then
  524. make_extra="PREFIX=$install_path"
  525. run_command "$name" "$path" "make" "make: " "$mode" "$make $make_extra -j $threads"
  526. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  527. run_command "$name" "$path" "install" "install: " "rootonly" "$make $make_extra install"
  528. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  529. else
  530. echo "no build system"
  531. set_notification "critical" "Package '$name': no build system"
  532. touch $status_path/$name.nobuild
  533. return
  534. fi
  535. if [ "$gen_docs" ]; then
  536. if [ -e "gendoc" ]; then
  537. run_command "$name" "$path" "docs" "docs : " "$mode" "sh gendoc"
  538. if [ ! -e "$status_path/$name.noerrors" ] ; then return ; fi
  539. fi
  540. fi
  541. # All done, mark it as installed OK.
  542. touch $status_path/$name.installed
  543. rm -f $status_path/$name.noerrors
  544. echo "ok"
  545. set_notification "normal" "Package '$name': build successful"
  546. }
  547. function rotate ()
  548. {
  549. pid=$1
  550. name=$2
  551. animation_state=1
  552. log_line=""
  553. case $animation in
  554. "weeh") echo -n " " ;;
  555. *) echo -n " " ;;
  556. esac
  557. while [ "`ps -p $pid -o comm=`" ]; do
  558. last_line=`tail -1 "$logs_path/$name.log"`
  559. if [ ! "$log_line" = "$last_line" ]; then
  560. case $animation in
  561. "weeh")
  562. # waving man
  563. echo -e -n "\b\b\b\b\b"
  564. case $animation_state in
  565. 1)
  566. echo -n "["
  567. echo -n -e "\033[1m"
  568. echo -n "\\o\\"
  569. echo -n -e "\033[0m"
  570. echo -n "]"
  571. animation_state=2
  572. ;;
  573. 2)
  574. echo -n "["
  575. echo -n -e "\033[1m|o|\033[0m"
  576. echo -n "]"
  577. animation_state=3
  578. ;;
  579. 3)
  580. echo -n "["
  581. echo -n -e "\033[1m/o/\033[0m"
  582. echo -n "]"
  583. animation_state=4
  584. ;;
  585. 4)
  586. echo -n "["
  587. echo -n -e "\033[1m|o|\033[0m"
  588. echo -n "]"
  589. animation_state=5
  590. ;;
  591. 5)
  592. echo -n "["
  593. echo -n -e "\033[1m"
  594. echo -n "\\o/"
  595. echo -n -e "\033[0m"
  596. echo -n "]"
  597. animation_state=6
  598. ;;
  599. 6)
  600. echo -n "["
  601. echo -n -e "\033[1m|o|\033[0m"
  602. echo -n "]"
  603. animation_state=1
  604. ;;
  605. esac
  606. ;;
  607. *)
  608. # rotating star
  609. echo -e -n "\b\b\b"
  610. case $animation_state in
  611. 1)
  612. echo -n "["
  613. echo -n -e "\033[1m|\033[0m"
  614. echo -n "]"
  615. animation_state=2
  616. ;;
  617. 2)
  618. echo -n "["
  619. echo -n -e "\033[1m/\033[0m"
  620. echo -n "]"
  621. animation_state=3
  622. ;;
  623. 3)
  624. echo -n "["
  625. echo -n -e "\033[1m-\033[0m"
  626. echo -n "]"
  627. animation_state=4
  628. ;;
  629. 4)
  630. echo -n "["
  631. echo -n -e "\033[1m"
  632. echo -n "\\"
  633. echo -n -e "\033[0m"
  634. echo -n "]"
  635. animation_state=1
  636. ;;
  637. esac
  638. ;;
  639. esac
  640. log_line=$last_line
  641. fi
  642. sleep 1
  643. done
  644. if [ -e "$status_path/$name.noerrors" ]; then
  645. case $animation in
  646. "weeh") del_lines 14 ;;
  647. *) del_lines 12 ;;
  648. esac
  649. else
  650. case $animation in
  651. "weeh") del_lines 5 ;;
  652. *) del_lines 3 ;;
  653. esac
  654. echo -e "\033[1mERROR!\033[0m"
  655. set_notification "critical" "Package '$name': build failed"
  656. if [ ! "$skip_errors" ]; then
  657. set_title "$name: ERROR"
  658. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  659. echo
  660. echo -e "\033[1m-----------------------------------\033[7m Last loglines \033[0m\033[1m------------------------------\033[0m"
  661. echo -n -e "\033[1m"
  662. tail -25 "$logs_path/$name.log"
  663. echo -n -e "\033[0m"
  664. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  665. echo
  666. echo "-> Get more informations by checking the log file '$logs_path/$name.log'!"
  667. echo
  668. # exit script or wait?
  669. if [ "$wait" ]; then
  670. echo
  671. echo -e -n "\033[1mThe script is waiting here - simply press [enter] to exit.\033[0m"
  672. read
  673. fi
  674. set_title
  675. exit 2
  676. fi
  677. fi
  678. }
  679. function del_lines ()
  680. {
  681. cnt=0
  682. max=$1
  683. while [ ! "$cnt" == "$max" ]; do
  684. echo -n -e "\b \b"
  685. cnt=$(($cnt+1))
  686. done
  687. }
  688. function error ()
  689. {
  690. echo -e "\n\n\033[1mERROR: $1\033[0m\n\n"
  691. set_title "ERROR: $1"
  692. set_notification "critical" "Error: $1"
  693. exit 2
  694. }
  695. function set_title ()
  696. {
  697. if [ "$1" ]; then message="- $1"; fi
  698. if [ "$DISPLAY" ]; then
  699. case "$TERM" in
  700. xterm*|rxvt*|Eterm|eterm|Aterm|aterm)
  701. echo -ne "\033]0;Easy_e17.sh $message\007"
  702. ;;
  703. esac
  704. fi
  705. }
  706. function set_notification ()
  707. {
  708. if [ -z "$DISPLAY" ] || [ "$notification_disabled" ]; then return; fi
  709. notifier="$install_path/bin/e-notify-send"
  710. urgency=$1
  711. text=$2
  712. if [ -e "$notifier" ]; then
  713. $notifier -u "$urgency" -t 5000 -i "$install_path/share/enlightenment/data/images/enlightenment.png" \
  714. -n "easy_e17.sh" "easy_e17.sh" "$text" &>/dev/null
  715. fi
  716. }
  717. function logfile_banner ()
  718. {
  719. cmd=$1
  720. logfile=$2
  721. echo "-------------------------------------------------------------------------------" >> "$logfile"
  722. echo "EASY_E17 $version CMD: $cmd" >> "$logfile"
  723. echo "-------------------------------------------------------------------------------" >> "$logfile"
  724. }
  725. function cnt_pkgs () {
  726. pkg_total=0
  727. pkg_pos=0
  728. if [ -n "$only" ]; then
  729. pkg_total=`echo "$only" | wc -w`
  730. else
  731. pkg_total=`echo "$packages" | wc -w`
  732. fi
  733. }
  734. function check_script_version ()
  735. {
  736. echo "- local version .............. $version"
  737. echo -n "- downloading script ......... "
  738. 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`
  739. if [ "$remote_version" ]; then
  740. echo "ok"
  741. echo "- remote version ............. $remote_version"
  742. remote_ver=`echo "$remote_version" | tr -d '.'`
  743. local_ver=`echo "$version" | tr -d '.'`
  744. echo
  745. echo -n "- update available ........... "
  746. if [ $remote_ver -gt $local_ver ]; then
  747. echo -e "\033[1mYES!\033[0m"
  748. else echo "no"; fi
  749. else
  750. echo -e "\033[1mERROR!\033[0m"
  751. fi
  752. }
  753. # SCRIPT:
  754. EASY_PWD=`pwd`
  755. set_title
  756. define_os_vars
  757. accache=""
  758. easy_options=""
  759. command_options=$@
  760. clean=0
  761. # Check for alternate conf file first.
  762. test_options=$command_options
  763. for arg in $test_options; do
  764. option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
  765. value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
  766. if [ "$value" == "$option" ]; then value=""; fi
  767. if [ "$option" == "--conf" ]; then conf_files="$conf_files $value"; fi
  768. done
  769. # remove duplicated configfile entries
  770. for filea in $conf_files; do
  771. exists=0
  772. for fileb in $tmp_conf_files; do
  773. if [ "$filea" == "$fileb" ]; then
  774. exists=1
  775. break
  776. fi
  777. done
  778. if [ $exists -eq 0 ]; then tmp_conf_files="$tmp_conf_files $filea"; fi
  779. done
  780. conf_files=$tmp_conf_files
  781. for file in $conf_files; do
  782. if [ -e "$file" ]; then
  783. # load configfile
  784. for option in `cat "$file"`; do
  785. easy_options="$easy_options $option"
  786. done
  787. fi
  788. done
  789. # append arguments
  790. easy_options="$easy_options $command_options"
  791. # check options
  792. for arg in $easy_options
  793. do
  794. option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
  795. value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
  796. if [ "$value" == "$option" ]; then value=""; fi
  797. # $action can't be set twice
  798. if [ "$action" ]; then
  799. if [ "$option" == "-i" ] ||
  800. [ "$option" == "--install" ] ||
  801. [ "$option" == "-u" ] ||
  802. [ "$option" == "--update" ] ||
  803. [ "$option" == "--only" ] ||
  804. [ "$option" == "--srcupdate" ] ||
  805. [ "$option" == "-v" ] ||
  806. [ "$option" == "--check-script-version" ]; then
  807. logo 0 "Only one action allowed! (currently using '--$action' and '$option')"
  808. exit 1
  809. fi
  810. fi
  811. case "$option" in
  812. -i|--install) action="install" ;;
  813. -u|--update) action="update" ;;
  814. --packagelist)
  815. packagelist=$value
  816. case $value in
  817. "half") packages="$packages_half" ;;
  818. "full") packages="$packages_full" ;;
  819. *) packages="$packages_basic" ;;
  820. esac
  821. ;;
  822. --conf) ;; # FIXME
  823. --only)
  824. if [ -z "$value" ]; then
  825. logo 0 "Missing value for argument '$option'!"
  826. exit 1
  827. fi
  828. action="only"
  829. only="`echo "$value" | tr -s '\,' '\ '` $only"
  830. ;;
  831. -v|--check-script-version) action="script" ;;
  832. --srcupdate)
  833. action="srcupdate"
  834. skip="$packages"
  835. ;;
  836. --instpath) install_path="$value" ;;
  837. --srcpath) src_path="$value" ;;
  838. --srcurl) src_url="$value" ;;
  839. --srcmode)
  840. case $value in
  841. "packages") src_mode="packages" ;;
  842. "full") src_mode="full" ;;
  843. *) src_mode="packages" ;;
  844. esac
  845. ;;
  846. --srcrev)
  847. if [ -z "$value" ]; then
  848. logo 0 "Missing value for argument '$option'!"
  849. exit 1
  850. fi
  851. src_rev="$value"
  852. ;;
  853. --asuser) asuser=1 ;;
  854. --no-sudopwd) no_sudopwd=1 ;;
  855. -c|--clean) clean=$(($clean + 1)) ;;
  856. -d|--docs) gen_docs=1 ;;
  857. --postscript) easy_e17_post_script="$value" ;;
  858. -s|--skip-srcupdate) skip_srcupdate=1 ;;
  859. -a|--ask-on-src-conflicts) ask_on_src_conflicts=1 ;;
  860. --skip)
  861. if [ -z "$value" ]; then
  862. logo 0 "Missing value for argument '$option'!"
  863. exit 1
  864. fi
  865. skip="`echo "$value" | tr -s '\,' '\ '` $skip"
  866. ;;
  867. -e|--skip-errors) skip_errors=1 ;;
  868. -w|--wait) wait=1 ;;
  869. --anim)
  870. case $value in
  871. "weeh") animation="weeh" ;;
  872. *) animation="star" ;;
  873. esac
  874. ;;
  875. -n|--disable-notification) notification_disabled=1 ;;
  876. -k|--keep) keep=1 ;;
  877. -l|--low) nice_level=19 ;;
  878. --normal) ;;
  879. -h|--high) nice_level=-20 ;;
  880. --cache)
  881. accache=" --cache-file=$tmp_path/easy_e17.cache"
  882. ccache=`whereis ccache`
  883. if [ ! "$ccache" = "ccache:" ]; then
  884. export CC="ccache gcc"
  885. fi
  886. ;;
  887. --threads)
  888. if [ -z "$value" ] || ! expr "$value" : "[0-9]*$" >/dev/null || [ "$value" -lt 1 ]; then
  889. logo 0 "Missing value for argument '$option'!"
  890. exit 1
  891. fi
  892. threads=$value
  893. ;;
  894. --autogen_args)
  895. if [ -z "$value" ]; then
  896. logo 0 "Missing value for argument '$option'!"
  897. exit 1
  898. fi
  899. autogen_args="$value"
  900. ;;
  901. --cflags)
  902. if [ -z "$value" ]; then
  903. logo 0 "Missing value for argument '$option'!"
  904. exit 1
  905. fi
  906. CFLAGS="$CFLAGS `echo "$value" | tr -s '\,' '\ '`"
  907. ;;
  908. --ldflags)
  909. if [ -z "$value" ]; then
  910. logo 0 "Missing value for argument '$option'!"
  911. exit 1
  912. fi
  913. LDFLAGS="$LDFLAGS `echo "$value" | tr -s '\,' '\ '`"
  914. ;;
  915. --pkg_config_path)
  916. if [ -z "$value" ]; then
  917. logo 0 "Missing value for argument '$option'!"
  918. exit 1
  919. fi
  920. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`echo "$value" | tr -s '\,' '\ '`"
  921. ;;
  922. --help)
  923. fullhelp=1
  924. logo 0
  925. exit 0
  926. ;;
  927. *)
  928. logo 0 "Unknown argument '$option'!"
  929. exit 1
  930. ;;
  931. esac
  932. done
  933. # Sanity check stuff if doing everything as user.
  934. if [ "$asuser" ] && [ $nice_level -lt 0 ]; then
  935. nice_level=0
  936. fi
  937. # Fix issues with a slash at the end
  938. if [ ! "${src_path:$((${#src_path}-1)):1}" == "/" ]; then
  939. src_path="$src_path/"
  940. fi
  941. # quit if some basic option is missing
  942. if [ -z "$action" ] || [ -z "$install_path" ] || [ -z "$src_path" ]; then
  943. logo 0
  944. exit 1
  945. fi
  946. # check for script updates
  947. if [ "$action" == "script" ]; then
  948. logo 0
  949. echo -e "\033[1m-------------------------------------\033[7m AUTHORS \033[0m\033[1m----------------------------------\033[0m"
  950. echo -e "\033[1m Developers:\033[0m Brian 'morlenxus' Miculcy"
  951. echo -e " David 'onefang' Seikel"
  952. echo -e "\033[1m Contributors:\033[0m Tim 'amon' Zebulla"
  953. echo -e " Daniel G. '_ke' Siegel"
  954. echo -e " Stefan 'slax' Langner"
  955. echo -e " Massimiliano 'Massi' Calamelli"
  956. echo -e " Thomas 'thomasg' Gstaedtner"
  957. echo -e " Roberto 'rex' Sigalotti"
  958. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  959. echo
  960. echo -e "\033[1m------------------------------\033[7m Check script version \033[0m\033[1m----------------------------\033[0m"
  961. check_script_version
  962. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  963. echo
  964. exit 0
  965. fi
  966. # run script normally
  967. logo 1
  968. set_title "Basic system checks"
  969. echo -e "\033[1m-------------------------------\033[7m Basic system checks \033[0m\033[1m----------------------------\033[0m"
  970. echo -n "- creating temporary dirs .... "
  971. mkdir -p "$tmp_path" 2>/dev/null
  972. mkdir -p "$logs_path" 2>/dev/null
  973. mkdir -p "$status_path" 2>/dev/null
  974. mkdir -p "$src_cache_path" 2>/dev/null
  975. mkdir -p "$src_path" 2>/dev/null
  976. chmod 700 "$tmp_path"
  977. echo "ok"
  978. echo "- basic dependency check:"
  979. max=23
  980. for dep in $deps_bin $make `echo "$cmd_src_checkout" | cut -d' ' -f1`; do
  981. cnt=${#dep}
  982. echo -n " - '$dep' "
  983. while [ ! $cnt = $max ]; do
  984. echo -n "."
  985. cnt=$(($cnt+1))
  986. done
  987. echo -n " "
  988. if [ `type $dep &>/dev/null; echo $?` -ne 0 ]; then
  989. echo -e "\033[1mNOT INSTALLED!\033[0m"
  990. error "Command missing!"
  991. else
  992. echo "ok"
  993. fi
  994. done
  995. compfile="$tmp_path/include_test.c"
  996. echo "main(){}" >$compfile
  997. for dep in $deps_dev; do
  998. cnt=${#dep}
  999. echo -n " - '$dep' "
  1000. while [ ! $cnt = $max ]; do
  1001. echo -n "."
  1002. cnt=$(($cnt+1))
  1003. done
  1004. echo -n " "
  1005. if [ `gcc -o /dev/null $compfile -l$dep &>/dev/null; echo $?` -ne 0 ]; then
  1006. echo -e "\033[1mNOT INSTALLED!\033[0m"
  1007. error "Include missing!"
  1008. else
  1009. echo "ok"
  1010. fi
  1011. done
  1012. if [ ! "$action" == "srcupdate" ]; then
  1013. echo -n "- build-user ................. "
  1014. if [ ! "$LOGNAME" == "root" ]; then
  1015. if [ "$asuser" ]; then
  1016. echo "$LOGNAME (as user)"
  1017. mode="user"
  1018. else
  1019. echo "$LOGNAME (non-root)"
  1020. echo -n "- sudo available ............. "
  1021. sudotest=`type sudo &>/dev/null ; echo $?`
  1022. if [ "$sudotest" == 0 ]; then
  1023. if [ "$no_sudopwd" == 1 ]; then
  1024. echo "ok"
  1025. else
  1026. sudo -K
  1027. if [ -e "$tmp_path/sudo.test" ]; then
  1028. rm -f "$tmp_path/sudo.test"
  1029. fi
  1030. while [ -z "$sudopwd" ]; do
  1031. echo -n "enter sudo-password: "
  1032. stty -echo
  1033. read sudopwd
  1034. stty echo
  1035. # password check
  1036. echo "$sudopwd" | sudo -S touch "$tmp_path/sudo.test" &>/dev/null
  1037. if [ ! -e "$tmp_path/sudo.test" ]; then
  1038. sudopwd=""
  1039. fi
  1040. done
  1041. rm -f "$tmp_path/sudo.test"
  1042. fi
  1043. echo
  1044. mode="sudo"
  1045. else
  1046. error "You're not root and sudo isn't available. Please run this script as root!"
  1047. fi
  1048. fi
  1049. else
  1050. echo "root"
  1051. mode="root"
  1052. fi
  1053. echo -n "- setting env variables ...... "
  1054. export PATH="$install_path/bin:$PATH"
  1055. export ACLOCAL_FLAGS="-I $install_path/share/aclocal $ACLOCAL_FLAGS"
  1056. export LD_LIBRARY_PATH="$install_path/lib:$LD_LIBRARY_PATH"
  1057. export PKG_CONFIG_PATH="$install_path/lib/pkgconfig:$PKG_CONFIG_PATH"
  1058. export CPPFLAGS="$CPPFLAGS -I$install_path/include"
  1059. export LDFLAGS="$LDFLAGS -L$install_path/lib"
  1060. export CFLAGS="$CFLAGS"
  1061. export PYTHONPATH=`python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(prefix='$install_path')" 2>/dev/null`
  1062. export PYTHONINCLUDE=`python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc(prefix='$install_path')" 2>/dev/null`
  1063. echo "ok"
  1064. echo -n "- creating destination dirs .. "
  1065. case "$mode" in
  1066. user|root) mkdir -p "$install_path/share/aclocal" ;;
  1067. sudo) echo "$sudopwd" | sudo -S mkdir -p "$install_path/share/aclocal" ;;
  1068. esac
  1069. # PYTHON BINDING FIXES
  1070. if [ "$PYTHONPATH" ]; then
  1071. case "$mode" in
  1072. user|root) mkdir -p "$PYTHONPATH" ;;
  1073. sudo) echo "$sudopwd" | sudo -S mkdir -p "$PYTHONPATH" ;;
  1074. esac
  1075. fi
  1076. if [ "$PYTHONINCLUDE" ]; then
  1077. case "$mode" in
  1078. user|root) mkdir -p "$PYTHONINCLUDE" ;;
  1079. sudo) echo "$sudopwd" | sudo -S mkdir -p "$PYTHONINCLUDE" ;;
  1080. esac
  1081. fi
  1082. echo "ok"
  1083. echo -n "- checking lib-path in ld .... "
  1084. case $os in
  1085. FreeBSD) ;; # TODO: placeholder
  1086. SunOS) ;; # TODO: need more testing of adding libraries on different solaris versions. atm this is not working
  1087. Linux)
  1088. libpath="`grep -r -l -i -m 1 $install_path/lib /etc/ld.so.conf*`"
  1089. if [ -z "$libpath" ]; then
  1090. case $linux_distri in
  1091. gentoo)
  1092. e17ldcfg="/etc/env.d/40e17paths"
  1093. echo -e "PATH=$install_path/bin\nROOTPATH=$install_path/sbin:$install_path/bin\nLDPATH=$install_path/lib\nPKG_CONFIG_PATH=$install_path/lib/pkgconfig" > $e17ldcfg
  1094. env-update &> /dev/null
  1095. echo "ok (path has been added to $e17ldcfg)";
  1096. ;;
  1097. *)
  1098. if [ "`grep -l 'include /etc/ld.so.conf.d/' /etc/ld.so.conf`" ]; then
  1099. e17ldcfg="/etc/ld.so.conf.d/e17.conf"
  1100. else
  1101. e17ldcfg="/etc/ld.so.conf";
  1102. cp $e17ldcfg $tmp_path;
  1103. fi
  1104. case "$mode" in
  1105. "user") ;;
  1106. "root") echo "$install_path/lib" >>$e17ldcfg ;;
  1107. "sudo")
  1108. echo "$install_path/lib" >> $tmp_path/`basename $e17ldcfg`
  1109. echo "$sudopwd" | sudo -S mv -f $tmp_path/`basename $e17ldcfg` $e17ldcfg
  1110. ;;
  1111. esac
  1112. if [ "$asuser" ]; then
  1113. echo "skipped (running as user)";
  1114. else echo "ok (path has been added to $e17ldcfg)"; fi
  1115. ;;
  1116. esac
  1117. else
  1118. echo "ok ($libpath)";
  1119. fi
  1120. ;;
  1121. esac
  1122. if [ "$only" ]; then
  1123. echo
  1124. echo "- matching packages with internal package lists (basic/half/full)..."
  1125. monly=$only
  1126. only=""
  1127. for opkg in $monly; do
  1128. found=0;
  1129. echo -n " - $opkg: "
  1130. for pkg in $packages_basic; do
  1131. if [ "$opkg" == "$pkg" ]; then
  1132. found=1;
  1133. fi
  1134. done
  1135. if [ $found -eq 0 ]; then
  1136. for pkg in $packages_half; do
  1137. if [ "$opkg" == "$pkg" ]; then
  1138. if [ "$packagelist" == "basic" ]; then
  1139. found=2;
  1140. else
  1141. found=1;
  1142. fi
  1143. fi
  1144. done
  1145. fi
  1146. if [ $found -eq 0 ]; then
  1147. for pkg in $packages_full; do
  1148. if [ "$opkg" == "$pkg" ]; then
  1149. if [ "$packagelist" == "basic" ] ||
  1150. [ "$packagelist" == "half" ]; then
  1151. found=3;
  1152. else
  1153. found=1;
  1154. fi
  1155. fi
  1156. done
  1157. fi
  1158. case $found in
  1159. "1")
  1160. echo "ok"
  1161. only="$only $opkg"
  1162. ;;
  1163. "2")
  1164. echo -e "\033[1mok (SELECT PACKAGELIST: half)\033[0m"
  1165. only="$only $opkg"
  1166. packagelist="half"
  1167. packages="$packages_half"
  1168. ;;
  1169. "3")
  1170. echo -e "\033[1mok (SELECT PACKAGELIST: full)\033[0m"
  1171. only="$only $opkg"
  1172. packagelist="full"
  1173. packages="$packages_full"
  1174. ;;
  1175. *)
  1176. echo -e "\033[1mNOT FOUND!\033[0m"
  1177. ;;
  1178. esac
  1179. done
  1180. fi
  1181. fi
  1182. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1183. echo
  1184. # sources
  1185. echo -e "\033[1m-----------------------------\033[7m Source checkout/update \033[0m\033[1m---------------------------\033[0m"
  1186. if [ -z "$skip_srcupdate" ]; then
  1187. rm "$tmp_path/source_update.log" 2>/dev/null
  1188. if [ ! "$action" == "install" ]; then
  1189. rm "$status_path/"*".installed" 2>/dev/null
  1190. rm "$status_path/"*".skipped" 2>/dev/null
  1191. fi
  1192. cd "$src_path"
  1193. if [ "`$cmd_src_test &>/dev/null; echo $?`" == 0 ]; then
  1194. if [ "$src_mode" == "packages" ]; then
  1195. echo -e "\033[1m- Full checkout found, changed source mode to 'full'!\033[0m"
  1196. src_mode="full"
  1197. fi
  1198. fi
  1199. if [ "$src_mode" == "packages" ]; then
  1200. if [ "$only" ]; then
  1201. for pkgo in $only; do
  1202. for pkga in $packages; do
  1203. if [ "$pkgo" == "$pkga" ]; then
  1204. get_src $pkgo
  1205. fi
  1206. done
  1207. done
  1208. else
  1209. for pkg in $packages; do
  1210. get_src $pkg
  1211. done
  1212. fi
  1213. elif [ "$src_mode" == "full" ]; then
  1214. get_src
  1215. fi
  1216. else
  1217. echo -e "\n - - - SKIPPED - - -\n"
  1218. fi
  1219. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1220. echo
  1221. if [ "$action" == "update" ] && [ -e "$tmp_path/source_update.log" ]; then
  1222. echo -e "\033[1m--------------------------------\033[7m Parsing updates \033[0m\033[1m-------------------------------\033[0m"
  1223. for dir in `egrep "^[A|D|G|U] " "$tmp_path/source_update.log" | \
  1224. awk '{print $2}' | sed 's,[^/]*$,,g' | sort -u`; do
  1225. add_pkg=""
  1226. found=0
  1227. for idir in $ignore_dirs; do
  1228. topdir=`echo "$dir" | cut -d'/' -f1`
  1229. if [ "$topdir" == "$idir" ]; then found=1; fi
  1230. done
  1231. if [ $found == 1 ]; then continue; fi
  1232. for pkg in $packages; do
  1233. if [ `echo "$dir" | egrep -q "^$pkg/|/$pkg/"; echo $?` == 0 ]; then
  1234. if [ ! `echo "$only" | egrep -q "^$pkg | $pkg\$ | $pkg "; echo $?` == 0 ]; then
  1235. only="$pkg $only"
  1236. echo "- $pkg"
  1237. fi
  1238. break
  1239. fi
  1240. done
  1241. done
  1242. if [ -z "$only" ]; then
  1243. echo -e "\n - - - NO UPDATES AVAILABLE - - -\n"
  1244. fi
  1245. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1246. echo
  1247. fi
  1248. echo -n "-> PREPARING FOR PHASE 2..."
  1249. set_title "Preparing for phase 2... compilation & installation"
  1250. sleep 5
  1251. if [ "$action" == "install" ]; then
  1252. set_notification "normal" "Now building packages..."
  1253. elif [ "$action" == "only" ]; then
  1254. set_notification "normal" "Now building following packages: $only"
  1255. elif [ "$action" == "update" ]; then
  1256. if [ "$only" ]; then
  1257. set_notification "normal" "Now building following packages: $only"
  1258. else set_notification "normal" "Everything is up to date, nothing to build"; fi
  1259. fi
  1260. logo 2
  1261. echo -e "\033[1m------------------------------\033[7m Installing packages \033[0m\033[1m-----------------------------\033[0m"
  1262. cnt_pkgs
  1263. for pkg in $packages; do
  1264. compile $pkg
  1265. done
  1266. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1267. echo
  1268. # Restore current directory in case post processing wants to be pathless.
  1269. cd $EASY_PWD
  1270. echo -e "\033[1m-----------------------------\033[7m Finishing installation \033[0m\033[1m---------------------------\033[0m"
  1271. echo -n "- registering libraries ...... "
  1272. if [ -z "$asuser" ]; then
  1273. case "$mode" in
  1274. "sudo") echo "$sudopwd" | sudo -S nice -n $nice_level $ldconfig > /dev/null 2>&1 ;;
  1275. *) nice -n $nice_level $ldconfig > /dev/null 2>&1 ;;
  1276. esac
  1277. echo "ok"
  1278. else
  1279. echo "skipped"
  1280. fi
  1281. echo -n "- post install script ........ "
  1282. if [ "$easy_e17_post_script" ]; then
  1283. echo -n " '$easy_e17_post_script' ... "
  1284. case "$mode" in
  1285. "sudo") echo "$sudopwd" | sudo -S nice -n $nice_level $easy_e17_post_script ;;
  1286. *) nice -n $nice_level $easy_e17_post_script ;;
  1287. esac
  1288. echo "ok"
  1289. else
  1290. echo "skipped"
  1291. fi
  1292. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1293. echo
  1294. echo -n "-> PREPARING FOR PHASE 3..."
  1295. set_title "Preparing for phase 3..."
  1296. sleep 5
  1297. logo 3
  1298. set_title "Finished"
  1299. for pkg in $packages; do
  1300. if [ -e "$status_path/$pkg.installed" ]; then
  1301. packages_installed="$packages_installed $pkg"
  1302. else
  1303. if [ -e "$status_path/$pkg.skipped" ]; then
  1304. packages_skipped="$packages_skipped $pkg"
  1305. else
  1306. packages_failed="$packages_failed $pkg"
  1307. fi
  1308. fi
  1309. done
  1310. echo -e "\033[1m--------------------------------\033[7m Cleaning temp dir \033[0m\033[1m-----------------------------\033[0m"
  1311. if [ -z "$keep" ]; then
  1312. if [ "$packages_failed" ]; then
  1313. echo -n "- saving logs ................ "
  1314. for pkg in $packages_installed $packages_skipped; do
  1315. rm "$logs_path/$pkg.log" 2>/dev/null
  1316. done
  1317. else
  1318. echo -n "- deleting temp dir .......... "
  1319. rm -rf $tmp_path 2>/dev/null
  1320. fi
  1321. echo "ok"
  1322. else
  1323. echo "- saving temp dir ............ ok"
  1324. fi
  1325. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1326. echo
  1327. if [ "$packages_failed" ]; then
  1328. echo -e "\033[1m---------------------------------\033[7m Failed packages \033[0m\033[1m------------------------------\033[0m"
  1329. for pkg in $packages_failed; do
  1330. echo -n "- $pkg"
  1331. if [ -e "$logs_path/$pkg.log" ]; then
  1332. echo -n " (error log: $logs_path/$pkg.log)"
  1333. fi
  1334. echo
  1335. done
  1336. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1337. echo
  1338. set_notification "critical" "Script finished with build errors"
  1339. else
  1340. set_notification "normal" "Script finished successful"
  1341. fi
  1342. if [ "$action" == "install" ]; then
  1343. echo
  1344. echo "INSTALL NOTES:"
  1345. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1346. echo "The most incredible and really unbelievable dream has become true:"
  1347. echo "You compiled e17 successfully!"
  1348. echo
  1349. echo "Starting e17:"
  1350. echo "Create a file ~/.xsession with the line 'exec $install_path/bin/enlightenment_start'."
  1351. echo "Add a link to this file using 'ln -s ~/.xsession ~/.xinitrc'."
  1352. echo
  1353. echo "If you're using a login manager (GDM/KDM), select the session type 'default' in them."
  1354. echo "If you're using the startx command, simply execute it now."
  1355. echo
  1356. echo "Note: e17 is still not released and it won't be in the near future. So don't"
  1357. echo "ask for a stable release. e17 is still very buggy and only for experienced users"
  1358. echo "who know what they do..."
  1359. echo
  1360. echo "Rasterman didn't write this script so don't ask him for help with it."
  1361. echo
  1362. echo "Hint: From now on you can easily keep your installation up to date."
  1363. echo "Simply run easy_e17.sh with -u instead of -i ."
  1364. echo
  1365. echo "We hope you will enjoy your trip into e17... Have fun!"
  1366. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1367. fi
  1368. echo
  1369. echo "ADD THESE ENVIRONMENT VARIABLES:"
  1370. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1371. echo "export PATH=\"$install_path/bin:\$PATH\""
  1372. echo "export PYTHONPATH=\"`python -c \"import distutils.sysconfig; print distutils.sysconfig.get_python_lib(prefix='$install_path')\" 2>/dev/null`:\$PYTHONPATH\""
  1373. echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
  1374. echo
  1375. # Clear this out if we ever set it.
  1376. export CC=""
  1377. # exit script or wait?
  1378. if [ "$wait" ]; then
  1379. echo
  1380. echo -e -n "\033[1mThe script is waiting here - simply press [enter] to exit.\033[0m"
  1381. read
  1382. fi
  1383. set_title
  1384. if [ "$packages_failed" ]; then
  1385. exit 2
  1386. else exit 0; fi