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.

193 lines
7.4KB

  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=("carla-bridge-linux32" "carla-bridge-linux64" "distrho-src" "lv2vst")
  11. PACKAGES_WHITELIST=("cadence" "catia" "claudia")
  12. PACKAGES_BASE_URL="http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/"
  13. rm -f Packages.gz Packages
  14. wget -q http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/dists/bionic/main/binary-amd64/Packages.gz
  15. gzip -d Packages.gz
  16. PACKAGES=$(cat Packages | grep "Package: " | sed "s/Package: //g" | sort)
  17. function is_blacklisted() {
  18. local TEST="${1}"
  19. local PACKAGE
  20. for PACKAGE in ${PACKAGES_BLACKLIST[@]}; do
  21. if [ ${TEST} = ${PACKAGE} ]; then
  22. return 0
  23. fi
  24. done
  25. return 1
  26. }
  27. function is_whitelisted() {
  28. local TEST="${1}"
  29. local PACKAGE
  30. for PACKAGE in ${PACKAGES_WHITELIST[@]}; do
  31. if [ ${TEST} = ${PACKAGE} ]; then
  32. return 0
  33. fi
  34. done
  35. return 1
  36. }
  37. function has_data_package() {
  38. local TEST="${1}-data"
  39. local PACKAGE
  40. for PACKAGE in ${PACKAGES[@]}; do
  41. if [ ${TEST} = ${PACKAGE} ]; then
  42. return 0
  43. fi
  44. done
  45. return 1
  46. }
  47. for PACKAGE in ${PACKAGES[@]}; do
  48. if is_blacklisted ${PACKAGE} || echo "${PACKAGE}" | grep -q -- "-static"; then
  49. continue
  50. fi
  51. PACKAGE_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE}" | cut -d ':' -f 1)
  52. PACKAGE_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  53. if [ -n "${PACKAGE_NUMLINES}" ]; then
  54. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART} | head -n ${PACKAGE_NUMLINES})
  55. else
  56. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART})
  57. fi
  58. PACKAGE_FILENAME=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Filename: ","")')
  59. if echo "${PACKAGE_FILENAME}" | grep -q "_all.deb" && ! is_whitelisted "${PACKAGE}"; then
  60. continue
  61. fi
  62. PACKAGE_DATA=$(has_data_package "${PACKAGE}" && echo "${PACKAGE}-data" || echo)
  63. PACKAGE_DESCRIPTION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Description: ","")')
  64. PACKAGE_PROVIDES=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Provides: ","")')
  65. PACKAGE_SIZE=$(echo "${PACKAGE_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  66. PACKAGE_VERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2 | cut -d '-' -f 1)
  67. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  68. PACKAGE="carla-bridge-win"
  69. PACKAGE_DESCRIPTION="carla windows bridge"
  70. fi
  71. echo "<div class=\"repository-package\">"
  72. # screenshot
  73. SCREENSHOT=${PACKAGE}
  74. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  75. SCREENSHOT=$(echo "${SCREENSHOT}" | sed "s/-lv2//g" | sed "s/-vst//g")
  76. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  77. SCREENSHOT=""
  78. fi
  79. fi
  80. if [ -n "${SCREENSHOT}" ]; then
  81. echo "<div class=\"img_clickable\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/>"
  82. echo "<div class=\"img_clickable_overlay\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\"/></div>"
  83. echo "</div>"
  84. else
  85. echo "<div><img src=\"/repo/screenshots/nogui.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/></div>"
  86. fi
  87. # full table
  88. echo "<div><table>"
  89. echo "<tr><td>Package Name:</td><td>${PACKAGE}</td></tr>"
  90. echo "<tr><td>Description:</td><td>${PACKAGE_DESCRIPTION}</td></tr>"
  91. echo "<tr><td>Version:</td><td>${PACKAGE_VERSION}</td></tr>"
  92. echo "<tr><td>Expected size:</td><td>"
  93. if [ ${PACKAGE_SIZE} -gt 999999 ]; then
  94. echo "$((${PACKAGE_SIZE} / 1024 / 1024))Mb"
  95. else
  96. echo "$((${PACKAGE_SIZE} / 1024))Kb"
  97. fi
  98. if [ -n "${PACKAGE_DATA}" ]; then
  99. PACKAGE_DATA_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE_DATA}" | cut -d ':' -f 1)
  100. PACKAGE_DATA_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_DATA_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  101. if [ -n "${PACKAGE_DATA_NUMLINES}" ]; then
  102. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART} | head -n ${PACKAGE_DATA_NUMLINES})
  103. else
  104. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART})
  105. fi
  106. PACKAGE_DATA_SIZE=$(echo "${PACKAGE_DATA_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  107. if [ ${PACKAGE_DATA_SIZE} -gt 999999 ]; then
  108. echo "+ $((${PACKAGE_DATA_SIZE} / 1024 / 1024))Mb (data)"
  109. else
  110. echo "+ $((${PACKAGE_DATA_SIZE} / 1024))Kb (data)"
  111. fi
  112. fi
  113. echo "</td></tr>"
  114. if [ ${REPO_TARGET} = "plugins" ]; then
  115. if [ -z "${PACKAGE_PROVIDES}" ]; then
  116. echo "<tr><td>Provides:</td><td>??</td></tr>"
  117. else
  118. echo "<tr><td>Provides:</td><td>"
  119. if echo "${PACKAGE_PROVIDES}" | grep -q standalone-plugin; then
  120. echo "Standalone "
  121. fi
  122. if echo "${PACKAGE_PROVIDES}" | grep -q ladspa-plugin; then
  123. echo "LADSPA "
  124. fi
  125. if echo "${PACKAGE_PROVIDES}" | grep -q dssi-plugin; then
  126. echo "DSSI "
  127. fi
  128. if echo "${PACKAGE_PROVIDES}" | grep -q lv2-plugin; then
  129. echo "LV2 "
  130. fi
  131. if echo "${PACKAGE_PROVIDES}" | grep -q vst-plugin; then
  132. echo "VST2 "
  133. fi
  134. if echo "${PACKAGE_PROVIDES}" | grep -q vst3-plugin; then
  135. echo "VST3 "
  136. fi
  137. echo "</td></tr>"
  138. fi
  139. fi
  140. echo "<tr><td>Downloads:</td><td>"
  141. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  142. # amd64
  143. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  144. # i386
  145. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/-win64_/-win32_/g" | sed "s/_amd64.deb/_i386.deb/g")
  146. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;(install both)"
  147. elif echo "${PACKAGE_FILENAME}" | grep -q "carla-vst-wine_"; then
  148. # amd64
  149. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  150. # i386
  151. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_i386.deb/g")
  152. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;"
  153. elif echo "${PACKAGE_FILENAME}" | grep -q "_all.deb"; then
  154. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">all</a>&nbsp;&nbsp;"
  155. else
  156. for ARCH in ${PACKAGES_ARCHS[@]}; do
  157. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_${ARCH}.deb/g")
  158. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">${ARCH}</a>&nbsp;&nbsp;"
  159. done
  160. fi
  161. if [ -n "${PACKAGE_DATA}" ]; then
  162. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}_|/${PACKAGE_DATA}_|g" | sed "s/_amd64.deb/_all.deb/g")
  163. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_DATA}\" target=\"_blank\">data</a>"
  164. fi
  165. echo "</td></tr>"
  166. echo "</table></div></div>"
  167. # separator
  168. echo "<br/>"
  169. echo
  170. done
  171. rm -f Packages.gz Packages