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.

295 lines
12KB

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