Skip to content

Instantly share code, notes, and snippets.

@bspavel
Last active March 24, 2020 08:24
Show Gist options
  • Select an option

  • Save bspavel/a22a409eff8bb809f3b7718b83a979a9 to your computer and use it in GitHub Desktop.

Select an option

Save bspavel/a22a409eff8bb809f3b7718b83a979a9 to your computer and use it in GitHub Desktop.
the installer of the print server on the raspberry pi
#!/bin/bash
#http://www.ekzorchik.ru/2017/09/print-server-cups-on-raspberry-pi-3/
#https://habrahabr.ru/post/328576/
#https://wiki.debian.org/ru/HowTo/ChangeHostname
#http://help.ubuntu.ru/wiki/сканеры_решение_общих_проблем_с_подключением
#http://www.sane-project.org/sane-mfgs.html#Z-CANON
#https://feeding.cloud.geek.nz/posts/setting-up-a-network-scanner-using-sane/
#https://wiki.contribs.org/SANE
#https://dev.shyd.de/2011/03/debian-printserver-scanserver-hplip-cups-sane/
#https://kbpdfstudio.qoppa.com/how-to-solve-failed-to-start-saned-service-unit-saned-service-is-masked-on-linux/
#https://feeding.cloud.geek.nz/posts/setting-up-a-network-scanner-using-sane/
#https://askubuntu.com/questions/762702/failed-to-start-saned-service-unit-saned-service-is-masked
#https://help.ubuntu.com/community/SaneDaemonTutorial
#https://habrahabr.ru/post/242513/
#https://stackoverflow.com/questions/2642585/read-a-variable-in-bash-with-a-default-value
#https://askubuntu.com/questions/76808/how-do-i-use-variables-in-a-sed-command
#https://stackoverflow.com/questions/9533679/how-to-insert-a-text-at-the-beginning-of-a-file
sudo rm -Rf /var/lib/apt/lists
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
read -p "input the print server host name [default: print-server.lan]:" pshost
pshost=${pshost:-print-server.lan}
echo $pshost
sudo echo "127.0.0.1 $pshost" >> /etc/hosts
sudo apt-get install cups avahi-daemon avahi-discover foomatic-db foomatic-db-engine -y
sudo usermod -a -G lpadmin pi
sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.backup
sudo cupsctl --remote-any
sudo apt-cache search xerox
sudo apt-get install printer-driver-splix
sudo /etc/init.d/cups restart
sudo cupsd -t
sed -i "1s/^/ServerAlias $pshost \n/" /etc/cups/cupsd.conf
clear
#check status of the port 631
sudo netstat -tulpn | grep cupsd
echo "Add a printer from the cups web form"
echo "http://$pshost:631"
read -n 1 -s -r -p "Press any key to continue"
#Add ability to restrict access to printers by IP address
#https://github.com/apple/cups/issues/3526
#How can I enable remote access to the Admin page in CUPS
#https://serverfault.com/questions/836266/how-can-i-enable-remote-access-to-the-admin-page-in-cups
#How to configure cups to allow remote printing with authentication and local printing without?
#https://serverfault.com/questions/309532/how-to-configure-cups-to-allow-remote-printing-with-authentication-and-local-pri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment