first commit
This commit is contained in:
commit
000ba8e75d
69
tromjaro-apps-checker
Executable file
69
tromjaro-apps-checker
Executable file
|
@ -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|^ <h2 class="entry-title"><a href="\(.\+\)" rel="bookmark">.\+</a></h2> <div class="entry-meta">$|\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|^ <a class="eael-creative-button eael-creative-button--default" href="\(.\+\)" data-text="on TROM-Jaro">$|\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
|
Loading…
Reference in New Issue
Block a user