# The targeted and tested distros are: Debian, Ubuntu (and derivates), Fedora, CentOS, OpenSUSE and Mint
# Copyright © 2017-2019 einar.haraldseid@ntnu.no
# The targeted and tested distros are: Debian, Ubuntu (and derivates), Fedora, CentOS, OpenSUSE and Mint
# Copyright © 2017-2019 einar.haraldseid@ntnu.no
echo "Usage: ./$(basename "${0}") [OPTIONS]"
echo "Options:"
echo " -m, --model {ricoh|generic} Printer model to install (default: generic)"
echo "Usage: ./$(basename "${0}") [OPTIONS]"
echo "Options:"
echo " -m, --model {ricoh|generic} Printer model to install (default: generic)"
echo " -f, --force Force running script as if on Linux systems"
echo " -p, --plaintext Store credentials as plaintext in /etc/cups/printers.conf (Linux only)"
echo " -h, --help Display this help text"
echo " -f, --force Force running script as if on Linux systems"
echo " -p, --plaintext Store credentials as plaintext in /etc/cups/printers.conf (Linux only)"
echo " -h, --help Display this help text"
if [ "${Model}" = "ricoh" ]; then
# This should match Fedora and other modern rpm based systems that have dnf as the primary package manager
if command -v dnf >/dev/null 2>&1; then
if [ "${Model}" = "ricoh" ]; then
# This should match Fedora and other modern rpm based systems that have dnf as the primary package manager
if command -v dnf >/dev/null 2>&1; then
printerror "You don't seem to have the correct printer drivers installed, please run:"
printerror " sudo dnf install foomatic-db-ppds"
printerror "first, or use the generic model instead."
printerror "You don't seem to have the correct printer drivers installed, please run:"
printerror " sudo dnf install foomatic-db-ppds"
printerror "first, or use the generic model instead."
printerror "You don't seem to have the foomatic-filters package installed, please run:"
printerror " sudo yum install foomatic-filters"
printerror "first, or use the generic model instead."
exit 1
printerror "You don't seem to have the foomatic-filters package installed, please run:"
printerror " sudo yum install foomatic-filters"
printerror "first, or use the generic model instead."
exit 1
printerror "You don't seem to have the correct printer drivers installed, please run:"
printerror " sudo yum install foomatic-db-ppds"
printerror "first, or use the generic model instead."
printerror "You don't seem to have the correct printer drivers installed, please run:"
printerror " sudo yum install foomatic-db-ppds"
printerror "first, or use the generic model instead."
if [ "${Uname}" = "linux" ] && [ "${Plaintext}" != "YES" ]; then
echo -e "\nPlease note: due to the way credentials are stored and accessed on Linux, some print operations will still halt for credentials, notably the \"Print test page\" function. In those cases, supply your normal NTNU username and password."
if [ "${Uname}" = "linux" ] && [ "${Plaintext}" != "YES" ]; then
echo -e "\nPlease note: due to the way credentials are stored and accessed on Linux, some print operations will still halt for credentials, notably the \"Print test page\" function. In those cases, supply your normal NTNU username and password."