add fallback url to hp-plugin-download

This commit is contained in:
Zdenek Dohnal 2024-01-19 09:23:18 +01:00
parent d726b77698
commit 187b064062
2 changed files with 26 additions and 7 deletions

View File

@ -9,12 +9,20 @@ then
exit 1
fi
# link to the plugin
PLUGIN_SOURCE="https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-${VER}-plugin.run"
# plugin name
PLUGIN_FILE="hplip-${VER}-plugin.run"
download()
{
SOURCE="$1"
@bindir@/curl --create-dir -O --output-dir ~/.hplip ${SOURCE}
}
# link to the plugin
PLUGIN_SOURCE="https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${PLUGIN_FILE}"
FALLBACK_SOURCE="https://developers.hp.com/sites/default/files/${PLUGIN_FILE}"
# create a hidden hplip dir to store a file indicating the plugin version after successful install
# the directory can be used by other hplip tools, so we don't have to remove it if the failure happens
if [ ! -d ~/.hplip ]
@ -22,11 +30,19 @@ then
@bindir@/mkdir ~/.hplip || (@bindir@/echo "Cannot create the ~/.hplip dir, exiting" && exit 1)
fi
@bindir@/curl --create-dir -O --output-dir ~/.hplip ${PLUGIN_SOURCE}
for link in ${PLUGIN_SOURCE} ${FALLBACK_SOURCE}
do
download ${link}
if [ ! -f ~/.hplip/${PLUGIN_FILE} ]
if test "x$(file --mime ~/.hplip/${PLUGIN_FILE} | grep 'text/x-shellscript')" = "xtext/x-shellscript"
then
break
fi
done
if test "x$(file --mime ~/.hplip/${PLUGIN_FILE} | grep 'text/x-shellscript')" = "x"
then
@bindir@/echo "The downloaded file does not exist - error during downloading, exiting..."
@bindir@/echo "The downloaded file does not exist or is not a shell script - error during downloading, exiting..."
exit 1
fi

View File

@ -7,7 +7,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.23.12
Release: 1%{?dist}
Release: 2%{?dist}
# most files (base/*, *, ui*/...) - GPL2+
# prnt/hpijs/ jpeg related files - IJG
# prnt/* - BSD-3-Clause-HP - it is modified a little, asked here https://gitlab.com/fedora/legal/fedora-license-data/-/issues/267
@ -966,6 +966,9 @@ find doc/images -type f -exec chmod 644 {} \;
%config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio
%changelog
* Fri Jan 19 2024 Zdenek Dohnal <zdohnal@redhat.com> - 3.23.12-2
- add fallback url to hp-plugin-download
* Mon Jan 08 2024 Zdenek Dohnal <zdohnal@redhat.com> - 3.23.12-1
- 2252302 - hplip-3.23.12 is available