#!/bin/bash # This script checks and updates the latest versions of the packages # Prints which package is about to update. greetMsg() { printf "\nUpdating package: $1\n" } # Does the actual update of the package with the found version. updatePkg() { sed -i -E "s@($1-version \"+)(.+\">)@\1$2\">@" add_packages.sh sed -i -E "s@($1-download-http \"+)(.+\">)@\1$3\">@" ./$4/$1.xml echo "Latest version: $2" printf "Found package: $3\n" } # Function that gets the latest release of a specific package. # This function works only with packages stored on github. getLatestGithubRelease() { greetMsg $2 URL=`curl -v --silent "https://github.com/$1/releases" 2>&1 | grep 'loading="lazy" src=' | tr '"' '\n' | grep /releases/ -m1` URL="https://github.com`curl -v --silent $URL 2>&1 | grep '&1 | grep net.sf.files | tr '"' '\n' | grep http -m1 | rev | cut -c10- | rev` VER=`echo $URL | awk -F/ '{ print $NF }'` if [[ $4 ]]; then VER=`echo $VER | cut -c$4` fi URL=$URL/$2-$VER.tar.gz updatePkg $2 $VER $URL $3 } #minidlna getLatestSourceforgeRelease minidlna minidlna server/other #libid3tag getLatestSourceforgeRelease mad libid3tag multimedia/libdriv #pkcs11-helper getLatestGithubRelease OpenSC/pkcs11-helper pkcs11-helper postlfs/security #QMPlay2 getLatestGithubRelease zaps166/QMPlay2 qmplay2 multimedia/videoutils #qBittorrent getLatestSourceforgeRelease qbittorrent qbittorrent xsoft/other 13- #libtorrent-rasterbar getLatestGithubRelease arvidn/libtorrent libtorrent-rasterbar networking/netlibs 2- #SDL2-image getLatestGithubRelease libsdl-org/SDL_image sdl2-image general/graphlib #SDL2-ttf getLatestGithubRelease libsdl-org/SDL_ttf sdl2-ttf general/graphlib