#########################################################################
# File Name: printer-3.15.11.sh
# Author: Konvict
# mail: ll360967178@126.com
# Created Time: Tue 01 Dec 2015 11:06:49 AM CST
#########################################################################
#!/bin/bash
if [ `id -u root` -ne 0 ]
then
echo "plz run this script as root"
exit 1
fi
yum -y -d 10 -e 1 install cups cups-devel gcc-c++ ghostscript \
libjpeg-devel glibc-headers libtool libusb-devel make python \
python-devel PyXML openssl-devel net-snmp-devel policycoreutils-gui \
PyQt PyQt-devel dbus-python notify-python sane-backends sane-backends-devel \
sane-frontends xsane python-imaging python-imaging-devel libusb-devel libusb \
libusb1-devel dbus-devel
rpm -ev --nodeps libsane-hpaio
rpm -ev hplip-gui hplip hpijs
wget http://prdownloads.sourceforge.net/hplip/hplip-3.15.11.tar.gz
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.15.11-plugin.run
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.15.11-plugin.run.asc
tar zxvf hplip-3.15.11.tar.gz
cd hplib-3.15.11
if [ -f /bin/lsblk ]then
yum install PyQt4 -y
else
yum install qt3 -y
fi
echo "plz select your CentOS distribution"
echo "CentOS 5 32bit input 1"
echo "CentOS 5 64bit input 2"
echo "CentOS 6 32bit input 3"
echo "CentOS 6 64bit input 4"
case $ver in
1)
./configure --prefix=/usr --with-hpppddir=/usr/share/cups/model/HP --enable-qt3 \
--disable-qt4 --disable-hpcups-install --disable-cups-drv-install --disable-cups-ppd-install \
--enable-hpijs-install --enable-foomatic-drv-install --enable-foomatic-ppd-install --enable-foomatic-rip-hplip-install \
--disable-fax-build --disable-dbus-build --enable-network-build --enable-scan-build --disable-policykit \
--enable-libusb01_build --enable-udev_sysfs_rules --enable-doc-build
;;
2)
./configure --prefix=/usr --with-hpppddir=/usr/share/cups/model/HP --libdir=/usr/lib64 \
--enable-qt3 --disable-qt4 --disable-hpcups-install --disable-cups-drv-install \
--disable-cups-ppd-install --enable-hpijs-install --enable-foomatic-drv-install \
--enable-foomatic-ppd-install --enable-foomatic-rip-hplip-install --disable-fax-build \
--disable-dbus-build --enable-network-build --enable-scan-build --disable-policykit \
--enable-libusb01_build --enable-udev_sysfs_rules --enable-doc-build
;;
3)
./configure --with-hpppddir=/usr/share/cups/model/HP --prefix=/usr --enable-qt4 \
--disable-libusb01_build --enable-doc-build --enable-cups-ppd-install \
--disable-foomatic-drv-install --disable-foomatic-ppd-install --disable-hpijs-install \
--disable-udev_sysfs_rules --disable-policykit --disable-cups-drv-install --enable-hpcups-install \
--enable-network-build --enable-dbus-build --enable-scan-build --enable-fax-build
;;
4)
./configure --with-hpppddir=/usr/share/cups/model/HP --libdir=/usr/lib64 --prefix=/usr \
--enable-qt4 --disable-libusb01_build --enable-doc-build --enable-cups-ppd-install \
--disable-foomatic-drv-install --disable-foomatic-ppd-install --disable-hpijs-install \
--disable-udev_sysfs_rules --disable-policykit --disable-cups-drv-install --enable-hpcups-install \
--enable-network-build --enable-dbus-build --enable-scan-build --enable-fax-build
;;
esac
make && make install
if [ `id -u lp` -ne 4 ]
then
/usr/sbin/usermod -a -G lp,sys $USER
fi
echo "hplip has installed,plz install hp-plugin and add printer manually"
echo "run hp-pugin to add printer. hplip-3.15.11-plugin.run and hplip-3.15.11-plugin.run.asc is in "`cd -`
exit 0