2024-10-07 05:00:45 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# This script checks and updates the latest versions of the packages
|
|
|
|
|
2024-10-24 06:12:12 +08:00
|
|
|
set -e
|
|
|
|
|
2024-10-18 05:57:32 +08:00
|
|
|
# Prints which package is about to update.
|
|
|
|
greetMsg()
|
|
|
|
{
|
2024-10-24 06:12:12 +08:00
|
|
|
printf "\nUpdating package: %s\n" "$1"
|
2024-10-18 05:57:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Does the actual update of the package with the found version.
|
|
|
|
updatePkg()
|
|
|
|
{
|
2024-11-01 08:38:40 +08:00
|
|
|
MD5=$(curl -sL "$3" | md5sum | cut -d' ' -f1)
|
2024-10-18 05:57:32 +08:00
|
|
|
sed -i -E "s@($1-version \"+)(.+\">)@\1$2\">@" add_packages.sh
|
2024-10-24 06:12:12 +08:00
|
|
|
sed -i -E "s@($1-download-http \"+)(.+\">)@\1$3\">@" ./"$4"/"$1".xml
|
2024-11-01 08:38:40 +08:00
|
|
|
sed -i -E "s@($1-md5sum *\"+)(.+\">)@\1$MD5\">@" ./"$4"/"$1".xml
|
2024-10-18 05:57:32 +08:00
|
|
|
echo "Latest version: $2"
|
2024-11-01 08:38:40 +08:00
|
|
|
echo "MD5 sum: $MD5"
|
2024-10-24 06:12:12 +08:00
|
|
|
printf "Found package: %s\n" "$3"
|
2024-10-18 05:57:32 +08:00
|
|
|
}
|
|
|
|
|
2024-10-08 04:50:44 +08:00
|
|
|
# Function that gets the latest release of a specific package.
|
|
|
|
# This function works only with packages stored on github.
|
|
|
|
getLatestGithubRelease()
|
|
|
|
{
|
2024-10-24 06:12:12 +08:00
|
|
|
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 '<a href=' | grep '.tar.' -m1 | tr '"' '\n' | grep /releases/)"
|
|
|
|
VER=$(echo "$URL" | awk -F/ '{ print $(NF-1) }' | awk -F- '{ print $NF }')
|
2024-10-09 00:55:51 +08:00
|
|
|
if [[ $4 ]]; then
|
2024-10-24 06:12:12 +08:00
|
|
|
VER=$(echo "$VER" | cut -c"$4")
|
2024-11-01 08:38:40 +08:00
|
|
|
fi
|
|
|
|
updatePkg "$2" "$VER" "$URL" "$3" "$MD5"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Function that gets the latest release of a specific package.
|
|
|
|
# This function works only with packages stored on github.
|
|
|
|
# It generates a codeload tar.gz download link
|
|
|
|
getLatestCodeloadRelease()
|
|
|
|
{
|
|
|
|
greetMsg "$2"
|
|
|
|
VER=$(curl -v --silent "https://github.com/$1/releases" 2>&1 | grep 'loading="lazy" src=' | tr '"' '\n' | grep /releases/ -m1 | rev | cut -d/ -f1 | rev)
|
|
|
|
URL="https://codeload.github.com/$1/tar.gz/refs/tags/$VER"
|
2024-10-24 06:12:12 +08:00
|
|
|
updatePkg "$2" "$VER" "$URL" "$3"
|
2024-10-18 05:57:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function that gets the latest release of a specific package.
|
|
|
|
# This function works only with packages stored on sourceforge.
|
|
|
|
getLatestSourceforgeRelease()
|
|
|
|
{
|
2024-10-24 06:12:12 +08:00
|
|
|
greetMsg "$2"
|
|
|
|
URL=$(curl -v --silent "https://sourceforge.net/projects/$1/files/$2/" 2>&1 | grep net.sf.files | tr '"' '\n' | grep http -m1 | rev | cut -c10- | rev)
|
|
|
|
VER=$(echo "$URL" | awk -F/ '{ print $NF }')
|
2024-10-18 05:57:32 +08:00
|
|
|
if [[ $4 ]]; then
|
2024-10-24 06:12:12 +08:00
|
|
|
VER=$(echo "$VER" | cut -c"$4")
|
2024-10-18 05:57:32 +08:00
|
|
|
fi
|
|
|
|
URL=$URL/$2-$VER.tar.gz
|
2024-10-24 06:12:12 +08:00
|
|
|
updatePkg "$2" "$VER" "$URL" "$3"
|
2024-10-08 04:50:44 +08:00
|
|
|
}
|
|
|
|
|
2024-10-07 05:00:45 +08:00
|
|
|
#minidlna
|
2024-10-18 05:57:32 +08:00
|
|
|
getLatestSourceforgeRelease minidlna minidlna server/other
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#libid3tag
|
2024-10-18 05:57:32 +08:00
|
|
|
getLatestSourceforgeRelease mad libid3tag multimedia/libdriv
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#pkcs11-helper
|
2024-10-08 04:50:44 +08:00
|
|
|
getLatestGithubRelease OpenSC/pkcs11-helper pkcs11-helper postlfs/security
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#QMPlay2
|
2024-10-08 04:50:44 +08:00
|
|
|
getLatestGithubRelease zaps166/QMPlay2 qmplay2 multimedia/videoutils
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#qBittorrent
|
2024-10-18 05:57:32 +08:00
|
|
|
getLatestSourceforgeRelease qbittorrent qbittorrent xsoft/other 13-
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#libtorrent-rasterbar
|
2024-10-09 00:55:51 +08:00
|
|
|
getLatestGithubRelease arvidn/libtorrent libtorrent-rasterbar networking/netlibs 2-
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#SDL2-image
|
2024-10-08 04:50:44 +08:00
|
|
|
getLatestGithubRelease libsdl-org/SDL_image sdl2-image general/graphlib
|
2024-10-07 05:00:45 +08:00
|
|
|
|
|
|
|
#SDL2-ttf
|
2024-10-08 04:50:44 +08:00
|
|
|
getLatestGithubRelease libsdl-org/SDL_ttf sdl2-ttf general/graphlib
|
|
|
|
|
2024-11-01 08:38:40 +08:00
|
|
|
#vscode
|
|
|
|
getLatestCodeloadRelease microsoft/vscode vscode xsoft/other
|
2024-10-07 05:00:45 +08:00
|
|
|
|