Last active
March 7, 2017 02:18
-
-
Save tavinus/f2d13deb5341580c7f639b1847ffaf13 to your computer and use it in GitHub Desktop.
hplip 3.16.11 mint 17.3 install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TRUE=0 | |
FALSE=1 | |
PBIN="$(which python)" | |
PY2="$(python --version 2>&1 | grep -w 'Python 2')" | |
[[ -z $PY2 ]] && PY2=$FALSE || PY2=$TRUE | |
WGETBIN="$(which wget 2>/dev/null)" | |
CURLBIN="$(which curl 2>/dev/null)" | |
HPLINK='https://downloads.sourceforge.net/project/hplip/hplip/3.16.7/hplip-3.16.7.run?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fhplip%2Ffiles%2Flatest%2Fdownload%3Fsource%3Dtyp_redirect&ts=1488851803&use_mirror=ufpr' | |
HPFILE="hplip-3.16.7.run" | |
[[ -z $WGETBIN ]] && HASWGET=$FALSE || HASWGET=$TRUE | |
[[ -z $CURLBIN ]] && HASCURL=$FALSE || HASCURL=$TRUE | |
if [[ $HASWGET -eq $FALSE && $HASCURL -eq $FALSE ]]; then | |
echo "ERROR! Neither CURL or WGET was found, cannot continue!" | |
exit 2 | |
fi | |
echo "Elevating privileges..." | |
sudo -v | |
echo "Updating apt cache..." | |
sudo apt-get update &>/dev/null | |
echo "Installing requirements, please wait..." | |
if [[ $PY2 -eq $TRUE ]]; then | |
echo "Python Environment: Python 2" | |
sudo apt-get install --assume-yes avahi-utils libcups2 cups libcupsimage2-dev libcups2-dev cups-bsd cups-client \ | |
libdbus-1-dev build-essential ghostscript openssl libjpeg8-dev libsnmp-dev snmp-mibs-downloader libtool libusb-1.0.0-dev \ | |
wget python-imaging python-dbus python-gobject python-dev python python-reportlab libsane libsane-dev sane-utils xsane &>/dev/null | |
else | |
echo "Python Environment: Python 3" | |
sudo apt-get install --assume-yes avahi-utils libcups2 cups libcupsimage2-dev libcups2-dev cups-bsd cups-client \ | |
libdbus-1-dev build-essential ghostscript openssl libjpeg8-dev libsnmp-dev snmp-mibs-downloader libtool libusb-1.0.0-dev \ | |
wget policykit-1 policykit-1-gnome python3-dbus python3-gi python3-dev python3-notify2 python3-pil python3-pyqt4 \ | |
python3-dbus.mainloop.qt python3-reportlab python3-lxml libsane libsane-dev sane-utils xsane &>/dev/null | |
fi | |
echo "Downloading hplip to home folder" | |
cd "$HOME" | |
if [[ $HASWGET -eq $TRUE ]]; then | |
"$WGETBIN" "$HPLINK" -O "$HPFILE" &>/dev/null | |
else | |
"$CURLBIN" -o "$HPFILE" "$HPLINK" &>/dev/null | |
fi | |
if [[ ! -f $HOME/$HPFILE ]]; then | |
echo "ERROR! Could not find downloaded hplip file, aborting..." | |
exit 3 | |
fi | |
echo "Running hplip installer, please proceed with installation..." | |
/bin/bash "$HOME/$HPFILE" | |
RET=$? | |
if [[ $RET -eq 0 ]]; then | |
echo "No errors detected" | |
#rm "$HOME/$HPFILE" | |
else | |
echo "Errors were detected during the installation..." | |
fi | |
echo "All done, bye..." | |
exit $RET | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment