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.

279 lines
11KB

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