hackfontsize 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler March 2013, bkhome.org.
  3. #License GPL3 2013 (see /usr/share/doc/legal).
  4. #hack to fix font sizes. Puppy has moved from 78 to 96 dpi.
  5. #can be called from a running puppy, standalone, from ppm, or from woof.
  6. #called from 3builddistro (woof), or /usr/local/petget/hacks-postinstall.sh.
  7. #130326 first release.
  8. #130329 changed stat --format=%Y to stat -c %Y, so busybox applet will work.
  9. #131122 fixe JWMTHEMES var when running woof
  10. GTKRCS=""
  11. JWMTHEMES=""
  12. ROXPREFIX=""
  13. RUNNINGIN="standalone"
  14. [ -d ../rootfs-skeleton ] && [ -d rootfs-complete ] && RUNNINGIN="woof"
  15. [ $1 ] && RUNNINGIN="single" #maybe from ppm when install a package.
  16. case $RUNNINGIN in
  17. standalone) #execute in a running puppy, no passed param.
  18. GTKRCS="`ls /usr/share/themes/*/gtk-2.0/gtkrc | grep -v ' ' | tr '\n' ' '`"
  19. XRESFILE="/root/.Xresources"
  20. JWMTHEMES="`ls /root/.jwm/themes/*-jwmrc | tr '\n' ' '`"
  21. ROXPREFIX="/"
  22. ;;
  23. woof)
  24. #can be run in Woof, called from 3builddistro...
  25. GTKRCS="`ls rootfs-complete/usr/share/themes/*/gtk-2.0/gtkrc | grep -v ' ' | tr '\n' ' '`"
  26. XRESFILE="rootfs-complete/root/.Xresources"
  27. JWMTHEMES="`ls rootfs-complete/root/.jwm/themes/*-jwmrc | tr '\n' ' '`" #rootfs-complete/root/.jwm/jwmrc-theme" #131122 doesn't exist at this point in woof
  28. ROXPREFIX="rootfs-complete/"
  29. ;;
  30. single) #called from ppm.
  31. eval "$@" #ex: GTKRCS=/usr/share/themes/Citrus/gtk-2.0/gtkrc
  32. XRESFILE="/root/.Xresources"
  33. ;;
  34. esac
  35. JWMPREFIX="$ROXPREFIX"
  36. XFTDPI=`grep '^Xft.dpi:' ${XRESFILE} | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' '`
  37. if [ $XFTDPI -ge 96 ];then
  38. if [ "$GTKRCS" ];then
  39. #fix gtk2 themes...
  40. for AGTKRC in $GTKRCS
  41. do
  42. echo -n "" > /tmp/agtkthemefixed
  43. #MODIFYSECS=`stat --format=%Y $AGTKRC`
  44. MODIFYSECS=`stat -c %Y $AGTKRC` #130329
  45. #only hack old themes...
  46. if [ $MODIFYSECS -lt 1364287598 ];then #2013, March 26, 4.47pm
  47. echo "Fixing: ${AGTKRC}"
  48. cat ${AGTKRC} |
  49. while read ALINE
  50. do
  51. ALINEx="$(echo -n "$ALINE" | sed -e 's%Sans 11%Sans 9%' -e 's%Sans 12%Sans 10%' -e 's%Sans 13%Sans 11%' -e 's%Sans 14%Sans 12%')"
  52. echo "$ALINEx" >> /tmp/agtkthemefixed
  53. done
  54. sync
  55. cp -f /tmp/agtkthemefixed ${AGTKRC}
  56. fi
  57. done
  58. fi
  59. #fix jwm themes...
  60. if [ "$JWMTHEMES" ];then
  61. for AJWMTHEME in $JWMTHEMES
  62. do
  63. echo -n "" > /tmp/ajwmthemefixed
  64. #MODIFYSECS=`stat --format=%Y ${AJWMTHEME}`
  65. MODIFYSECS=`stat -c %Y ${AJWMTHEME}` #130329
  66. if [ "$MODIFYSECS" -lt 1364287598 ];then #2013, March 26, 4.47pm
  67. echo "Fixing: ${AJWMTHEME}"
  68. cat $AJWMTHEME |
  69. while read ALINE
  70. do
  71. ALINEx="$(echo -n "$ALINE" | sed -e 's%Sans-11%Sans-9%' -e 's%Sans-12%Sans-10%' -e 's%Sans-13%Sans-11%' -e 's%Sans-14%Sans-12%' -e 's%Sans-15%Sans-13%' -e 's%Sans-16%Sans-14%')"
  72. echo "$ALINEx" >> /tmp/ajwmthemefixed
  73. done
  74. sync
  75. cp -f /tmp/ajwmthemefixed $AJWMTHEME
  76. fi
  77. done
  78. fi
  79. if [ "$JWMPREFIX" ];then
  80. if [ -f ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc ];then
  81. echo -n "" > /tmp/jwmrctemplatefixed
  82. #MODIFYSECS=`stat --format=%Y ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc`
  83. MODIFYSECS=`stat -c %Y ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc`
  84. if [ $MODIFYSECS -lt 1364287598 ];then #2013, March 26, 4.47pm
  85. echo "Fixing: ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc"
  86. cat ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc |
  87. while read ALINE
  88. do
  89. ALINEx="$(echo -n "$ALINE" | sed -e 's%Sans-11%Sans-9%' -e 's%Sans-12%Sans-10%' -e 's%Sans-13%Sans-11%' -e 's%Sans-14%Sans-12%' -e 's%Sans-15%Sans-13%' -e 's%Sans-16%Sans-14%')"
  90. echo "$ALINEx" >> /tmp/jwmrctemplatefixed
  91. done
  92. sync
  93. cp -f /tmp/jwmrctemplatefixed ${JWMPREFIX}etc/xdg/templates/_root_.jwmrc
  94. if [ "$RUNNINGIN" = "standalone" ];then
  95. fixmenus
  96. #jwm -restart
  97. fi
  98. fi
  99. fi
  100. fi
  101. #fix rox-filer...
  102. if [ "$ROXPREFIX" ];then
  103. echo -n "" > /tmp/aroxthemefixed
  104. if [ -f ${ROXPREFIX}root/.config/rox.sourceforge.net/ROX-Filer/Options ];then
  105. MODIFYSECS=`stat -c %Y ${ROXPREFIX}root/.config/rox.sourceforge.net/ROX-Filer/Options`
  106. if [ $MODIFYSECS -lt 1364287598 ];then #2013, March 26, 4.47pm
  107. echo "Fixing: ${ROXPREFIX}root/.config/rox.sourceforge.net/ROX-Filer/Options"
  108. cat ${ROXPREFIX}root/.config/rox.sourceforge.net/ROX-Filer/Options |
  109. while read ALINE
  110. do
  111. ALINEx="$(echo -n "$ALINE" | sed -e 's%Sans 11%Sans 9%' -e 's%Sans 12%Sans 10%' -e 's%Sans 13%Sans 11%' -e 's%Sans 14%Sans 12%')"
  112. echo "$ALINEx" >> /tmp/aroxthemefixed
  113. done
  114. sync
  115. cp -f /tmp/aroxthemefixed ${ROXPREFIX}root/.config/rox.sourceforge.net/ROX-Filer/Options
  116. fi
  117. fi
  118. fi
  119. if [ "$RUNNINGIN" = "standalone" ];then
  120. echo "Please restart X to see changes."
  121. fi
  122. fi
  123. ###END###