KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.7KB

  1. #!/bin/bash
  2. set -e
  3. cd $(dirname "${0}")
  4. REPO_TARGET="${1}"
  5. if [ -z "${REPO_TARGET}" ]; then
  6. echo "usage: ${0} <apps|plugins>"
  7. exit 1
  8. fi
  9. PACKAGES_ARCHS=("amd64" "arm64" "armhf" "i386")
  10. PACKAGES_BLACKLIST=("calf-ladspa" "carla-lv2" "carla-vst" "carla-bridge-linux32" "carla-bridge-linux64" "distrho-src" "lv2vst")
  11. PACKAGES_BASE_URL="http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/"
  12. rm -f Packages.gz Packages
  13. wget -q http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/dists/bionic/main/binary-amd64/Packages.gz
  14. gzip -d Packages.gz
  15. PACKAGES=$(cat Packages | grep "Package: " | sed "s/Package: //g" | sort)
  16. function is_blacklisted() {
  17. local TEST="${1}"
  18. local PACKAGE
  19. for PACKAGE in ${PACKAGES_BLACKLIST[@]}; do
  20. if [ ${TEST} = ${PACKAGE} ]; then
  21. return 0
  22. fi
  23. done
  24. return 1
  25. }
  26. function has_data_package() {
  27. local TEST="${1}-data"
  28. local PACKAGE
  29. for PACKAGE in ${PACKAGES[@]}; do
  30. if [ ${TEST} = ${PACKAGE} ]; then
  31. return 0
  32. fi
  33. done
  34. return 1
  35. }
  36. for PACKAGE in ${PACKAGES[@]}; do
  37. if is_blacklisted ${PACKAGE}; then
  38. continue
  39. fi
  40. PACKAGE_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE}" | cut -d ':' -f 1)
  41. PACKAGE_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  42. if [ -n "${PACKAGE_NUMLINES}" ]; then
  43. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART} | head -n ${PACKAGE_NUMLINES})
  44. else
  45. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART})
  46. fi
  47. PACKAGE_FILENAME=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Filename: ","")')
  48. if echo "${PACKAGE_FILENAME}" | grep -q "_all.deb"; then
  49. continue
  50. fi
  51. PACKAGE_DATA=$(has_data_package "${PACKAGE}" && echo "${PACKAGE}-data" || echo)
  52. PACKAGE_DESCRIPTION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Description: ","")')
  53. PACKAGE_PROVIDES=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Provides: ","")')
  54. PACKAGE_SIZE=$(echo "${PACKAGE_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  55. PACKAGE_VERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2 | cut -d '-' -f 1)
  56. echo "<div class=\"repository-package\">"
  57. # screenshot
  58. SCREENSHOT=${PACKAGE}
  59. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  60. SCREENSHOT=$(echo "${SCREENSHOT}" | sed "s/-lv2//g" | sed "s/-vst//g")
  61. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  62. SCREENSHOT=""
  63. fi
  64. fi
  65. if [ -n "${SCREENSHOT}" ]; then
  66. echo "<div><a href=\"/repo/screenshots/${SCREENSHOT}.png\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/></a></div>"
  67. else
  68. echo "<div><img src=\"/repo/screenshots/nogui.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/></div>"
  69. fi
  70. # full table
  71. echo "<div><table>"
  72. echo "<tr><td>Package Name:</td><td>${PACKAGE}</td></tr>"
  73. echo "<tr><td>Description:</td><td>${PACKAGE_DESCRIPTION}</td></tr>"
  74. echo "<tr><td>Version:</td><td>${PACKAGE_VERSION}</td></tr>"
  75. echo "<tr><td>Expected size:</td><td>"
  76. if [ ${PACKAGE_SIZE} -gt 999999 ]; then
  77. echo "$((${PACKAGE_SIZE} / 1024 / 1024))Mb"
  78. else
  79. echo "$((${PACKAGE_SIZE} / 1024))Kb"
  80. fi
  81. if [ -n "${PACKAGE_DATA}" ]; then
  82. PACKAGE_DATA_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE_DATA}" | cut -d ':' -f 1)
  83. PACKAGE_DATA_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_DATA_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  84. if [ -n "${PACKAGE_DATA_NUMLINES}" ]; then
  85. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART} | head -n ${PACKAGE_DATA_NUMLINES})
  86. else
  87. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART})
  88. fi
  89. PACKAGE_DATA_SIZE=$(echo "${PACKAGE_DATA_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  90. echo "+ $((${PACKAGE_DATA_SIZE} / 1024 / 1024))Mb (data)"
  91. fi
  92. echo "</td></tr>"
  93. if [ ${REPO_TARGET} = "plugins" ]; then
  94. if [ -z "${PACKAGE_PROVIDES}" ]; then
  95. echo "<tr><td>Provides:</td><td>??</td></tr>"
  96. else
  97. echo "<tr><td>Provides:</td><td>"
  98. if echo "${PACKAGE_PROVIDES}" | grep -q standalone-plugin; then
  99. echo "Standalone "
  100. fi
  101. if echo "${PACKAGE_PROVIDES}" | grep -q ladspa-plugin; then
  102. echo "LADSPA "
  103. fi
  104. if echo "${PACKAGE_PROVIDES}" | grep -q dssi-plugin; then
  105. echo "DSSI "
  106. fi
  107. if echo "${PACKAGE_PROVIDES}" | grep -q lv2-plugin; then
  108. echo "LV2 "
  109. fi
  110. if echo "${PACKAGE_PROVIDES}" | grep -q vst-plugin; then
  111. echo "VST2 "
  112. fi
  113. if echo "${PACKAGE_PROVIDES}" | grep -q vst3-plugin; then
  114. echo "VST3 "
  115. fi
  116. echo "</td></tr>"
  117. fi
  118. fi
  119. echo "<tr><td>Downloads:</td><td>"
  120. for ARCH in ${PACKAGES_ARCHS[@]}; do
  121. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_${ARCH}.deb/g")
  122. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">${ARCH}</a>&nbsp;&nbsp;"
  123. done
  124. if [ -n "${PACKAGE_DATA}" ]; then
  125. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}_|/${PACKAGE_DATA}_|g" | sed "s/_amd64.deb/_all.deb/g")
  126. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_DATA}\" target=\"_blank\">data</a>"
  127. fi
  128. echo "</tr>"
  129. echo "</table></div></div>"
  130. # separator
  131. echo "<br/>"
  132. echo
  133. done
  134. rm -f Packages.gz Packages