am2pla-site 13 KB

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