am2pla-site 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 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) |" >> apps.md
  158. sleep 0.005
  159. done
  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. curl -s https://codeload.github.com/ivan-hc/AM/tar.gz/main | tar -xz --strip=2 AM-main/programs/"$arch"
  169. ARGS=$(awk -v FS="(◆ | : )" '{print $2}' <"$arch-apps")
  170. for arg in $ARGS; do
  171. if grep -qe "appimage-extract\|mage\$\|tmp\/\*mage" "./$arch/$arg" 1> /dev/null; then
  172. if ! grep "◆ $arg :" "$arch-apps" | grep -ie "\"kdegames\"\|\"kdeutils\"" 1> /dev/null; then
  173. grep "◆ $arg :" "$arch-apps" >> "$arch-appimages"
  174. fi
  175. fi
  176. done
  177. echo -e "$(cat ./"$arch"-appimages | awk -v FS="(◆ | : )" '{print $2}')" > args
  178. ARGS=$(cat ./args)
  179. APPIMAGES_NUMBER=$(cat ./args | wc -l)
  180. }
  181. function _appimages_list_header {
  182. echo "# APPIMAGES" > appimages.md
  183. _home_button >> appimages.md
  184. echo "#### Here are listed the **$APPIMAGES_NUMBER** unique Appimages managed by [AM](https://github.com/ivan-hc/AM) \
  185. and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> appimages.md
  186. echo "" >> appimages.md
  187. echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> appimages.md
  188. echo "" >> appimages.md
  189. _back_to_apps_button >> appimages.md
  190. _categories_buttons >> appimages.md
  191. _table_head >> appimages.md
  192. }
  193. function _appimages_list_body() {
  194. for arg in $ARGS; do
  195. description=$(cat "$arch"-appimages | grep "◆ $arg :" | sed 's/^.*: //' | sed 's/ *$//')
  196. echo "| <img 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) |" >> appimages.md
  197. sleep 0.005
  198. done
  199. }
  200. _appimages_listing
  201. _appimages_list_header
  202. _appimages_list_body
  203. _footer_categories >> appimages.md
  204. #rm -f ./"$arch-appimages"
  205. ######################################
  206. # COMPILE THE MAIN PAGE OF THE WEBSITE
  207. ######################################
  208. ST_APPS_NUMBER=$(($APPS_NUMBER-$APPIMAGES_NUMBER))
  209. function _compile_the_homepage() {
  210. wget -q https://raw.githubusercontent.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/main/index.md -O index.old
  211. sed -n '1,10p' ./index.old > ./index.md
  212. 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
  213. sed -n '12,19p' ./index.old >> ./index.md
  214. _categories_buttons >> ./index.md
  215. sed -n '25,20000p' ./index.old >> ./index.md
  216. }
  217. _compile_the_homepage
  218. ##################
  219. # OTHER CATEGORIES
  220. ##################
  221. function _category_list_header {
  222. echo "# $(echo "$category" | tr a-z A-Z)" > "$category".md
  223. _home_button >> "$category".md
  224. echo "#### Here are listed **$APPS_NUMBER** programs and **$ITEMS_NUMBER** items for this category and managed by [AM](https://github.com/ivan-hc/AM) \
  225. and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> "$category".md
  226. echo "" >> "$category".md
  227. echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> "$category".md
  228. echo "" >> "$category".md
  229. _back_to_apps_button >> "$category".md
  230. _categories_buttons >> "$category".md
  231. _table_head >> "$category".md
  232. }
  233. function _category_list_body() {
  234. for arg in $ARGS; do
  235. description=$(cat "$arch"-apps | grep "◆ $arg :" | sed 's/^.*: //' | sed 's/ *$//')
  236. echo "| <img 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) |" >> $category.md
  237. sleep 0.005
  238. done
  239. }
  240. for category in $CATEGORIES; do
  241. if [ "$category" = android ]; then
  242. grep -i "$category\| adb \|fastboot\|phone\|platform-tools" ./"$arch"-apps >> "$arch-$category"
  243. elif [ "$category" = audio ]; then
  244. grep -i "$category\|music\|midi\|mp3\|sound" ./"$arch"-apps >> "$arch-$category"
  245. elif [ "$category" = comic ]; then
  246. grep -i "$category\|manga\|epub\|anime" ./"$arch"-apps >> "$arch-$category"
  247. elif [ "$category" = command-line ]; then
  248. grep -i "$category\|command line\| cli \|terminal\|fastboot\| npm \| bash \| shell \| dash \| zsh " ./"$arch"-apps >> "$arch-$category"
  249. elif [ "$category" = communication ]; then
  250. grep -i "$category\|voip\|facebook\|messenger\|whatsapp\|mastodon\|skype\|chat\|social network\|zoom\|conferenc\|discord" ./"$arch"-apps >> "$arch-$category"
  251. elif [ "$category" = disk ]; then
  252. grep -i "$category\|partition\|usb" ./"$arch"-apps >> "$arch-$category"
  253. elif [ "$category" = education ]; then
  254. 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"
  255. elif [ "$category" = file-manager ]; then
  256. grep -i "$category\|file manager\|file browse\|browse.*file\|file explore" ./"$arch"-apps >> "$arch-$category"
  257. elif [ "$category" = finance ]; then
  258. grep -i "$category\|wallet\|money\|economy\|economic" ./"$arch"-apps >> "$arch-$category"
  259. elif [ "$category" = game ]; then
  260. grep -i "$category\|arcade\|steam\|wine\|strateg\|solitaire\|poker\|chess\|puzzle\|pinball\|adventure\|playstation\|xbox\|nintendo\|minecraft" ./"$arch"-apps >> "$arch-$category"
  261. elif [ "$category" = graphic ]; then
  262. grep -i "$category\|picture\|screensh\|gimp\|photo\|svg\|png\|autocad\|blender\|modeling\|paint\|pixel\|wallpaper" ./"$arch"-apps >> "$arch-$category"
  263. elif [ "$category" = internet ]; then
  264. grep -i "$category\|web browser\|browser web\|firefox\|chrome\|youtube\|torrent\|p2p\|chat\|whatsapp\|mastodon\|telegram\|skype" ./"$arch"-apps >> "$arch-$category"
  265. elif [ "$category" = office ]; then
  266. grep -i "$category\|document\|book\|pdf\|docx\|reader\|spreadsheet\| word \| excel " ./"$arch"-apps >> "$arch-$category"
  267. elif [ "$category" = password ]; then
  268. grep -i "$category" ./"$arch"-apps >> "$arch-$category"
  269. elif [ "$category" = system-monitor ]; then
  270. grep -i "$category\|system monitor\|task manager\|system resource" ./"$arch"-apps >> "$arch-$category"
  271. elif [ "$category" = video ]; then
  272. grep -i "$category\|stream\|media player\|film\|movie\|netflix\|youtube\|iptv" ./"$arch"-apps >> "$arch-$category"
  273. elif [ "$category" = web-app ]; then
  274. grep -i "$category\|webapp\|web app\|ffwa" ./"$arch"-apps >> "$arch-$category"
  275. elif [ "$category" = web-browser ]; then
  276. 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"
  277. else
  278. grep -i "$category" ./"$arch"-apps >> "$arch-$category"
  279. fi
  280. echo -e "$(cat ./"$arch-$category" | awk -v FS="(◆ | : )" '{print $2}')" > args
  281. ARGS=$(cat ./args)
  282. APPS_NUMBER=$(grep -v "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
  283. ITEMS_NUMBER=$(grep "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
  284. _category_list_header
  285. _category_list_body
  286. _footer_categories >> "$category".md
  287. rm -f ./"$arch-$category"
  288. done
  289. ######################
  290. # END OF ALL PROCESSES
  291. ######################
  292. rm ./args ./index.old ./"$arch"-apps ./"$arch"/* && rmdir ./"$arch"