Files

Post-Installation Script Testing

This directory contains a quick (but not complete) test for post-installation script in a safe, isolated container environment. The container has no UI installed and therefore can't test the UI related parts of the script (Taskbar adaptions), but it allows to test the logic, prompts, and error handling of the script.

Prerequisites

  • Docker or Podman installed on the host system. If Podman is used, an alias for docker command should be set up (e.g. alias docker=podman)
  • in order to use the provided scripts without modification.

Contents

  • Dockerfile - Container image definition for testing
  • 01_create_image.sh - script for creating container image locally
  • 02_start_container_with_image.sh - script for starting container from created image

Purpose

Provides a reproducible testing environment that allows:

  • Running the post-installation script without affecting the host system
  • Real apt installations (isolated in container)
  • Testing script logic, prompts, and error handling
  • Validating syntax and tracing execution

Features

The Dockerfile includes:

  • Ubuntu 22.04 base image
  • Passwordless sudo for real apt installations
  • Useful utilities: bash, wget, tar, curl, gnupg, ca-certificates, file, procps, sudo

Usage

Build the test image

Run the prepared shell script to build the image

cd post_installation_script_test
bash 01_create_image.sh

Start a container for testing

Run the prepared shell script start a new container for testing based in the image and remove container after it is stopped. After container is started an interactive session is started into the container.

cd post_installation_script_test
bash 02_start_container_with_image.sh

Test the script file in the running container

After container is started an interactive session was started in the container and the script can be started for testing. The source script folder is mounted read-only to /workspace-source and contents are copied to /workspace at container startup. To test changes made on the host, restart the container - it will copy the updated files.

ls -al
bash <scriptName>.sh

Security Notes

  • The source script folder is mounted read-only to /workspace-source
  • Contents are automatically copied to /workspace (writable) at container startup
  • This keeps the host script folder untouched while allowing the script to write files (e.g., font extraction)
  • All apt installations are real but isolated in the container
  • Use --tmpfs /tmp:rw for any temporary writes inside the container
  • Container is automatically removed after exit (--rm flag)