Advertisement
s243a

/usr/sbin/indexgen.sh

Jun 16th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.18 KB | None | 0 0
  1. #!/bin/bash
  2. #(c) Copyright Barry Kauler 2009, puppylinux.com.
  3. #2009 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
  4. #generates index.html master help page. called from petget, rc.update,
  5. #  /usr/local/petget/installpreview.sh, 3builddistro (in Woof).
  6. #w012 commented-out drop-down for all installed pkgs as too big in Ubuntu-Puppy.
  7. #w016 support/find_homepages (in Woof) used to manually update HOMEPAGEDB variable.
  8. #w019 now have /root/.packages/PKGS_HOMEPAGES
  9. #w464 reintroduce dropdown help for all builtin packages.
  10. #v423 file PKGS_HOMEPAGES is now a db of all known pkgs, not just in puppy.
  11. #120225 copy from raw doc files.
  12.  
  13. export LANG=C
  14. . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION, DISTRO_PUPPYDATE
  15. . /root/.packages/DISTRO_PKGS_SPECS
  16.  
  17. WKGDIR="`pwd`"
  18.  
  19. #120225 this is done in Woof by rootfs-skeleton/pinstall.sh, but do need to do it
  20. #here to support language translations (see /usr/share/sss/doc_strings)...
  21. if [ -f /usr/share/doc/index.html.top-raw ];then #see Woof rootfs-skeleton/pinstall.sh, also /usr/share/sss/doc_strings
  22.  cp -f /usr/share/doc/index.html.top-raw /usr/share/doc/index.html.top
  23.  cp -f /usr/share/doc/index.html.bottom-raw /usr/share/doc/index.html.bottom
  24.  cp -f /usr/share/doc/home-raw.htm /usr/share/doc/home.htm
  25.  
  26.  cutDISTRONAME="`echo -n "$DISTRO_NAME" | cut -f 1 -d ' '`"
  27.  cPATTERN="s/cutDISTRONAME/${cutDISTRONAME}/g"
  28.  RIGHTVER="$DISTRO_VERSION"
  29.  dPATTERN="s/PUPPYDATE/${DISTRO_PUPPYDATE}/g"
  30.  PATTERN1="s/RIGHTVER/${RIGHTVER}/g"
  31.  PATTERN2="s/DISTRO_VERSION/${DISTRO_VERSION}/g"
  32.  nPATTERN="s/DISTRO_NAME/${DISTRO_NAME}/g"
  33.  
  34.  sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" -e "$cPATTERN" /usr/share/doc/index.html.top
  35.  sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" /usr/share/doc/index.html.bottom
  36.  #...note, /usr/sbin/indexgen.sh puts these together as index.html (normally via rc.update and 3builddistro).
  37.  
  38.  sed -i -e "$nPATTERN" /usr/share/doc/home.htm
  39. fi
  40.  
  41. #search for installed pkgs with descriptions...
  42.  
  43. #search .desktop files...
  44. PKGINFO1="`ls -1 /usr/share/applications | sed -e 's%^%/usr/share/applications/%' | xargs cat - | grep '^Name=' | cut -f 2 -d '='`"
  45. #...normal format of each entry is 'name description', ex: 'Geany text editor'.
  46.  
  47. EXCLLISTsd=" 0rootfs_skeleton autologin bootflash burniso2cd cd/dvd check configure desktop format network pupdvdtool wallpaper pbackup pburn pcdripper pdict pdisk pdvdrsab pmetatagger pschedule pstopwatch prename pprocess pmirror pfind pcdripper pmount puppy pupctorrent pupscan pupx pwireless set text "
  48.  
  49. cp -f /usr/share/doc/index.html.top /tmp/newinfoindex.xml
  50.  
  51. #dropdown menu for apps in menu...
  52. #echo '<p>Applications available in the desktop menu:</p>' >>/tmp/newinfoindex.xml
  53. #echo '<center>
  54. #<form name="form">
  55. #<select name="site" size="1" onchange="javascript:formHandler()">
  56. #' >>/tmp/newinfoindex.xml
  57. #echo "$PKGINFO1" |
  58. #while read ONEINFO
  59. #do
  60. # NAMEONLY="`echo "$ONEINFO" | cut -f 1 -d ' ' | tr [A-Z] [a-z]`"
  61. # EXPATTERN=" $NAMEONLY "
  62. # nEXPATTERN="^$NAMEONLY "
  63. # [ "`echo "$EXCLLISTsd" | grep -i "$EXPATTERN"`" != "" ] && continue
  64. # HOMESITE="http://en.wikipedia.org/wiki/${NAMEONLY}"
  65. # REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nEXPATTERN" | head -n 1 | cut -f 2 -d ' '`"
  66. # [ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
  67. # echo "<option value=\"${HOMESITE}\">${ONEINFO}" >> /tmp/newinfoindex.xml
  68. #done
  69. #echo '</select>
  70. #</form>
  71. #</center>
  72. #' >> /tmp/newinfoindex.xml
  73.  
  74. #w464 dropdown list of all builtin pkgs...
  75. #echo '<p>Complete list of packages (in Puppy or not):</p>' >>/tmp/newinfoindex.xml
  76. #echo '<center>
  77. #<form name="form2">
  78. #<select name="site2" size="1" onchange="javascript:formHandler2()">
  79. #' >>/tmp/newinfoindex.xml
  80. #sed -e 's% %|%' -e 's%$%|%' /root/.packages/PKGS_HOMEPAGES > /tmp/pkgs_homepages_mod
  81. #printcols /tmp/pkgs_homepages_mod 2 1 | sed -e 's%^%<option value="%' -e 's%|$%#%' -e 's%|%">%' -e 's%#$%%' >> /tmp/newinfoindex.xml
  82. #sync
  83. #echo '</select>
  84. #</form>
  85. #</center>
  86. #' >> /tmp/newinfoindex.xml
  87.  
  88. #now complete the index.html file...
  89. cat /usr/share/doc/index.html.bottom >> /tmp/newinfoindex.xml
  90. mv -f /tmp/newinfoindex.xml /usr/share/doc/index.html
  91.  
  92.  
  93. ###END###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement