Submitted scripts and programs
Forum rules
Your own work only.
-
machinebacon
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
-
Contact:
Unread post
by machinebacon » Tue Jul 30, 2013 7:32 am
A shorty to install and set up CUPS
Code: Select all
#!/bin/bash
echo "Install CUPS (Common Unix Printing System)"
echo "Press \"y\" to install CUPS, or any key to abort"
read -n1 a
a=`echo $a | tr '[A-Z]' '[a-z]'`
if [ "$a" = "y" ]; then
echo ""
sudo apt-get install -y cups cups-pdf system-config-printer printer-driver-hpijs
x-www-browser http://localhost:631/
fi
..gnutella..
-
Alad
- should take a shower
- Posts: 447
- Joined: Wed May 21, 2014 12:52 am
Unread post
by Alad » Sun May 25, 2014 4:26 am
If you take system-config-printer, you might also want system-config-printer-udev for automation; but you could do with :631 alone
Here's what I came up with:
Code: Select all
#!/bin/bash
echo "Install CUPS (Common Unix Printing System)"
echo "Press \"y\" to install CUPS, or any key to abort"
read -n1 a
case "$a" in
[yY])
install
;;
*)
exit
;;
esac
install {
root=""
if [ $(id -u) != 0]; then
if sudo -l >/dev/null 2>&1; then
root=sudo
else
root="su -c"
fi
fi
$root "apt-get install cups cups-pdf printer-driver-hpijs" \
|| $(echo "Installing CUPS failed. Exiting..."; exit 1)
adduser $(grep 1000 /etc/passwd | cut -d':' -f1) lpadmin
cat > /usr/share/applications/cupsconfig.desktop <<EOF
[Desktop Entry]
Name=Printer configuration
Comment=Configure CUPS
Exec=x-www-browser http://127.0.0.1:631
Icon=printer
Terminal=false
Type=Application
StartupNotify=true
Categories=GTK;Settings;DesktopSettings;
EOF
}
echo "Press \"y\" to configure CUPS, or any key to abort"
read -n1 b
case "$b" in
[yY])
x-www-browser http://localhost:631
;;
*)
exit
;;
esac
More packages may be needed:
https://packages.debian.org/sid/task-print-server
PS: wrote this on a whim, none guarantees. 8o
It's funny how we used to be able to do real stuff with rudimentary computers, but now we can't. -- ratcheer