From 000ba8e75dc605f2d1a00e916efecd556c7a6938 Mon Sep 17 00:00:00 2001 From: Rokosun Date: Wed, 31 Jul 2024 21:59:20 +0530 Subject: [PATCH] first commit --- tromjaro-apps-checker | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 tromjaro-apps-checker diff --git a/tromjaro-apps-checker b/tromjaro-apps-checker new file mode 100755 index 0000000..26ddc83 --- /dev/null +++ b/tromjaro-apps-checker @@ -0,0 +1,69 @@ +#!/bin/bash + +dir="$HOME/TROMjaro-Project/Check APPS/" + +echo 'Remember to update your system before running this script, that will also update your pacman database.' + +# Move old files to a different directory +mkdir -p "$dir/old" || { echo "failed to make directory $dir/old"; exit 1; } +cd "$dir" || { echo "failed to change directory to $dir"; exit 1; } +files_to_backup=( + link-contains-%-symbol + aur-to-repo + working-aur-packages + broken-aur-packages + broken-repo-packages + appimages + working-flatpaks + broken-flatpaks + weird-links +) +mv --backup=numbered "${files_to_backup[@]}" old 2>/dev/null + +[ -n "$1" ] && num=$1 || num=1 +pages='not empty' +while [ -n "$pages" ] && { [ -z "$2" ] || [ $num -le "$2" ]; }; do + echo "page $num:" + # Get a list of webpages for different apps + pages=$(curl -Ls "https://www.tromjaro.com/category/apps/page/$num" | sed 's|^

.\+

$|\1|;t;d') + num=$((num+1)) + + for page in $pages; do + # Get the x-alpm-package:// link of the app + link=$(curl -Ls "$page" | sed 's|^ $|\1|;t;d') + echo "$link" + # Get the package name or app ID + package=${link##*/} + if [[ "$link" =~ % ]]; then + echo "$page" >> link-contains-%-symbol + elif [[ "$link" =~ ^x-alpm-package://flatpak// ]]; then + if flatpak remote-info flathub "$package" >/dev/null 2>&1; then + echo "$page" >> working-flatpaks + else + echo "$page" >> broken-flatpaks + fi + elif [[ "$link" =~ ^x-alpm-package://aur// ]]; then + if pacman -Si "$package" >/dev/null 2>&1; then + echo "$page" >> aur-to-repo + elif pamac info -a "$package" >/dev/null 2>&1; then + echo "$page" >> working-aur-packages + else + echo "$page" >> broken-aur-packages + fi + elif [[ "$link" =~ ^x-alpm-package:// ]]; then + pacman -Si "$package" >/dev/null 2>&1 || + echo "$page" >> broken-repo-packages + elif [[ "$link" =~ ^https:// ]]; then + echo "$page" >> appimages + else + echo "weird link found that doesn't match the crieteria for AUR, Repos, Appimage or Flatpak!" + echo "$page" >> weird-links + fi + done +done + +if [ -z "$pages" ]; then + echo "page $((num-2)) is the last page where apps were found, stopping here." +elif [ -n "$2" ] && [ $((num-1)) -eq "$2" ]; then + echo "page limit reached - $2" +fi