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.

259 lines
9.9KB

  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" "libjack-jackd2-0" "libjack-jackd2-dev")
  11. PACKAGES_WHITELIST=("cadence" "catia" "claudia")
  12. PACKAGES_SEPARATE_DATA=("hybridreverb2")
  13. PACKAGES_BASE_URL="http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/"
  14. rm -f Packages.gz Packages
  15. mkdir -p pool-cache
  16. wget -q http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/dists/bionic/main/binary-amd64/Packages.gz
  17. gzip -d Packages.gz
  18. PACKAGES=$(cat Packages | grep "Package: " | sed "s/Package: //g" | sort)
  19. function is_blacklisted() {
  20. local TEST="${1}"
  21. local PACKAGE
  22. for PACKAGE in ${PACKAGES_BLACKLIST[@]}; do
  23. if [ ${TEST} = ${PACKAGE} ]; then
  24. return 0
  25. fi
  26. done
  27. return 1
  28. }
  29. function is_whitelisted() {
  30. local TEST="${1}"
  31. local PACKAGE
  32. for PACKAGE in ${PACKAGES_WHITELIST[@]}; do
  33. if [ ${TEST} = ${PACKAGE} ]; then
  34. return 0
  35. fi
  36. done
  37. return 1
  38. }
  39. function has_data_package() {
  40. local TEST="${1}-data"
  41. local PACKAGE
  42. for PACKAGE in ${PACKAGES[@]}; do
  43. if [ ${TEST} = ${PACKAGE} ]; then
  44. return 0
  45. fi
  46. done
  47. return 1
  48. }
  49. function has_separate_data_package() {
  50. local TEST="${1}"
  51. local PACKAGE
  52. for PACKAGE in ${PACKAGES_SEPARATE_DATA[@]}; do
  53. if [ ${TEST} = ${PACKAGE} ]; then
  54. return 0
  55. fi
  56. done
  57. return 1
  58. }
  59. function get_homepage() {
  60. local SOURCE="${1}"
  61. local VERSION="${2}"
  62. local SRC_FILENAME="${SOURCE}_$(echo ${VERSION} | sed 's/:/./').dsc"
  63. local SRC_LETTER=$(echo "${SOURCE}" | head -c 1)
  64. if [ ! -f "pool-cache/${SRC_FILENAME}" ]; then
  65. wget -q -O "pool-cache/${SRC_FILENAME}" "${PACKAGES_BASE_URL}/pool/main/${SRC_LETTER}/${SOURCE}/${SRC_FILENAME}"
  66. if [ $? != 0 ]; then
  67. rm -f "pool-cache/${SRC_FILENAME}"
  68. return 1
  69. fi
  70. fi
  71. cat "pool-cache/${SRC_FILENAME}" | awk 'sub("Homepage: ","")'
  72. return 0
  73. }
  74. function get_vcs_page() {
  75. local SOURCE="${1}"
  76. local VERSION="${2}"
  77. local SRC_FILENAME="${SOURCE}_$(echo ${VERSION} | sed 's/:/./').dsc"
  78. local SRC_LETTER=$(echo "${SOURCE}" | head -c 1)
  79. if [ ! -f "pool-cache/${SRC_FILENAME}" ]; then
  80. wget -q -O "pool-cache/${SRC_FILENAME}" "${PACKAGES_BASE_URL}/pool/main/${SRC_LETTER}/${SOURCE}/${SRC_FILENAME}"
  81. if [ $? != 0 ]; then
  82. rm -f "pool-cache/${SRC_FILENAME}"
  83. return 1
  84. fi
  85. fi
  86. cat "pool-cache/${SRC_FILENAME}" | awk 'sub("Kxstudio-Vcs: ","")'
  87. return 0
  88. }
  89. for PACKAGE in ${PACKAGES[@]}; do
  90. if is_blacklisted ${PACKAGE} || echo "${PACKAGE}" | grep -q -- "-static"; then
  91. continue
  92. fi
  93. PACKAGE_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE}" | cut -d ':' -f 1)
  94. PACKAGE_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  95. if [ -n "${PACKAGE_NUMLINES}" ]; then
  96. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART} | head -n ${PACKAGE_NUMLINES})
  97. else
  98. PACKAGE_DETAILS=$(cat Packages | tail -n +${PACKAGE_LINESTART})
  99. fi
  100. PACKAGE_FILENAME=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Filename: ","")')
  101. if echo "${PACKAGE_FILENAME}" | grep -q "_all.deb" && ! is_whitelisted "${PACKAGE}"; then
  102. continue
  103. fi
  104. PACKAGE_DATA=$(has_data_package "${PACKAGE}" && echo "${PACKAGE}-data" || echo)
  105. PACKAGE_DESCRIPTION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Description: ","")')
  106. PACKAGE_PROVIDES=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Provides: ","")')
  107. PACKAGE_SIZE=$(echo "${PACKAGE_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  108. PACKAGE_RVERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2)
  109. PACKAGE_VERSION=$(echo "${PACKAGE_RVERSION}" | cut -d '-' -f 1)
  110. PACKAGE_SOURCE=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Source: ","")')
  111. if [ -z "${PACKAGE_SOURCE}" ]; then
  112. PACKAGE_SOURCE="${PACKAGE}"
  113. fi
  114. PACKAGE_HOMEPAGE=$(get_homepage "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}")
  115. PACKAGE_VCS_PAGE=$(get_vcs_page "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}")
  116. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  117. PACKAGE="carla-bridge-win"
  118. PACKAGE_DESCRIPTION="carla windows bridge"
  119. fi
  120. echo "<div class=\"repository-package\">"
  121. # screenshot
  122. SCREENSHOT=${PACKAGE}
  123. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  124. SCREENSHOT=$(echo "${SCREENSHOT}" | sed "s/-lv2//g" | sed "s/-vst//g")
  125. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  126. SCREENSHOT=""
  127. fi
  128. fi
  129. if [ -n "${SCREENSHOT}" ]; then
  130. echo "<div class=\"img_clickable\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/>"
  131. echo "<div class=\"img_clickable_overlay\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\"/></div>"
  132. echo "</div>"
  133. else
  134. echo "<div><img src=\"/repo/screenshots/nogui.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/></div>"
  135. fi
  136. # full table
  137. echo "<div><table>"
  138. echo "<tr><td>Package Name:</td><td>${PACKAGE}</td></tr>"
  139. echo "<tr><td>Description:</td><td>${PACKAGE_DESCRIPTION}</td></tr>"
  140. if [ -n "${PACKAGE_HOMEPAGE}" ] || [ -n "${PACKAGE_VCS_PAGE}" ]; then
  141. echo "<tr><td>Useful links:</td><td>"
  142. if [ -n "${PACKAGE_HOMEPAGE}" ]; then
  143. echo "<a href=\"${PACKAGE_HOMEPAGE}\" target=\"_blank\">Homepage</a>&nbsp;&nbsp;"
  144. fi
  145. if [ -n "${PACKAGE_VCS_PAGE}" ]; then
  146. echo "<a href=\"${PACKAGE_VCS_PAGE}\" target=\"_blank\">VCS</a>&nbsp;&nbsp;"
  147. fi
  148. echo "</td></tr>"
  149. fi
  150. echo "<tr><td>Version:</td><td>${PACKAGE_VERSION}</td></tr>"
  151. echo "<tr><td>Package size:</td><td>"
  152. if [ ${PACKAGE_SIZE} -gt 999999 ]; then
  153. echo "$((${PACKAGE_SIZE} / 1024 / 1024))Mb"
  154. else
  155. echo "$((${PACKAGE_SIZE} / 1024))Kb"
  156. fi
  157. if [ -n "${PACKAGE_DATA}" ]; then
  158. PACKAGE_DATA_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE_DATA}" | cut -d ':' -f 1)
  159. PACKAGE_DATA_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_DATA_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  160. if [ -n "${PACKAGE_DATA_NUMLINES}" ]; then
  161. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART} | head -n ${PACKAGE_DATA_NUMLINES})
  162. else
  163. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART})
  164. fi
  165. PACKAGE_DATA_SIZE=$(echo "${PACKAGE_DATA_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  166. if [ ${PACKAGE_DATA_SIZE} -gt 999999 ]; then
  167. echo "+ $((${PACKAGE_DATA_SIZE} / 1024 / 1024))Mb (data)"
  168. else
  169. echo "+ $((${PACKAGE_DATA_SIZE} / 1024))Kb (data)"
  170. fi
  171. fi
  172. echo "</td></tr>"
  173. if [ ${REPO_TARGET} = "plugins" ]; then
  174. if [ -z "${PACKAGE_PROVIDES}" ]; then
  175. echo "<tr><td>Provides:</td><td>??</td></tr>"
  176. else
  177. echo "<tr><td>Provides:</td><td>"
  178. if echo "${PACKAGE_PROVIDES}" | grep -q standalone-plugin; then
  179. echo "Standalone "
  180. fi
  181. if echo "${PACKAGE_PROVIDES}" | grep -q ladspa-plugin; then
  182. echo "LADSPA "
  183. fi
  184. if echo "${PACKAGE_PROVIDES}" | grep -q dssi-plugin; then
  185. echo "DSSI "
  186. fi
  187. if echo "${PACKAGE_PROVIDES}" | grep -q lv2-plugin; then
  188. echo "LV2 "
  189. fi
  190. if echo "${PACKAGE_PROVIDES}" | grep -q vst-plugin; then
  191. echo "VST2 "
  192. fi
  193. if echo "${PACKAGE_PROVIDES}" | grep -q vst3-plugin; then
  194. echo "VST3 "
  195. fi
  196. echo "</td></tr>"
  197. fi
  198. fi
  199. echo "<tr><td>Downloads:</td><td>"
  200. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  201. # amd64
  202. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  203. # i386
  204. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/-win64_/-win32_/g" | sed "s/_amd64.deb/_i386.deb/g")
  205. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;(install both)"
  206. elif echo "${PACKAGE_FILENAME}" | grep -q "carla-vst-wine_"; then
  207. # amd64
  208. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  209. # i386
  210. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_i386.deb/g")
  211. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;"
  212. elif echo "${PACKAGE_FILENAME}" | grep -q "_all.deb"; then
  213. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME}\" target=\"_blank\">all</a>&nbsp;&nbsp;"
  214. else
  215. for ARCH in ${PACKAGES_ARCHS[@]}; do
  216. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_${ARCH}.deb/g")
  217. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">${ARCH}</a>&nbsp;&nbsp;"
  218. done
  219. fi
  220. if [ -n "${PACKAGE_DATA}" ]; then
  221. if has_separate_data_package ${PACKAGE}; then
  222. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}|/${PACKAGE_DATA}|g" | sed "s/_amd64.deb/_all.deb/g")
  223. else
  224. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}_|/${PACKAGE_DATA}_|g" | sed "s/_amd64.deb/_all.deb/g")
  225. fi
  226. echo "<a href=\"${PACKAGES_BASE_URL}${PACKAGE_FILENAME_DATA}\" target=\"_blank\">data</a>"
  227. fi
  228. echo "</td></tr>"
  229. echo "</table></div></div>"
  230. # separator
  231. echo "<br/>"
  232. echo
  233. done
  234. rm -f Packages.gz Packages