hacks-postinstall.sh 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #!/bin/sh
  2. #this is for hacks needed to fix a package, that might not have been done elsewhere.
  3. #called from /usr/local/petget/installpkg.sh
  4. #package that has just been installed is passed in on commandline.
  5. #120924 DejaVu font no good for non-Latin languages. 120925 add korean.
  6. #130122 xsane: remove warning about running as root.
  7. #130221 pemasu: google-chrome run as root. 130224 pemasu: limit cache size.
  8. #130326 pass in $DLPKG_NAME as $2. font size fix for 96 dpi.
  9. #130507 kompozer needs MOZILLA_FIVE_HOME fix.
  10. INSTALLEDPKG="$1" #ex: vlc_2.0.3-0ubuntu0.12.04.1_i386, without .deb
  11. INSTALLEDNAME="$2" #130326
  12. case $INSTALLEDPKG in
  13. vlc-nox_*)
  14. #120907 vlc in debian/ubuntu configured to not run as root (it is a pre-compile configure option to enable running as root).
  15. #this hack will fix it...
  16. #note, this code is also in FIXUPHACK in 'vlc' template.
  17. if [ -f /usr/bin/bbe ];then #bbe is a sed-like utility for binary files.
  18. if [ -f /usr/bin/vlc ];then
  19. bbe -e 's/geteuid/getppid/' /usr/bin/vlc > /tmp/vlc-temp1
  20. mv -f /tmp/vlc-temp1 /usr/bin/vlc
  21. chmod 755 /usr/bin/vlc
  22. fi
  23. fi
  24. ;;
  25. google-chrome-*) #130221 pemasu. 130224 pemasu: limit cache size...
  26. if [ -f /usr/bin/bbe ];then #bbe is a sed-like utility for binary files.
  27. if [ -f /opt/google/chrome/chrome ];then
  28. bbe -e 's/geteuid/getppid/' /opt/google/chrome/chrome > /tmp/chrome-temp1
  29. mv -f /tmp/chrome-temp1 /opt/google/chrome/chrome
  30. chmod 755 /opt/google/chrome/chrome
  31. [ -e /usr/bin/google-chrome ] && rm -f /usr/bin/google-chrome
  32. echo '#!/bin/sh
  33. exec /opt/google/chrome/google-chrome --user-data-dir=/root/.config/chrome --disk-cache-size=10000000 --media-cache-size=10000000 "$@"' > /usr/bin/google-chrome
  34. chmod 755 /usr/bin/google-chrome
  35. ln -s google-chrome /usr/bin/chrome
  36. ln -s /opt/google/chrome/product_logo_48.png /usr/share/pixmaps/google-chrome.png
  37. ln -s /opt/google/chrome/product_logo_48.png /usr/share/pixmaps/chrome.png
  38. CHROMEDESKTOP="`find /usr/share/applications -mindepth 1 -maxdepth 1 -iname '*chrome*.desktop'`"
  39. if [ "$CHROMEDESKTOP" = "" ];then #precaution.
  40. echo '[Desktop Entry]
  41. Encoding=UTF-8
  42. Version=1.0
  43. Name=Google Chrome web browser
  44. GenericName=Google Chrome
  45. Comment=Google Chrome web browser
  46. Exec=google-chrome
  47. Terminal=false
  48. Type=Application
  49. Icon=google-chrome.png
  50. Categories=WebBrowser;' > /usr/share/applications/google-chrome.desktop
  51. fi
  52. fi
  53. fi
  54. ;;
  55. jwm_theme_*)
  56. #120924 DejaVu font no good for non-Latin languages...
  57. #see also langpack_* pinstall.sh (template is in /usr/share/doc/langpack-template/pinstall.sh, read by momanager).
  58. LANGUSER="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  59. case $LANGUSER in
  60. zh*|ja*|ko*) #chinese, japanese, korean
  61. sed -i -e 's%DejaVu Sans%Sans%' /etc/xdg/templates/_root_*
  62. sed -i -e 's%DejaVu Sans%Sans%' /root/.jwm/themes/*-jwmrc
  63. sed -i -e 's%DejaVu Sans%Sans%' /root/.jwm/jwmrc-theme
  64. ;;
  65. esac
  66. #130326 font size fix for 96 dpi...
  67. if [ "$INSTALLEDNAME" ];then
  68. JWMTHEMEFILE="$(grep '^/root/\.jwm/themes/.*-jwmrc$' /root/.packages/${INSTALLEDNAME}.files | head -n 1)"
  69. [ "$JWMTHEMEFILE" ] && hackfontsize "JWMTHEMES='${JWMTHEMEFILE}'"
  70. fi
  71. ;;
  72. openbox*)
  73. #120924 DejaVu font no good for non-Latin languages...
  74. #see also langpack_* pinstall.sh (template is in /usr/share/doc/langpack-template/pinstall.sh, read by momanager).
  75. LANGUSER="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  76. case $LANGUSER in
  77. zh*|ja*|ko*) #chinese, japanese, korean
  78. sed -i -e 's%DejaVu Sans%Sans%' /etc/xdg/openbox/*.xml
  79. sed -i -e 's%DejaVu Sans%Sans%' /root/.config/openbox/*.xml
  80. ;;
  81. esac
  82. ;;
  83. gtk_theme_*)
  84. #120924 DejaVu font no good for non-Latin languages...
  85. #see also langpack_* pinstall.sh (template is in /usr/share/doc/langpack-template/pinstall.sh, read by momanager).
  86. LANGUSER="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  87. case $LANGUSER in
  88. zh*|ja*|ko*) #chinese, japanese, korean
  89. GTKRCFILE="$(find /usr/share/themes -type f -name gtkrc | tr '\n' ' ')"
  90. for ONEGTKRC in $GTKRCFILE
  91. do
  92. sed -i -e 's%DejaVu Sans%Sans%' $ONEGTKRC
  93. done
  94. ;;
  95. esac
  96. #130326 font size fix for 96 dpi...
  97. if [ "$INSTALLEDNAME" ];then
  98. GTKTHEMEFILE="$(grep '^/usr/share/themes/.*/gtk-2\.0/gtkrc$' /root/.packages/${INSTALLEDNAME}.files | head -n 1)"
  99. [ "$GTKTHEMEFILE" ] && hackfontsize "GTKRCS='${GTKTHEMEFILE}'"
  100. fi
  101. ;;
  102. seamonkey*|firefox*)
  103. #120924 DejaVu font no good for non-Latin languages...
  104. #see also langpack_* pinstall.sh (template is in /usr/share/doc/langpack-template/pinstall.sh, read by momanager).
  105. LANGUSER="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  106. case $LANGUSER in
  107. zh*|ja*|ko*) #chinese, japanese, korean
  108. MOZFILE="$(find /root/.mozilla -type f -name prefs.js -o -name '*.css' | tr '\n' ' ')"
  109. for ONEMOZ in $MOZFILE
  110. do
  111. sed -i -e 's%DejaVu Sans%Sans%' $ONEMOZ
  112. done
  113. ;;
  114. esac
  115. ;;
  116. mc_*) #121206 midnight commander
  117. #in ubuntu, won't run from the menu. this fixes it...
  118. [ -f /usr/share/applications/mc.desktop ] && sed -i -e 's%^Exec=.*%Exec=TERM=xterm mc%' /usr/share/applications/mc.desktop
  119. ;;
  120. xsane*) #130122
  121. #xsane puts up a warning msg at startup if running as root, remove it...
  122. #this code is also in file FIXUPHACK in xsane template (in Woof).
  123. #WARNING: this may only work for x86 binary.
  124. if [ -f /usr/bin/bbe ];then #bbe is a sed-like utility for binary files.
  125. if [ -f /usr/bin/xsane ];then
  126. bbe -e 's/\x6b\x00getuid/\x6b\x00getpid/' /usr/bin/xsane > /tmp/xsane-temp1
  127. mv -f /tmp/xsane-temp1 /usr/bin/xsane
  128. chmod 755 /usr/bin/xsane
  129. fi
  130. fi
  131. ;;
  132. kompozer*) #130507
  133. [ -f /usr/bin/kompozer ] && [ -d /usr/lib/kompozer ] && sed -i -e 's%^moz_libdir=%export MOZILLA_FIVE_HOME="/usr/lib/kompozer" #BK\nmoz_libdir=%' /usr/bin/kompozer
  134. ;;
  135. esac