I wrote up a script to install cups-connector on Ubuntu 15.10 and it might work on other systems that use systemd too? Forgive me if it's ugly, I'm not what you'd call a shell script master by any means. I mostly just Googled how to do what I wanted it to do. Anyway here it is. Tested to work on my desktop and home server.(Both Ubuntu 15.10) I wanted to post it up here to see if it's something you'd like in the wiki and to get other people's input on it.
#!/bin/bash
w=`tput setab 7`
r=`tput setaf 1`
g=`tput setaf 2`
y=`tput setaf 3`
b=`tput setaf 4`
d=`tput sgr0`
latest_release=2015.10.05
echo "Installing ${w}${b}G${r}o${y}o${b}g${g}l${r}e${d} Cloud Print CUPS Connector."
#Install dependencies if the script is run on an Ubuntu machine:
if [[ $(uname -v | grep -F 'Ubuntu') = *Ubuntu* ]]; then
sudo apt-get install libcups2 libavahi-client3 avahi-daemon
fi
#Download & extract the correct version of the latest binaries:
if [[ $(uname -i | grep -Fx 'x86_64') = *x86_64* ]]; then
wget https://github.com/google/cups-connector/releases/download/$latest_release/gcp-cups-connector-linux-amd64-$latest_release.tar.gz
tar -xzvf gcp-cups-connector-linux-amd64-$latest_release.tar.gz
else
wget https://github.com/google/cups-connector/releases/download/$latest_release/gcp-cups-connector-linux-386-$latest_release.tar.gz
tar -xzvf gcp-cups-connector-linux-386-$latest_release.tar.gz
fi
#Create an unprivileged gcp system user:
sudo useradd -s /usr/sbin/nologin -r -M gcp
#Create /opt/gcp_cups_connector:
sudo mkdir /opt/gcp_cups_connector
#Move the binaries to /opt/gcp_cups_connector:
sudo mv ~/cups-connector/gcp-cups-connector /opt/gcp_cups_connector
sudo mv ~/cups-connector/gcp-cups-connector-util /opt/gcp_cups_connector
#Make sure the binaries are executable:
sudo chmod 755 /opt/gcp_cups_connector/gcp-cups-connector
sudo chmod 755 /opt/gcp_cups_connector/gcp-cups-connector-util
#Change the owner of the binaries to gcp:
sudo chown gcp:gcp /opt/gcp_cups_connector/gcp-cups-connector
sudo chown gcp:gcp /opt/gcp_cups_connector/gcp-cups-connector-util
#Delete unneeded folder:
rmdir ~/cups-connector
#Write the systemd service file:
printf '[Unit]
Description=Google Cloud Print CUPS Connector
After=printer.target network.target multi-user.target
[Service]
ExecStart=/opt/gcp_cups_connector/gcp-cups-connector -config-filename /etc/gcp_cups_connector/gcp-cups-connector.config.json
Restart=on-abort
User=gcp
Group=gcp
[Install]
WantedBy=multi-user.target' > gcp.service
#Move the gcp service file to /etc/systemd/system:
sudo mv ~/gcp.service /etc/systemd/system
#Change the file permissions of the gcp service file:
sudo chmod 664 /etc/systemd/system/gcp.service
#Change the owner of the gcp service file to gcp:
sudo chown gcp:gcp /etc/systemd/system/gcp.service
#Make a gcp config:
/opt/gcp_cups_connector/gcp-cups-connector-util -init
#Make /etc/gcp_cups_connector:
sudo mkdir /etc/gcp_cups_connector
#Move the gcp config to /etc/gcp_cups_connector:
sudo mv ~/gcp-cups-connector.config.json /etc/gcp_cups_connector
#Change the file permissions of the gcp config:
sudo chmod 664 /etc/gcp_cups_connector/gcp-cups-connector.config.json
#Change the owner of the gcp config to gcp:
sudo chown gcp:gcp /etc/gcp_cups_connector/gcp-cups-connector.config.json
#Enable the gcp systemd service:
sudo systemctl enable gcp
echo "Reboot your computer/server and enjoy!!!"
Very helpful, thanks. I did not execute the script, but followed along executing the commands.
Ubuntu 15.10 / gcp-cups-connector-linux-amd64-2015.10.05.tar.gz
I wrote up a script to install cups-connector on Ubuntu 15.10 and it might work on other systems that use systemd too? Forgive me if it's ugly, I'm not what you'd call a shell script master by any means. I mostly just Googled how to do what I wanted it to do. Anyway here it is. Tested to work on my desktop and home server.(Both Ubuntu 15.10) I wanted to post it up here to see if it's something you'd like in the wiki and to get other people's input on it.