am2app 958 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # THIS SCRIPT IS NEEDED TO GENERATE A JSON FILE OF ALL APPLICATIONS WITH EASE
  3. cd $(xdg-user-dir DESKTOP)
  4. AMREPO="https://raw.githubusercontent.com/ivan-hc/AM-application-manager/main"
  5. arch="x86_64"
  6. echo "" >> args
  7. wget -q $AMREPO/programs/$arch-apps && echo -e "$(cat ./$arch-apps | awk -v FS="(◆ | : )" '{print $2}')" >> args
  8. echo STOP >> args
  9. ARGS=$(sed '1d' ./args)
  10. echo "[" >> apps.json
  11. # THIS IS THE WORKFLOW
  12. for arg in $ARGS; do
  13. for var in $arg; do
  14. if [ $arg == STOP ]; then
  15. break
  16. else
  17. case $arg in
  18. am) ;;
  19. appman) ;;
  20. *) for var in $arg;
  21. do
  22. description=$(cat $arch-apps | grep "◆ $arg :" | sed 's/"//g' | sed 's/^.*: //')
  23. echo -e ' {\n "packageName": "'$arg'",\n "description": "'$description'..",\n "icon": "https://portable-linux-apps.github.io/icons/'$arg'.png"\n },' >> apps.json
  24. sleep 0.005
  25. done;;
  26. esac
  27. fi
  28. done
  29. done
  30. sed -i '$s/,$//' apps.json
  31. echo -e "]" >> apps.json
  32. rm ./args ./$arch-apps