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.

277 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_DATA=$(has_data_package "${PACKAGE}" && echo "${PACKAGE}-data" || echo)
  106. if [ -z "${PACKAGE_DATA}" ] && echo "${PACKAGE}" | grep -q -- \-; then
  107. PACKAGE_MAIN=$(echo "${PACKAGE}" | cut -d '-' -f 1)
  108. PACKAGE_DATA=$(has_data_package "${PACKAGE_MAIN}" && echo "${PACKAGE_MAIN}-data" || echo)
  109. fi
  110. PACKAGE_DESCRIPTION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Description: ","")')
  111. PACKAGE_PROVIDES=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Provides: ","")')
  112. PACKAGE_SIZE=$(echo "${PACKAGE_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  113. PACKAGE_RVERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2)
  114. PACKAGE_VERSION=$(echo "${PACKAGE_RVERSION}" | cut -d '-' -f 1)
  115. PACKAGE_SOURCE=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Source: ","")')
  116. if [ -z "${PACKAGE_SOURCE}" ]; then
  117. PACKAGE_SOURCE="${PACKAGE}"
  118. fi
  119. PACKAGE_HOMEPAGE=$(get_homepage "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}")
  120. PACKAGE_VCS_PAGE=$(get_vcs_page "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}")
  121. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  122. PACKAGE="carla-bridge-win"
  123. PACKAGE_DESCRIPTION="carla windows bridge"
  124. fi
  125. echo "<div class=\"repository-package\" id=\"${PACKAGE}\">"
  126. # screenshot
  127. SCREENSHOT=${PACKAGE}
  128. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  129. SCREENSHOT=$(echo "${SCREENSHOT}" | sed "s/-lv2//g" | sed "s/-vst2//g" | sed "s/-vst3//g" | sed "s/-vst//g")
  130. if [ ! -f "./screenshots/${SCREENSHOT}.png" ]; then
  131. SCREENSHOT=""
  132. fi
  133. fi
  134. if [ -n "${SCREENSHOT}" ]; then
  135. echo "<div class=\"img_clickable\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/>"
  136. echo "<div class=\"img_clickable_overlay\"><img src=\"/repo/screenshots/${SCREENSHOT}.png\" alt=\"${PACKAGE}\"/></div>"
  137. echo "</div>"
  138. else
  139. echo "<div><img src=\"/repo/screenshots/nogui.png\" alt=\"${PACKAGE}\" class=\"img_thumb_150\"/></div>"
  140. fi
  141. # full table
  142. echo "<div><table>"
  143. echo "<tr><td>Package Name:</td><td><a href=\"#${PACKAGE}\" style=\"text-decoration:none;color:#D6D6D6;\">${PACKAGE}</a></td></tr>"
  144. echo "<tr><td>Description:</td><td>${PACKAGE_DESCRIPTION}</td></tr>"
  145. if [ -n "${PACKAGE_HOMEPAGE}" ] || [ -n "${PACKAGE_VCS_PAGE}" ]; then
  146. echo "<tr><td>Useful links:</td><td>"
  147. if [ -n "${PACKAGE_HOMEPAGE}" ]; then
  148. echo "<a href=\"${PACKAGE_HOMEPAGE}\" target=\"_blank\">Homepage</a>&nbsp;&nbsp;"
  149. fi
  150. if [ -n "${PACKAGE_VCS_PAGE}" ]; then
  151. echo "<a href=\"${PACKAGE_VCS_PAGE}\" target=\"_blank\">VCS</a>&nbsp;&nbsp;"
  152. fi
  153. echo "</td></tr>"
  154. fi
  155. echo "<tr><td>Version:</td><td>${PACKAGE_VERSION}</td></tr>"
  156. echo "<tr><td>Package size:</td><td>"
  157. if [ ${PACKAGE_SIZE} -gt 1048576 ]; then
  158. echo "$((${PACKAGE_SIZE} / 1024 / 1024))Mb"
  159. else
  160. echo "$((${PACKAGE_SIZE} / 1024))Kb"
  161. fi
  162. if [ -n "${PACKAGE_DATA}" ]; then
  163. PACKAGE_DATA_LINESTART=$(cat Packages | grep -x -n "Package: ${PACKAGE_DATA}" | cut -d ':' -f 1 | sort | tail -n 1)
  164. PACKAGE_DATA_NUMLINES=$(cat Packages | tail -n +$((${PACKAGE_DATA_LINESTART} + 1)) | grep -n "Package: " | head -n 1 | cut -d ':' -f 1)
  165. if [ -n "${PACKAGE_DATA_NUMLINES}" ]; then
  166. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART} | head -n ${PACKAGE_DATA_NUMLINES})
  167. else
  168. PACKAGE_DATA_DETAILS=$(cat Packages | tail -n +${PACKAGE_DATA_LINESTART})
  169. fi
  170. PACKAGE_DATA_SIZE=$(echo "${PACKAGE_DATA_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")')
  171. if [ ${PACKAGE_DATA_SIZE} -gt 1048576 ]; then
  172. echo "+ $((${PACKAGE_DATA_SIZE} / 1024 / 1024))Mb (data)"
  173. else
  174. echo "+ $((${PACKAGE_DATA_SIZE} / 1024))Kb (data)"
  175. fi
  176. fi
  177. echo "</td></tr>"
  178. if [ ${REPO_TARGET} = "plugins" ]; then
  179. if [ -z "${PACKAGE_PROVIDES}" ]; then
  180. echo "<tr><td>Provides:</td><td>??</td></tr>"
  181. else
  182. echo "<tr><td>Provides:</td><td>"
  183. if echo "${PACKAGE_PROVIDES}" | grep -q standalone-plugin; then
  184. echo "Standalone "
  185. fi
  186. if echo "${PACKAGE_PROVIDES}" | grep -q ladspa-plugin; then
  187. echo "LADSPA "
  188. fi
  189. if echo "${PACKAGE_PROVIDES}" | grep -q dssi-plugin; then
  190. echo "DSSI "
  191. fi
  192. if echo "${PACKAGE_PROVIDES}" | grep -q lv2-plugin; then
  193. echo "LV2 "
  194. fi
  195. if echo "${PACKAGE_PROVIDES}" | grep -q vst-plugin; then
  196. echo "VST2 "
  197. fi
  198. if echo "${PACKAGE_PROVIDES}" | grep -q vst3-plugin; then
  199. echo "VST3 "
  200. fi
  201. echo "</td></tr>"
  202. fi
  203. fi
  204. echo "<tr><td>Downloads:</td><td>"
  205. if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then
  206. # amd64
  207. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  208. # i386
  209. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/-win64_/-win32_/g" | sed "s/_amd64.deb/_i386.deb/g")
  210. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;(install both)"
  211. elif echo "${PACKAGE_FILENAME}" | grep -q "carla-vst-wine_"; then
  212. # amd64
  213. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  214. # i386
  215. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_i386.deb/g")
  216. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;"
  217. elif echo "${PACKAGE_FILENAME}" | grep -q "wineasio_"; then
  218. # amd64
  219. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/wineasio_/wineasio-amd64_/g")
  220. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">amd64</a>&nbsp;&nbsp;"
  221. # i386
  222. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/wineasio_/wineasio-i386_/g" | sed "s/_amd64.deb/_i386.deb/g")
  223. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">i386</a>&nbsp;&nbsp;"
  224. elif echo "${PACKAGE_FILENAME}" | grep -q "_all.deb"; then
  225. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME}\" target=\"_blank\">all</a>&nbsp;&nbsp;"
  226. else
  227. for ARCH in ${PACKAGES_ARCHS[@]}; do
  228. PACKAGE_FILENAME_ARCHED=$(echo "${PACKAGE_FILENAME}" | sed "s/_amd64.deb/_${ARCH}.deb/g")
  229. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_ARCHED}\" target=\"_blank\">${ARCH}</a>&nbsp;&nbsp;"
  230. done
  231. fi
  232. if [ -n "${PACKAGE_DATA}" ]; then
  233. if has_separate_data_package ${PACKAGE}; then
  234. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}|/${PACKAGE_DATA}|g" | sed "s/_amd64.deb/_all.deb/g")
  235. else
  236. PACKAGE_FILENAME_DATA=$(echo "${PACKAGE_FILENAME}" | sed "s|/${PACKAGE}_|/${PACKAGE_DATA}_|g" | sed "s/_amd64.deb/_all.deb/g")
  237. fi
  238. echo "<a href=\"${PACKAGES_BASE_HTTPS}${PACKAGE_FILENAME_DATA}\" target=\"_blank\">data</a>"
  239. fi
  240. echo "</td></tr>"
  241. echo "</table></div></div>"
  242. # separator
  243. echo "<br/>"
  244. echo
  245. done
  246. rm -f Packages.gz Packages