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.

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