mirror of
https://codeberg.org/knightsub9/lxcafe.git
synced 2026-07-19 19:30:16 +02:00
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start container with the test image (interactive shell)
|
||||
docker run -it --rm \
|
||||
--tmpfs /tmp:rw \
|
||||
-v "$(pwd)/../post_installation_script/":/workspace/:ro \
|
||||
mint-script-test
|
||||
--entrypoint bash \
|
||||
-v "$(pwd)/../post_installation_script/":/workspace-source:ro \
|
||||
mint-script-test \
|
||||
-c 'cp -r /workspace-source/* /workspace/ && cd /workspace && exec bash'
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
# Post-Installation Script Testing
|
||||
|
||||
This directory contains everything needed to test the post-installation script in a safe, isolated container environment.
|
||||
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
|
||||
|
||||
@@ -32,7 +38,7 @@ Run the prepared shell script to build the image
|
||||
|
||||
```bash
|
||||
cd post_installation_script_test
|
||||
sh 01_create_image.sh
|
||||
bash 01_create_image.sh
|
||||
```
|
||||
|
||||
### Start a container for testing
|
||||
@@ -41,23 +47,25 @@ image and remove container after it is stopped. After container is started an in
|
||||
|
||||
```bash
|
||||
cd post_installation_script_test
|
||||
sh 02_start_container_with_image.sh
|
||||
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.
|
||||
If script is changed on the host it just needs to be restarted in the container to reflect the changes.
|
||||
This works because to folder is mounted into the 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.
|
||||
|
||||
```bash
|
||||
ls -al
|
||||
sh <scriptName>.sh
|
||||
bash <scriptName>.sh
|
||||
```
|
||||
|
||||
## Security Notes
|
||||
|
||||
- The script is mounted read-only (`:ro` flag) to prevent container from modifying host files
|
||||
- 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)
|
||||
|
||||
Reference in New Issue
Block a user