mk_profile 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #!/bin/sh
  2. # build /etc/profile
  3. #set -x
  4. echo `pwd` | egrep -qw "^\/|\/usr|$HOME" && exit #precaution
  5. echo "building /etc/profile"
  6. woof_path=sandbox3/rootfs-complete
  7. PRFILE=${woof_path}/etc/profile
  8. echo "# profile" > $PRFILE # refresh it
  9. . $woof_path/etc/DISTRO_SPECS
  10. [ "$DISTRO_BINARY_COMPAT" = 'slackware64' ] && lsuffix=64 || lsuffix=
  11. if [ -d ${woof_path}/usr/X11R7 ];then
  12. echo -e "PATH=\"/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/usr/games\"" \
  13. >> $PRFILE
  14. echo -e "LD_LIBRARY_PATH=\"/lib${lsuffix}:/usr/lib${lsuffix}:/usr/X11R7/lib:/root/my-applications/lib:/usr/local/lib\"" \
  15. >> $PRFILE
  16. else
  17. echo -e "PATH=\"/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/root/my-applications/bin:/usr/games\"" \
  18. >> $PRFILE
  19. echo -e "LD_LIBRARY_PATH=\"/lib${lsuffix}:/usr/lib${lsuffix}:/root/my-applications/lib:/usr/local/lib\"" \
  20. >> $PRFILE
  21. fi
  22. # qt
  23. cat >> $PRFILE << _QT
  24. if [ -d "/opt/qt4" ];then
  25. LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:/opt/qt4/lib"
  26. [ -d /opt/qt4/bin ] && PATH="\$PATH:/opt/qt4/bin" #if devx sfs.
  27. export QT4DIR="/opt/qt4"
  28. [ -d /opt/qt4/include ] && export CPLUS_INCLUDE_PATH="/opt/qt4/include" #devx
  29. fi
  30. if [ -e /usr/lib${lsuffix}/qt ];then
  31. export QTDIR=/usr/lib${lsuffix}/qt
  32. [ -d /usr/lib${lsuffix}/qt/bin ] && PATH=/usr/lib${lsuffix}/qt/bin:\${PATH}
  33. LD_LIBRARY_PATH=/usr/lib${lsuffix}/qt/lib:\$LD_LIBRARY_PATH
  34. fi
  35. export QT_XFT=true
  36. _QT
  37. # removed /opt/mozilla
  38. # firefox/seamonkey/palemoon
  39. echo -e "MOZ_PLUGIN_PATH=\"/usr/lib${lsuffix}/mozilla/plugins\"" >> $PRFILE
  40. NSPR=$(find ${woof_path}/usr/lib${lsuffix} -name 'libnspr*' -maxdepth 1)
  41. if [ -z "$NSPR" ];then # if we have nspr in /usr/lib itself we don't need this stuff
  42. SEAM=$(find ${woof_path}/usr/lib${lsuffix} -type d -name 'seamonkey*' -maxdepth 1)
  43. FFX=$(find ${woof_path}/usr/lib${lsuffix} -type d -name 'firefox*' -maxdepth 1)
  44. PLM=$(find ${woof_path}/usr/lib${lsuffix} -type d -name 'palemoon*' -maxdepth 1)
  45. if [ "$SEAM" ];then
  46. cat >> $PRFILE << _SM
  47. LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:/usr/lib${lsuffix}/seamonkey"
  48. export MOZILLA_FIVE_HOME="/usr/lib${lsuffix}/seamonkey"
  49. MOZ_PLUGIN_PATH="\${MOZ_PLUGIN_PATH}:/usr/lib${lsuffix}/seamonkey/plugins"
  50. fi
  51. _SM
  52. elif [ "$FFX" ];then
  53. cat >> $PRFILE << _FF
  54. FIREFOX=\$(find /usr/lib${lsuffix} -type d -name 'firefox*' -maxdepth 1|tail -1) #slacko
  55. if [ -d "\$FIREFOX" ];then
  56. LD_LIBRARY_PATH="\$FIREFOX:\$LD_LIBRARY_PATH"
  57. export MOZILLA_FIVE_HOME="\$FIREFOX"
  58. fi
  59. _FF
  60. elif [ "$PLM" ];then
  61. cat >> $PRFILE << _PM
  62. PALEMOON=\$(find /usr/lib${lsuffix} -type d -name 'palemoon*' -maxdepth 1|tail -1) #slacko
  63. if [ -d "\$PALEMOON" ];then
  64. LD_LIBRARY_PATH="\$PALEMOON:\$LD_LIBRARY_PATH"
  65. export MOZILLA_FIVE_HOME="\$PALEMOON"
  66. fi
  67. _PM
  68. fi
  69. fi
  70. echo "export PATH LD_LIBRARY_PATH MOZ_PLUGIN_PATH" >> $PRFILE
  71. # samba
  72. cat >> $PRFILE << _SAM
  73. if [ -d /opt/samba ];then
  74. LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:/opt/samba/lib"
  75. PATH="\$PATH:/opt/samba/bin"
  76. fi
  77. _SAM
  78. # other stuff
  79. cat >> $PRFILE << _EX
  80. #for gtk...
  81. export GDK_USE_XFT=1
  82. #v4.00 for Open Office, force ue of GTK...
  83. export OOO_FORCE_DESKTOP="gnome"
  84. ulimit -c 0
  85. if [ \$(id -gn) = \$(id -un) -a \$(id -u) -gt 14 ]; then
  86. umask 002
  87. else
  88. umask 022
  89. fi
  90. USER=\$(id -un)
  91. PS1="# "
  92. LOGNAME=\$USER
  93. HISTSIZE=1000
  94. HISTFILE="\$HOME/.history"
  95. INPUTRC=/etc/inputrc
  96. TERM="xterm"
  97. _EX
  98. ED=$(find ${woof_path}/usr -name 'mp' -maxdepth 2)
  99. [ -z "$ED" ] && echo "EDITOR=nano" >> $PRFILE || echo "EDITOR=mp" >> $PRFILE
  100. # main env vars
  101. cat >> $PRFILE << _MU
  102. export PS1 USER LOGNAME HISTSIZE INPUTRC EDITOR TERM
  103. XFINANSDIR="/root/.xfinans"
  104. export XFINANSDIR
  105. #v2.10 MU: rox crashes with DRI modules. solution:
  106. export XLIB_SKIP_ARGB_VISUALS=1
  107. #this line gets edited by chooselocale script...
  108. #LANG=en_US.UTF-8
  109. LANG=en_US
  110. export LANG
  111. HOSTNAME="\$(cat /etc/hostname | tr -d "\n")"
  112. export HOSTNAME
  113. SHELL="/bin/bash"
  114. export SHELL
  115. export G_FILENAME_ENCODING=@locale
  116. #sylpheed uses metamail which requires this...
  117. export MM_RUNASROOT=1
  118. DEFAULTBROWSER="\$(cat /usr/local/bin/defaultbrowser | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  119. DEFAULTDRAW="\$(cat /usr/local/bin/defaultdraw | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  120. DEFAULTHTMLEDITOR="\$(cat /usr/local/bin/defaulthtmleditor | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  121. DEFAULTMEDIAPLAYER="\$(cat /usr/local/bin/defaultmediaplayer | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  122. DEFAULTPAINT="\$(cat /usr/local/bin/defaultpaint | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  123. DEFAULTSPREADSHEET="\$(cat /usr/local/bin/defaultspreadsheet | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  124. DEFAULTTEXTEDITOR="\$(cat /usr/local/bin/defaulttexteditor | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  125. DEFAULTWORDPROCESSOR="\$(cat /usr/local/bin/defaultwordprocessor | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  126. DEFAULTIMAGEVIEWER="\$(cat /usr/local/bin/defaultimageviewer | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  127. DEFAULTIMAGEEDITOR="\$(cat /usr/local/bin/defaultimageeditor | tail -n 1 | tr -s " " | cut -f 2 -d " ")"
  128. export DEFAULTBROWSER DEFAULTDRAW DEFAULTHTMLEDITOR DEFAULTMEDIAPLAYER DEFAULTPAINT DEFAULTSPREADSHEET DEFAULTTEXTEDITOR DEFAULTWORDPROCESSOR DEFAULTIMAGEVIEWER DEFAULTIMAGEEDITOR
  129. #freedesktop base directory spec: standards.freedesktop.org/basedir-spec/latest/
  130. export XDG_DATA_HOME=\$HOME/.local/share
  131. export XDG_CONFIG_HOME=\$HOME/.config
  132. export XDG_DATA_DIRS=/usr/share:/usr/local/share
  133. export XDG_CONFIG_DIRS=/etc/xdg
  134. export XDG_CACHE_HOME=\$HOME/.cache
  135. #v2.13...
  136. export HISTFILESIZE=2000
  137. export HISTCONTROL=ignoredups
  138. export PREFIX='/usr'
  139. #xorgwizard creates this file, run once only...
  140. if [ ! -f /tmp/bootcnt.txt ];then
  141. [ -f /etc/resolutionfix ] && eval \$(cat /etc/resolutionfix) 2>/dev/null
  142. fi
  143. for profile_script in /etc/profile.d/* ; do
  144. [ "\$(echo -n "\$profile_script" | grep 'txt\$')" != "" ] && continue
  145. . \$profile_script
  146. done
  147. unset profile_script
  148. alias ls='ls --color=auto'
  149. export LS_COLORS='bd=33:cd=33'
  150. [ -r /etc/profile.local ] && . /etc/profile.local
  151. ###END###
  152. _MU