am2pla-site 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. #!/usr/bin/env bash
  2. # This is a script I use to create and update the application list on https://portable-linux-apps.github.io/
  3. # Once created, the page will appear like this: https://portable-linux-apps.github.io/apps.html
  4. # First of all, we need to create a file containing all the arguments that this script must read
  5. AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
  6. arch="x86_64"
  7. # ENTER THE DESKTOP DIRECTORY
  8. cd "$(xdg-user-dir DESKTOP)" || exit 1
  9. # GET THE NAMES OF ALL APPLICATION
  10. cp "$HOME"/.local/share/AM/"$arch"-apps "$arch"-apps && echo -e "$(cat ./"$arch"-apps | awk -v FS="(◆ | : )" '{print $2}')" >> args
  11. # GET THE EXACT NUMBER OF AVAILABLE APPS
  12. ARGS=$(cat ./args)
  13. APPS_NUMBER=$(grep -v "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch"-apps | grep -e "$" -c)
  14. ITEMS_NUMBER=$(grep "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch"-apps | grep -e "$" -c)
  15. CATEGORIES="android audio \
  16. comic command-line communication \
  17. disk \
  18. education \
  19. file-manager finance \
  20. game gnome graphic \
  21. internet \
  22. kde \
  23. office \
  24. password \
  25. steam system-monitor \
  26. video \
  27. web-app web-browser wine"
  28. ##########################################################
  29. # UPDATE THE JSON FILE FOR FURTER ELECTRON-BASED FRONTENDS
  30. ##########################################################
  31. function _update_json() {
  32. echo "[" > apps.json
  33. for arg in $ARGS; do
  34. description=$(grep "◆ $arg :" "$arch"-apps | sed 's/"/\\"/g; s/^.*: //')
  35. printf " {\n \"packageName\": \"%b\",\n \"description\": \"%b..\",\n \"icon\": \"https://portable-linux-apps.github.io/icons/%b.png\"\n },\n" "$arg" "$description" "$arg" >> apps.json
  36. done
  37. sed -i '$s/,$//' apps.json
  38. echo "]" >> apps.json
  39. }
  40. _update_json
  41. ################################################
  42. # COMMON FUNCTIONS NEEDED TO COMPILE OTHER PAGES
  43. ################################################
  44. function _home_button {
  45. echo ""
  46. echo "| [Home](index.md) |"
  47. echo "| --- |"
  48. echo ""
  49. }
  50. function _table_head() {
  51. echo "-----------------"
  52. echo ""
  53. echo "*NOTE, the installer scripts in the \"INSTALLER\" column are intended for use via \"AM\", and are therefore dedicated to a system-wide \
  54. installation of applications (in /opt), and all that \"AppMan\" does is convert those scripts for local installation, changing the paths. \
  55. **They are listed here for reading purposes only**!*"
  56. echo ""
  57. echo "*Should you decide to run them manually, the only way to remove the application is to run \
  58. the command \"\`sudo /opt/appname/remove\`\", where \"appname\" is the name of the application directory containing the \"remove\" script. \
  59. Likewise, you can also update applications by running the \"AM-updater\" script in the same directory.*"
  60. echo ""
  61. echo "*The \"AM\" project allow the autonomy of installed apps, regardless of the presence of \"AM\" itself in the system. However, it is strongly \
  62. recommended to use \"AM\" and \"AppMan\" to take full advantage of all the benefits you could get from an application installed in this way.*"
  63. echo ""
  64. echo "*If you are here just to download apps manually, click on the program name and check the URL(s) on the application page. This site does not \
  65. provide direct links, for security reasons, but it does provide the exact sources and references where you can find them!*"
  66. echo ""
  67. echo "*Transparency and credibility are the focus of this catalog. Happy exploring!*"
  68. echo ""
  69. echo "-----------------"
  70. echo ""
  71. echo "| ICON | PACKAGE NAME | DESCRIPTION | INSTALLER |"
  72. echo "| --- | --- | --- | --- |"
  73. }
  74. function _categories_buttons() {
  75. echo ""
  76. echo "#### *Categories*"
  77. echo ""
  78. #- ***[SAMPLE](https://portable-linux-apps.github.io/SAMPLE.html)*** \
  79. echo "***[AppImages](appimages.md)*** \
  80. $(for c in $CATEGORIES; do printf " - ***[$c]($c.md)***"; done)"
  81. echo ""
  82. }
  83. function _categories_buttons_on_footer() {
  84. echo ""
  85. echo "| [Back to Home](index.md) | [Back to Applications](apps.md)"
  86. echo "| --- | --- |"
  87. echo ""
  88. }
  89. function _back_to_apps_button() {
  90. echo ""
  91. echo "| [Back to Applications](apps.md) |"
  92. echo "| --- |"
  93. echo ""
  94. }
  95. function _footer_up() {
  96. echo ""
  97. echo ""
  98. echo "---"
  99. echo ""
  100. echo "You can improve these pages via a [pull request](https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/pulls) \
  101. to this site's [GitHub repository](https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io), \
  102. or report any problems related to the installation scripts in the '[issue](https://github.com/ivan-hc/AM/issues)' \
  103. section of the main database, at [https://github.com/ivan-hc/AM](https://github.com/ivan-hc/AM)."
  104. echo ""
  105. echo "***PORTABLE-LINUX-APPS.github.io is my gift to the Linux community and was made with love for GNU/Linux and the Open Source philosophy.***"
  106. echo ""
  107. echo "---"
  108. }
  109. function _footer_down() {
  110. echo "--------"
  111. echo ""
  112. echo "# Contacts"
  113. echo "- **Ivan-HC** *on* [**GitHub**](https://github.com/ivan-hc)"
  114. echo "- **AM-Ivan** *on* [**Reddit**](https://www.reddit.com/u/am-ivan)"
  115. echo ""
  116. echo "###### *You can support me and my work on [**ko-fi.com**](https://ko-fi.com/IvanAlexHC) and \
  117. [**PayPal.me**](https://paypal.me/IvanAlexHC). Thank you!*"
  118. echo ""
  119. echo "--------"
  120. echo ""
  121. echo "*© 2020-present Ivan Alessandro Sala aka '"'Ivan-HC'"'* - I'm here just for fun!"
  122. echo ""
  123. echo ""
  124. }
  125. function _footer_apps() {
  126. _footer_up
  127. _home_button
  128. _footer_down
  129. }
  130. function _footer_categories() {
  131. _footer_up
  132. _categories_buttons_on_footer
  133. _footer_down
  134. }
  135. ###############################
  136. # COMPILE THE APPLICATIONS LIST
  137. ###############################
  138. function _applications_list_header {
  139. echo "# APPLICATIONS" > apps.md
  140. _home_button >> apps.md
  141. echo "#### Here are listed all **$APPS_NUMBER** unique applications, AppImage packages and command line utilities managed by [AM](https://github.com/ivan-hc/AM) \
  142. and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture, plus **$ITEMS_NUMBER** more entries and items to help you install apps more easily." >> apps.md
  143. echo "" >> apps.md
  144. echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> apps.md
  145. echo "" >> apps.md
  146. _categories_buttons >> apps.md
  147. _table_head >> apps.md
  148. }
  149. function _applications_list_body() {
  150. for arg in $ARGS; do
  151. description=$(grep "◆ $arg :" "$arch"-apps | sed 's/^.*: //; s/ *$//')
  152. echo "| <img loading=\"lazy\" src=\"icons/$arg.png\" width=\"48\" height=\"48\"> | [***$arg***](apps/$arg.md) | *$description*..[ *read more* ](apps/$arg.md)*!* | [*blob*](https://github.com/ivan-hc/AM/blob/main/programs/$arch/$arg) **/** [*raw*](https://raw.githubusercontent.com/ivan-hc/AM/main/programs/$arch/$arg) |" >> body.txt &
  153. done
  154. wait
  155. sort -u ./body.txt >> apps.md
  156. }
  157. _applications_list_header
  158. _applications_list_body
  159. _footer_apps >> apps.md
  160. ########################
  161. # COMPILE APPIMAGES PAGE
  162. ########################
  163. function _appimages_listing() {
  164. APPIMAGES_LIST_AM=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64-appimages)
  165. echo "$APPIMAGES_LIST_AM" | awk -v FS="(◆ | : )" '{print $2}' > args
  166. ARGS=$(cat ./args)
  167. APPIMAGES_NUMBER=$(cat ./args | wc -l)
  168. }
  169. function _appimages_list_header {
  170. echo "# APPIMAGES" > appimages.md
  171. _home_button >> appimages.md
  172. echo "#### Here are listed the **$APPIMAGES_NUMBER** unique Appimages managed by [AM](https://github.com/ivan-hc/AM) \
  173. and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> appimages.md
  174. echo "" >> appimages.md
  175. echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> appimages.md
  176. echo "" >> appimages.md
  177. _back_to_apps_button >> appimages.md
  178. _categories_buttons >> appimages.md
  179. _table_head >> appimages.md
  180. }
  181. function _appimages_list_body() {
  182. for arg in $ARGS; do
  183. grep "apps/$arg.md" ./body.txt >> appimages.md
  184. done
  185. }
  186. _appimages_listing
  187. _appimages_list_header
  188. _appimages_list_body
  189. _footer_categories >> appimages.md
  190. ######################################
  191. # COMPILE THE MAIN PAGE OF THE WEBSITE
  192. ######################################
  193. ST_APPS_NUMBER=$(($APPS_NUMBER-$APPIMAGES_NUMBER))
  194. function _compile_the_homepage() {
  195. wget -q https://raw.githubusercontent.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/main/index.md -O index.old
  196. sed -n '1,10p' ./index.old > ./index.md
  197. echo "#### *This site lists **$APPS_NUMBER** unique apps (**$APPIMAGES_NUMBER** Appimage packages and **$ST_APPS_NUMBER** standalone/portable programs), plus **$ITEMS_NUMBER** items.*" >> ./index.md
  198. sed -n '12,19p' ./index.old >> ./index.md
  199. _categories_buttons >> ./index.md
  200. sed -n '25,20000p' ./index.old >> ./index.md
  201. }
  202. _compile_the_homepage
  203. ##################
  204. # OTHER CATEGORIES
  205. ##################
  206. function _category_list_header {
  207. echo "# $(echo "$category" | tr a-z A-Z)" > "$category".md
  208. _home_button >> "$category".md
  209. echo "#### Here are listed **$APPS_NUMBER** programs and **$ITEMS_NUMBER** items for this category and managed by [AM](https://github.com/ivan-hc/AM) \
  210. and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> "$category".md
  211. echo "" >> "$category".md
  212. echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> "$category".md
  213. echo "" >> "$category".md
  214. _back_to_apps_button >> "$category".md
  215. _categories_buttons >> "$category".md
  216. _table_head >> "$category".md
  217. }
  218. function _category_list_body() {
  219. for arg in $ARGS; do
  220. grep "apps/"$arg".md" ./body.txt >> $category.md
  221. done
  222. }
  223. for category in $CATEGORIES; do
  224. if [ "$category" = android ]; then
  225. grep -i "$category\| adb \|fastboot\|phone\|platform-tools" ./"$arch"-apps >> "$arch-$category"
  226. elif [ "$category" = audio ]; then
  227. grep -i "$category\|music\|midi\|mp3\|sound" ./"$arch"-apps >> "$arch-$category"
  228. elif [ "$category" = comic ]; then
  229. grep -i "$category\|manga\|epub\|anime" ./"$arch"-apps >> "$arch-$category"
  230. elif [ "$category" = command-line ]; then
  231. grep -i "$category\|command line\| cli \|terminal\|fastboot\| npm \| bash \| shell \| dash \| zsh " ./"$arch"-apps >> "$arch-$category"
  232. elif [ "$category" = communication ]; then
  233. grep -i "$category\|voip\|facebook\|messenger\|whatsapp\|mastodon\|skype\|chat\|social network\|zoom\|conferenc\|discord" ./"$arch"-apps >> "$arch-$category"
  234. elif [ "$category" = disk ]; then
  235. grep -i "$category\|partition\|usb" ./"$arch"-apps >> "$arch-$category"
  236. elif [ "$category" = education ]; then
  237. grep -i "$category\| edu\|science\|learn\|study\|teach\|translat\|geo\|child\| book\|ebook\|space simulator\|planet\|astronom" ./"$arch"-apps | grep -vi "game\|manga\|anime" >> "$arch-$category"
  238. elif [ "$category" = file-manager ]; then
  239. grep -i "$category\|file manager\|file browse\|browse.*file\|file explore" ./"$arch"-apps >> "$arch-$category"
  240. elif [ "$category" = finance ]; then
  241. grep -i "$category\|wallet\|money\|economy\|economic" ./"$arch"-apps >> "$arch-$category"
  242. elif [ "$category" = game ]; then
  243. grep -i "$category\|arcade\|steam\|wine\|strateg\|solitaire\|poker\|chess\|puzzle\|pinball\|adventure\|playstation\|xbox\|nintendo\|minecraft" ./"$arch"-apps >> "$arch-$category"
  244. elif [ "$category" = graphic ]; then
  245. grep -i "$category\|picture\|screensh\|gimp\|photo\|svg\|png\|autocad\|blender\|modeling\|paint\|pixel\|wallpaper" ./"$arch"-apps >> "$arch-$category"
  246. elif [ "$category" = internet ]; then
  247. grep -i "$category\|web browser\|browser web\|firefox\|chrome\|youtube\|torrent\|p2p\|chat\|whatsapp\|mastodon\|telegram\|skype" ./"$arch"-apps >> "$arch-$category"
  248. elif [ "$category" = office ]; then
  249. grep -i "$category\|document\|book\|pdf\|docx\|reader\|spreadsheet\| word \| excel " ./"$arch"-apps >> "$arch-$category"
  250. elif [ "$category" = password ]; then
  251. grep -i "$category" ./"$arch"-apps >> "$arch-$category"
  252. elif [ "$category" = system-monitor ]; then
  253. grep -i "$category\|system monitor\|task manager\|system resource" ./"$arch"-apps >> "$arch-$category"
  254. elif [ "$category" = video ]; then
  255. grep -i "$category\|stream\|media player\|film\|movie\|netflix\|youtube\|iptv" ./"$arch"-apps >> "$arch-$category"
  256. elif [ "$category" = web-app ]; then
  257. grep -i "$category\|webapp\|web app\|ffwa" ./"$arch"-apps >> "$arch-$category"
  258. elif [ "$category" = web-browser ]; then
  259. grep -i "$category\|web browser\|browser web\|browser.*web\|browser.*chrome\|brave.*browser\|chrome.*browser\|chromium.*browser\|firefox.*web browser\|vivaldi\|thorium\|mercury\|librewolf" ./"$arch"-apps >> "$arch-$category"
  260. else
  261. grep -i "$category" ./"$arch"-apps >> "$arch-$category"
  262. fi
  263. echo -e "$(cat ./"$arch-$category" | awk -v FS="(◆ | : )" '{print $2}')" > args
  264. ARGS=$(cat ./args)
  265. APPS_NUMBER=$(grep -v "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
  266. ITEMS_NUMBER=$(grep "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
  267. _category_list_header
  268. _category_list_body
  269. _footer_categories >> "$category".md
  270. rm -f ./"$arch-$category"
  271. done
  272. ######################
  273. # END OF ALL PROCESSES
  274. ######################
  275. rm ./args ./index.old ./"$arch"-apps ./body.txt