#!/bin/bash
roxterm -T Cups-Management-Console -e "bash -c ' \\
TEXTDOMAINDIR=/usr/share/locale; \\
TEXTDOMAIN=antix26-desktop-files; \\
export TEXTDOMAIN TEXTDOMAINDIR; \\
source gettext.sh; \\
if test -x /usr/sbin/cupsd; then \\
\\
(i=\$(ps --no-headers -o comm --pid 1); pgrep cups >/dev/null || (([ \$i == runit ] || [ \$i == s6-66 ] || [ \$i == s6-rc ] || [ \$i == dinit ]) && (echo -en \"\n\033[1;33m\"; (gettext \"Cups service not started.\"; echo -n \" \"; gettext \"Please check whether it is already in the service list, and if found, highlight the entry and make sure its status is reported as active (press start in the service section to activate it, and check the status of system start line to make it permanent at system startup if needed).\"; echo -n \" \"; gettext \"If not in list, click add button, and highlight cups in the new dialog, then click add therein.\")|fold -s -w80; echo -e \"\n\"); [ \$i == runit ] && ((gettext \"Once done and cups service up, close the runit service manager window.\"; echo -n \" \"; gettext \"Keep this window open.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; gksu --sudo-mode -- /usr/bin/runit-service-manager.sh >/dev/null 2>&1); [ \$i == s6-66 ] && ((gettext \"Once done and cups service up, close the s6-66 service manager window.\"; echo -n \" \"; gettext \"Keep this window open.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; gksu --sudo-mode -- /usr/bin/66-rc-dialogbox-manager >/dev/null 2>&1); [ \$i == s6-rc ] && ((gettext \"Once done and cups service up, close the s6-rc service manager window.\"; echo -n \" \"; gettext \"Keep this window open.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; gksu --sudo-mode -- /usr/bin/s6-rc-dialogbox-manager >/dev/null 2>&1); [ \$i == dinit ] && ((gettext \"Once done and cups service up, close the dinit service manager window.\"; echo -n \" \"; gettext \"Keep this window open.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; gksu --sudo-mode -- /usr/bin/dinit-dialogbox-manager >/dev/null 2>&1);([ \$i == sysvinit ] && (echo -en \"\n\033[1;33m\"; (gettext \"Cups service not started.\"; echo -n \" \"; gettext \"Please move the Cursor with arrow keys to the first column in the line which reads Cups, the space between the brackets must be highlighted.\"; echo -n \" \"; gettext \"Then either press the + key to start the service or press the space bar to set an X in this very place to make the cups service start permanent at system startup.\")|fold -s -w80; echo -e \"\n\"; (gettext \"Once done, close the manager by pressing the q key.\"; echo -n \" \"; gettext \"Keep this window open.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; (urxvt -e sudo /sbin/sysv-rc-conf))));if pgrep cups >/dev/null; then (coproc (nohup links2 -g http://localhost:631/admin >/dev/null 2>&1); clear; echo -en \"\n\033[1;33m\"; (gettext \"The cups management console should have popped open in your default browser now.\"; echo -n \" \"; gettext \"Click e.g. Add Printer, Find Printers or Manage Printers, or click the jobs tab in its header line to manage running print jobs.\"; echo -n \" \"; gettext \"If unsure what to do, click the help tab for further reading.\")|fold -s -w80; echo -e \"\033[0;37m\n\"; sleep 40); else (echo -e \"\033[1;31m\n\"; gettext \"Something went wrong!\"; echo -n \" \"; gettext \"Service not accessible.\"; echo -e \"\n\"; gettext \"Please make sure Cups service is running, then retry.\"|fold -s -w80; echo -e \"\033[0;37m\n\"; sleep 40); fi);else (echo -e \"\033[1;31m\n\"; gettext \"Cups not installed! Please install cups and cups-daemon before retrying.\"|fold -s -w80; echo -e \"\033[0;37m\n\"; sleep 40); fi'"
