]> &iconPATH; ### 2026.07.29 - Install screen-5.0.2-x86_64-1.txz with automatic checksum validation and mirror fallback ### 2026.05.17 - Install the latest available &screenPkgPattern; build with automatic checksum validation and mirror fallback ### 2026.01.23 - Install screen-5.0.1-x86_64-1.txz with automatic checksum validation and mirror fallback ### 2024.06.11 - Initial release to install screen-4.9.0-x86_64-1 /dev/null")); if ($installed && strpos($installed, "XML file doesn't exist") === false) { if (version_compare($installed, "2026.05.17", ">=")) { echo "Installed plugin version ($installed) is up to date.\n"; exit(0); } } ?> ]]> mkdir -p "&plgPATH;" mkdir -p "/usr/local/emhttp/plugins/&name;" # Download plugin icon if wget -q --timeout=20 --tries=2 -O "&iconPATH;" "&iconURL;"; then chmod 0644 "&iconPATH;" 2>/dev/null || true fi exit 0 set -e sums_path="&plgPATH;/CHECKSUMS.md5" mirrors="http://slackware.uk/slackware/slackware64-current http://mirrors.slackware.com/slackware/slackware64-current http://slackware.osuosl.org/slackware64-current" download_first_working() { out="$1" shift for url in "$@"; do echo "Trying $url" if wget -q --timeout=20 --tries=2 -O "$out" "$url"; then return 0 fi done return 1 } sums_urls="" for root in $mirrors; do sums_urls="$sums_urls $root/slackware64/CHECKSUMS.md5" done echo "" echo "-----------------------------------------------------------" echo " &name; installing" echo " Plugin version: &version;" echo " Screen package: &screenPkgPattern;" echo "-----------------------------------------------------------" echo "" echo "Downloading checksums" if ! download_first_working "$sums_path" $sums_urls; then echo "ERROR: Could not download CHECKSUMS.md5 from any mirror" exit 1 fi match_line="$( awk -v ver="&screenPkgVer;" -v arch="&screenArch;" ' $2 ~ "(^|/)slackware64/ap/screen-" ver "-" arch "-[0-9]+[.]txz$" || $2 ~ "(^|/)ap/screen-" ver "-" arch "-[0-9]+[.]txz$" { path=$2 sub(/^\.\//, "", path) file=path sub(/^.*\//, "", file) build=file sub("^screen-" ver "-" arch "-", "", build) sub("[.]txz$", "", build) print build, $1, path, file } ' "$sums_path" | sort -n | tail -n 1 )" if [ -z "$match_line" ]; then echo "ERROR: Could not find checksum entry for ap/&screenPkgPattern;" exit 1 fi set -- $match_line pkg_build="$1" expected="$2" pkg_rel_path="$3" pkg_file="$4" pkg_path="&plgPATH;/$pkg_file" case "$pkg_rel_path" in slackware64/*) pkg_mirror_path="$pkg_rel_path" ;; ap/*) pkg_mirror_path="slackware64/$pkg_rel_path" ;; *) echo "ERROR: Unexpected checksum path for $pkg_file: $pkg_rel_path" exit 1 ;; esac pkg_urls="" for root in $mirrors; do pkg_urls="$pkg_urls $root/$pkg_mirror_path" done echo "Selected screen package: $pkg_file (build $pkg_build)" find "&plgPATH;" -maxdepth 1 -type f -name "screen-*.txz" ! -name "$pkg_file" -delete 2>/dev/null || true echo "Downloading package" if ! download_first_working "$pkg_path" $pkg_urls; then echo "ERROR: Could not download $pkg_file from any mirror" exit 1 fi actual="$(md5sum "$pkg_path" | awk '{print $1}')" if [ "$actual" != "$expected" ]; then echo "ERROR: Checksum mismatch for $pkg_file" echo "Expected: $expected" echo "Actual: $actual" exit 1 fi echo "Checksum verified" upgradepkg --install-new --reinstall "$pkg_path" echo "" echo "-----------------------------------------------------------" echo " &name; has been installed." echo " Copyright 2024, &author;" echo " Plugin version: &version;" echo "-----------------------------------------------------------" echo "" set -e removepkg screen 2>/dev/null || true rm -f "&plgPATH;/screen-*.txz" 2>/dev/null || true rm -f "&plgPATH;/CHECKSUMS.md5" 2>/dev/null || true rm -rf "&plgPATH;" rm -rf "/usr/local/emhttp/plugins/&name;" echo "" echo "-----------------------------------------------------------" echo " &name; has been removed." echo " Copyright 2024, &author;" echo " Plugin version: &version;" echo "-----------------------------------------------------------" echo ""