diff --git a/packaging/TESTING.md b/packaging/TESTING.md deleted file mode 100644 index 102733ac0..000000000 --- a/packaging/TESTING.md +++ /dev/null @@ -1,126 +0,0 @@ -# CUPS-Rock Testing Guide - -This guide provides step-by-step instructions to test printing using `cups-rock`. Ensure you have the following requirements installed before proceeding. - -## Requirements - -- Docker - - **Follow the [official Docker installation guide](https://docs.docker.com/get-docker/) for your operating system.** - -- `cups-ipp-utils` -- `cups-client` - - Install the required packages using the following commands: - - ```sh - sudo apt-get update - sudo apt-get install cups-ipp-utils cups-client -y - ``` -## Step-by-Step Guide to Test CUPS-Rock - -### 1. Setup IPP Everywhere Printer -To simulate a printer for testing, use `ippeveprinter`: - -```sh -/usr/sbin/ippeveprinter -f application/pdf myprinter -``` - -### 2. Start the CUPS Container -Open another terminal session and start the CUPS container with the following environment variables: - -```sh -CUPS_ADMIN="print" -CUPS_PASSWORD="print" -CUPS_PORT=631 -``` - -#### Run the following Docker command to start cups available on docker hub: -```sh -sudo docker run --rm -d --name cups --network host \ - -e CUPS_PORT="${CUPS_PORT}" \ - -e CUPS_ADMIN="${CUPS_ADMIN}" \ - -e CUPS_PASSWORD="${CUPS_PASSWORD}" \ - openprinting/cups:latest -``` - -Alternatively: - -#### Use Rockcraft to build image locally -1. Install rockcraft: - ```sh - sudo snap install rockcraft --classic - ``` -2. Pack with Rockcraft: - ```sh - sudo rockcraft pack -v - ``` -3. Compile Docker Image Using Skopeo: - ```sh - ROCK="$(ls *.rock | tail -n 1)" - sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:cups:latest - ``` -3. Run the CUPS Docker Container: - ```sh - ```sh - sudo docker run --rm -d --name cups --network host \ - -e CUPS_PORT="${CUPS_PORT}" \ - -e CUPS_ADMIN="${CUPS_ADMIN}" \ - -e CUPS_PASSWORD="${CUPS_PASSWORD}" \ - cups:latest - ``` - -### 3. Add Test Printer to CUPS Server -You can either use the `CUPS web interface` to add a test printer or use the following command: -```sh -sudo docker exec -u "${CUPS_ADMIN}" cups lpadmin -p testprinter \ - -v ipps://myprinter._ipps._tcp.local/ -E -m everywhere -``` - -### 4. Test Printing Files -#### From Host System -To test printing files from the host system: - -```sh -CUPS_SERVER=localhost:CUPS_PORT lp -d testprinter -``` - -To check the print status: -```sh -CUPS_SERVER=localhost:CUPS_PORT lpstat -W completed -``` - -#### From Inside the Container -##### To test printing files without creating any print queue -Print a file present inside container without creating print queue -```sh -sudo docker exec -u "${CUPS_ADMIN}" cups lp -d myprinter /share/cups/ipptool/testfile.txt -``` - -##### To test printing files from inside the container: -1. Copy the file inside the container: - ```sh - sudo docker cp cups: - ``` -2. Print the file using the following command: - ```sh - sudo docker exec -u "${CUPS_ADMIN}" cups lp -d testprinter - ``` - -##### Print File Already Present Inside Container -To print a file already present inside the container: -```sh -sudo docker exec -u "${CUPS_ADMIN}" cups lp -d testprinter /share/cups/ipptool/testfile.txt -``` - -Check Job Status -```sh -sudo docker exec -u "${CUPS_ADMIN}" cups lpstat -W completed -``` - -You can also use the CUPS web interface to check the job status. - -## Notes -- Ensure all the environment variables are correctly set before running the Docker commands. -- The CUPS web interface can be accessed at `http://localhost:CUPS_PORT` to manage printers and check job statuses. -- **The container must be started in `--network host` mode** to allow the CUPS instance inside the container to access and discover local printers running on the host system. diff --git a/packaging/rockcraft.yaml b/packaging/rockcraft.yaml index c51c07c44..f6fd05b3a 100644 --- a/packaging/rockcraft.yaml +++ b/packaging/rockcraft.yaml @@ -1,3 +1,13 @@ +# +# Rock Configuration File for CUPS OCI Image +# +# Copyright © 2024-2025 by OpenPrinting. +# Copyright © 2024-2025 by Till Kamppeter +# Copyright © 2024-2025 by Rudra Pratap Singh +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# name: cups base: ubuntu@22.04 version: '2.4.11-3' diff --git a/packaging/scripts/rock/run-cupsd.sh b/packaging/scripts/rock/run-cupsd.sh index 10feed7e7..1d2c273e1 100644 --- a/packaging/scripts/rock/run-cupsd.sh +++ b/packaging/scripts/rock/run-cupsd.sh @@ -1,5 +1,14 @@ #!/bin/sh - +# +# CUPS Server Initialization Script for OCI Image +# +# Copyright © 2024-2025 by OpenPrinting. +# Copyright © 2024-2025 by Till Kamppeter +# Copyright © 2024-2025 by Rudra Pratap Singh +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -eux # Ensure the lpadmin group exists diff --git a/packaging/scripts/rock/run-dbus.sh b/packaging/scripts/rock/run-dbus.sh index 4915eb1ba..a37ce4687 100644 --- a/packaging/scripts/rock/run-dbus.sh +++ b/packaging/scripts/rock/run-dbus.sh @@ -1,5 +1,15 @@ #!/bin/sh - +# +# Script to initialize system services (users, D-Bus, Avahi) for the CUPS OCI +# container environment. +# +# Copyright © 2024-2025 by OpenPrinting. +# Copyright © 2024-2025 by Till Kamppeter. +# Copyright © 2024-2025 by Rudra Pratap Singh. +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -eux echo "Creating system users" diff --git a/packaging/scripts/snap/reload-cups-browsed b/packaging/scripts/snap/reload-cups-browsed index 3c65dfa39..02c94cf42 100755 --- a/packaging/scripts/snap/reload-cups-browsed +++ b/packaging/scripts/snap/reload-cups-browsed @@ -1,5 +1,12 @@ #! /bin/sh - +# +# Script stop cups-browsed service. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -e -x # Stop cups-browsed to get it automatically restarted diff --git a/packaging/scripts/snap/reload-cupsd b/packaging/scripts/snap/reload-cupsd index d4512a4b6..ed423441d 100755 --- a/packaging/scripts/snap/reload-cupsd +++ b/packaging/scripts/snap/reload-cupsd @@ -1,5 +1,12 @@ #! /bin/sh - +# +# Script to reload the CUPS daemon (cupsd). +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -e -x # Send HUP signal to CUPS diff --git a/packaging/scripts/snap/run-cups-browsed b/packaging/scripts/snap/run-cups-browsed index 6a7a173e9..2bd30ef02 100755 --- a/packaging/scripts/snap/run-cups-browsed +++ b/packaging/scripts/snap/run-cups-browsed @@ -1,5 +1,12 @@ #! /bin/sh - +# +# Script to initialize and manage the cups-browsed service in a Snap environment. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -e -x mkdir -p $SNAP_DATA/var/log diff --git a/packaging/scripts/snap/run-cupsd b/packaging/scripts/snap/run-cupsd index 155921224..a639505d9 100755 --- a/packaging/scripts/snap/run-cupsd +++ b/packaging/scripts/snap/run-cupsd @@ -1,4 +1,15 @@ #! /bin/sh +# +# This script initializes and manages CUPS services in a Snap environment, +# including setting up required directories, configuring CUPS settings, +# handling proxy mode, and running the CUPS server. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# + set -e -x diff --git a/packaging/scripts/snap/run-util b/packaging/scripts/snap/run-util index 3bbd26144..3b11fefe3 100755 --- a/packaging/scripts/snap/run-util +++ b/packaging/scripts/snap/run-util @@ -1,4 +1,14 @@ #! /bin/sh +# +# This script sets environment variables required for configuring and +# running the CUPS service in a Snap environment, including the locations +# for server root, data, fonts, and configuration files. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# #set -e -x diff --git a/packaging/scripts/snap/stop-cups-browsed b/packaging/scripts/snap/stop-cups-browsed index 5bddfbc73..2b0a2f0a7 100755 --- a/packaging/scripts/snap/stop-cups-browsed +++ b/packaging/scripts/snap/stop-cups-browsed @@ -1,5 +1,12 @@ #! /bin/sh - +# +# This script is responsible for safely shutting down the cups-browsed service. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -e -x # Exit if we are already shutting down cups-browsed diff --git a/packaging/scripts/snap/stop-cupsd b/packaging/scripts/snap/stop-cupsd index 4987eca44..e4bb318d4 100755 --- a/packaging/scripts/snap/stop-cupsd +++ b/packaging/scripts/snap/stop-cupsd @@ -1,5 +1,14 @@ #! /bin/sh - +# +# This script is responsible for safely shutting down the CUPS service +# and associated components (cups-browsed and cups-proxyd) in a Snap +# environment. +# +# Copyright © 2020 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# set -e -x # Exit if we are already shutting down cupsd diff --git a/packaging/snapcraft.yaml b/packaging/snapcraft.yaml index e8171650e..4605ae565 100644 --- a/packaging/snapcraft.yaml +++ b/packaging/snapcraft.yaml @@ -1,3 +1,12 @@ +# +# Snap Configuration File for CUPS Snap +# +# Copyright © 2024-2025 by OpenPrinting. +# Copyright © 2015-2021 by Till Kamppeter +# +# Licensed under Apache License v2.0. See the file "LICENSE" for more +# information. +# name: cups base: core22 # The base Snap is the execution environment for this Snap version: '2.4.11-3'