package-html-gen 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. # Build freon's package.list
  3. # Version: 0.0.1
  4. # (C) Chris Dorman, 2020 GPLv3+
  5. HTDOCSPATH="/opt/htdocs/freon"
  6. OUTPUTFILE="packages.html"
  7. mirrorurl="https://mirror.freonlinux.com"
  8. ### HEADER HTML
  9. HEADERHTML="<!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>Freon Linux ~ Package list</title>
  13. <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
  14. <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">
  15. <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
  16. </head>
  17. <body>
  18. <div id=\"navcontainer\">
  19. <div id=\"navbar\"><!--
  20. --><a href=\"index.html\">Home</a><!--
  21. --><a href=\"https://mirror.freonlinux.com\">Files</a><!--
  22. --><a href=\"https://notabug.org/Pentium44/FreonLinux\">Compile</a><!--
  23. --><a href=\"wiki.html\">Wiki</a><!--
  24. --><a href=\"packages.html\">Repo</a><!--
  25. --></div>
  26. </div>
  27. <div id=\"contentcontainer\">
  28. <div id=\"content\">
  29. <table class=\"sidebar\">
  30. <tr>
  31. <td class=\"contentbody\">
  32. <h2>Freon Linux ~ Packages</h2>
  33. <p>"
  34. ### FOOTER HTML
  35. FOOTERHTML="</p>
  36. <h3>Package sources</h3>
  37. <p>All of our sources can be found <a href=\"$mirrorurl/source/packages\">here</a>
  38. or in our <a href=\"https://notabug.org/Pentium44/FreonLinux\">notabug.org repository</a></p>
  39. </tr>
  40. </table>
  41. </div>
  42. <div id=\"footer\">
  43. &copy; Freon Linux, 2018-2021 GPLv3 (Software provided in Freon is subject to their own license agreements)
  44. </div>
  45. </div>
  46. </body>
  47. </html>"
  48. echo "MAKE SURE THE ONLY .tgz FILES ARE PACKAGES IN THE REPO WITHIN THE SAME DIRECTORY OF THIS FILE!"
  49. sleep 1
  50. echo $HEADERHTML > $HTDOCSPATH/$OUTPUTFILE
  51. echo "<ul>" >> $HTDOCSPATH/$OUTPUTFILE
  52. for f in *.tgz
  53. do
  54. filename=${f%.tgz}
  55. pkgdesc=$(cat ../pkginfo/$filename.txt)
  56. echo "<li><a href='$mirrorurl/packages/$filename.tgz'>$filename</a> $pkgdesc" >> $HTDOCSPATH/$OUTPUTFILE
  57. if [ -f ../deps/$filename.deps ]; then
  58. echo "<br /><span style='font-size:12px;'>dependencies:" >> $HTDOCSPATH/$OUTPUTFILE
  59. last_line=$(wc -l < ../deps/$filename.deps)
  60. current_line=0
  61. while IFS= read -r line
  62. do
  63. current_line=$(($current_line + 1))
  64. if [[ $current_line -ne $last_line ]]; then
  65. echo "<a href='$mirrorurl/packages/$line.tgz'>$line</a>, " >> $HTDOCSPATH/$OUTPUTFILE
  66. else
  67. echo "<a href='$mirrorurl/packages/$line.tgz'>$line</a>.</span></li>" >> $HTDOCSPATH/$OUTPUTFILE
  68. fi
  69. done < "../deps/$filename.deps"
  70. else
  71. echo "</li>" >> $HTDOCSPATH/$OUTPUTFILE
  72. fi
  73. done
  74. echo "</ul>" >> $HTDOCSPATH/$OUTPUTFILE
  75. echo $FOOTERHTML >> $HTDOCSPATH/$OUTPUTFILE