PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/ie/japanese-ie-generator.sh

http://fanboyadblock.codeplex.com
Shell | 83 lines | 25 code | 14 blank | 44 comment | 1 complexity | c3beed36fc25d49bccb4983133d6d96b MD5 | raw file
  1. #!/bin/bash
  2. #
  3. # Fanboy Japanese IE Convert script v1.2 (17/04/2011)
  4. # Dual License CCby3.0/GPLv2
  5. # http://creativecommons.org/licenses/by/3.0/
  6. # http://www.gnu.org/licenses/gpl-2.0.html
  7. #
  8. # Creating a 10Mb ramdisk Temp storage...
  9. #
  10. if [ ! -d "/tmp/ieramdisk/" ]; then
  11. rm -rf /tmp/ieramdisk/
  12. mkdir /tmp/ieramdisk; chmod 777 /tmp/ieramdisk
  13. mount -t tmpfs -o size=10M tmpfs /tmp/ieramdisk/
  14. cp -f /home/fanboy/google/fanboy-adblock-list/scripts/ie/combineSubscriptions.py /tmp/ieramdisk/
  15. mkdir /tmp/ieramdisk/subscriptions
  16. fi
  17. # Variables
  18. #
  19. MAINDIR="/var/www/adblock"
  20. GOOGLEDIR="/home/fanboy/google/fanboy-adblock-list"
  21. ZIP="/usr/local/bin/7za"
  22. IEDIR="/tmp/ieramdisk"
  23. SUBS="/tmp/ieramdisk/subscriptions"
  24. # Clear out any old files lurking
  25. #
  26. rm -rf $IEDIR/*.txt $SUBS/*
  27. cd $IEDIR
  28. # Copy TPL (Microsoft IE9) Script
  29. #
  30. # cp -f /root/maketpl.pl $IEDIR
  31. ####### Placeholder ########
  32. # Cleanup fanboy-jpn-addon.txt (remove the top 8 lines)
  33. #
  34. # sed '1,8d' $GOOGLEDIR/ie/fanboy-jpn-addon.txt > $IEDIR/fanboy-jpn-addon.txt
  35. # Take out the element blocks from the list
  36. #
  37. sed -n '/Adblock Plus/,/Japanese Generic/{/Japanese Generic/!p}' $GOOGLEDIR/firefox-regional/fanboy-adblocklist-jpn.txt > $IEDIR/fanboy-japanese.txt
  38. ####### Placeholder ########
  39. # Merge with Google-code (IE adblock addon)
  40. #
  41. # cat $IEDIR/fanboy-japanese.txt $IEDIR/fanboy-jpn-addon.txt > $IEDIR/fanboy-jpn-merged.txt
  42. # mv -f $IEDIR/fanboy-jpn-merged.txt $IEDIR/fanboy-japanese.txt
  43. ####### Placeholder ########
  44. # Remove Old files
  45. #
  46. # rm -rf $IEDIR/fanboy-jpn-addon.txt
  47. # Generate .tpl IE list
  48. #
  49. # perl $IEDIR/maketpl.pl &> /dev/null
  50. python $IEDIR/combineSubscriptions.py
  51. # Now remove filters that cause issues in IE (and false positives)
  52. #
  53. sed -i '/# \./d' $SUBS/fanboy-japanese.tpl
  54. sed -i '/# \//d' $SUBS/fanboy-japanese.tpl
  55. sed -i '/# ||/d' $SUBS/fanboy-japanese.tpl
  56. sed -i '/# @@/d' $SUBS/fanboy-japanese.tpl
  57. # Remove last line of file
  58. #
  59. sed '$d' $SUBS/fanboy-japanese.tpl > $SUBS/fanboy-japanese-trim.tpl
  60. mv -f $SUBS/fanboy-japanese-trim.tpl $SUBS/fanboy-japanese.tpl
  61. # Remove old gz file
  62. #
  63. rm -f $SUBS/fanboy-japanese.tpl*.gz
  64. # Re-compress newly modified file
  65. #
  66. $ZIP a -mx=9 -y -tgzip $SUBS/fanboy-japanese.tpl.gz $SUBS/fanboy-japanese.tpl > /dev/null
  67. # Now copy finished tpl list to the website.
  68. #
  69. cp -f $SUBS/fanboy-japanese*.tpl* $MAINDIR/ie/