Skip to content

Commit 7e64ffb

Browse files
committed
Merge branch 'devel' of github.com:steviehs/CustomPiOS into devel
2 parents 47ea50a + 0f05cda commit 7e64ffb

91 files changed

Lines changed: 2474 additions & 496 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker-build.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
11
name: ci
2-
32
on:
43
push:
54
branches:
65
- "master"
76
- "devel"
87
- "docker-github-actions"
9-
8+
- "release/v1"
9+
- "beta"
10+
tags:
11+
- "*"
1012
jobs:
1113
docker:
1214
runs-on: ubuntu-latest
1315
steps:
1416
-
15-
name: Checkout
16-
uses: actions/checkout@v2
17+
name: 📥 Checkout
18+
uses: actions/checkout@v4
1719
-
18-
name: Set up QEMU
19-
uses: docker/setup-qemu-action@v1
20+
name: 🖥️ Set up QEMU
21+
uses: docker/setup-qemu-action@v3
2022
-
21-
name: Docker meta tag
22-
id: docker_meta
23-
uses: docker/metadata-action@v3.5.0
23+
name: 🏷️ Docker meta tag
24+
id: meta
25+
uses: docker/metadata-action@v5
2426
with:
25-
images: guysoft/custompios
26-
tag-sha: true
27+
images: |
28+
ghcr.io/${{ github.repository_owner }}/custompios
29+
tags: |
30+
type=ref,event=branch
31+
type=ref,event=tag
32+
type=sha
2733
-
28-
name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v1
34+
name: 🛠️ Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
3036
-
31-
name: Login to DockerHub
32-
uses: docker/login-action@v1
37+
name: 🔑 Login to GitHub Container Registry
38+
uses: docker/login-action@v3
3339
with:
34-
username: ${{ secrets.DOCKERHUB_USERNAME }}
35-
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
registry: ghcr.io
41+
username: ${{ github.repository_owner }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
3643
-
37-
name: Build and push
44+
name: 🏗️ Build and push
3845
id: docker_build
39-
uses: docker/build-push-action@v2
46+
uses: docker/build-push-action@v5
4047
with:
4148
context: src
4249
file: src/Dockerfile
4350
platforms: linux/amd64,linux/arm64,linux/arm/v7
4451
push: true
45-
tags: ${{ steps.docker_meta.outputs.tags }}
46-
labels: ${{ steps.docker_meta.outputs.labels }}
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
4754
secrets: |
48-
GIT_AUTH_TOKEN=${{ secrets.MY_GITHUB_TOKEN }}
55+
github_token=${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Run Tests via Makefile
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "devel"
8+
- "docker-github-actions"
9+
- "release/v1"
10+
- "feature/unit-testing"
11+
- "beta"
12+
tags:
13+
- "*"
14+
15+
jobs:
16+
test:
17+
name: Run Makefile Tests
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
# - name: Install dependencies
24+
# run: |
25+
# sudo apt-get update
26+
# sudo apt-get install -y qemu-user-static binfmt-support
27+
28+
- name: Run Makefile
29+
run: make test
30+
31+
- name: Archive test results
32+
if: always()
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: test-results
36+
path: tests/
37+
retention-days: 60

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
src/config.local
22
src/image/*.zip
3+
src/image/*.xz
34
**/key.json

Makefile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Makefile for running shell script tests
2+
3+
# Shell to use
4+
SHELL := /bin/bash
5+
6+
# Find all test files
7+
TEST_DIR := tests
8+
TEST_FILES := $(wildcard $(TEST_DIR)/test_*.sh)
9+
10+
# Colors for output
11+
BLUE := \033[1;34m
12+
GREEN := \033[1;32m
13+
RED := \033[1;31m
14+
NC := \033[0m # No Color
15+
16+
.PHONY: all test clean help
17+
18+
# Default target
19+
all: test
20+
21+
# Help message
22+
help:
23+
@echo "Available targets:"
24+
@echo " make test - Run all tests"
25+
@echo " make clean - Clean up temporary files"
26+
@echo " make help - Show this help message"
27+
28+
# Run all tests
29+
test:
30+
@echo -e "$(BLUE)Running tests...$(NC)"
31+
@echo "═══════════════════════════════════════"
32+
@success=true; \
33+
for test in $(TEST_FILES); do \
34+
echo -e "$(BLUE)Running $$test...$(NC)"; \
35+
if chmod +x $$test && ./$$test; then \
36+
echo -e "$(GREEN)$$test passed$(NC)"; \
37+
else \
38+
echo -e "$(RED)$$test failed$(NC)"; \
39+
success=false; \
40+
fi; \
41+
echo "───────────────────────────────────────"; \
42+
done; \
43+
echo ""; \
44+
if $$success; then \
45+
echo -e "$(GREEN)All tests passed successfully!$(NC)"; \
46+
exit 0; \
47+
else \
48+
echo -e "$(RED)Some tests failed!$(NC)"; \
49+
exit 1; \
50+
fi
51+
52+
# Clean up any temporary files (if needed)
53+
clean:
54+
@echo -e "$(BLUE)Cleaning up...$(NC)"
55+
@find $(TEST_DIR) -type f -name "*.tmp" -delete
56+
@find $(TEST_DIR) -type f -name "*.log" -delete
57+
@echo -e "$(GREEN)Cleanup complete$(NC)"

README.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CustomPiOS
55
.. :scale: 50 %
66
.. :alt: CustomPiOS logo
77
8+
.. class:: center
9+
810
A `Raspberry Pi <http://www.raspberrypi.org/>`_ and other ARM devices distribution builder. CustomPiOS opens an already existing image, modifies it and repackages the image ready to ship.
911

1012
This repository contains the source script to generate a distribution out of an existing `Raspbian <http://www.raspbian.org/>`_ distro image, or Armbian devices.
@@ -50,20 +52,23 @@ Developing
5052
Requirements
5153
~~~~~~~~~~~~
5254

53-
#. `qemu-arm-static <http://packages.debian.org/sid/qemu-user-static>`_
55+
#. `qemu-arm-static <http://packages.debian.org/sid/qemu-user-static>`_ or gentoo qemu with static USE
5456
#. Downloaded `Raspbian <http://www.raspbian.org/>`_ image.
5557
#. root privileges for chroot
5658
#. Bash
59+
#. jq
5760
#. git
5861
#. realpath
62+
#. file
5963
#. sudo (the script itself calls it, running as root without sudo won't work)
6064
#. p7zip-full
6165
#. Python 3.2+
66+
#. GitPython
6267

6368
Known to work building configurations
6469
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6570
1. Using the `CustomPiOS docker image <https://hub.docker.com/r/guysoft/custompios>`_
66-
2. Linux (Ubuntu / Debian etc)
71+
2. Linux (Ubuntu / Debian / Gentoo etc)
6772
3. OS X - `See this thread for information <https://github.com/guysoft/OctoPi/issues/388#issuecomment-316327106>`_
6873

6974

@@ -151,12 +156,27 @@ Usage
151156
#. Run ``src/build`` as root.
152157
#. The final image will be created at the ``src/workspace``
153158

159+
Testing
160+
-------
161+
162+
You can run unit tests to test CustomPiOS if you have changed it by running::
163+
164+
make test
165+
166+
You can add more tests to the ``tests`` folder.
167+
168+
Community
169+
--------
170+
|discord|
171+
172+
.. |discord| image:: https://img.shields.io/discord/1119337877734699018?label=discord&logo=discord&logoColor=white
173+
:target: https://discord.gg/rK72VZVt
154174

155175
List of Distributions using CustomPiOS
156176
--------------------------------------
157177

158178
* `OctoPi <https://octopi.octoprint.org/>`_ - The ready-to-go Raspberry Pi image with OctoPrint
159-
* `FarmPi <https://farmpi.kevenaar.name/>`_ - An Ubuntu ARM 64bit Raspbery Pi image running `OctoFarm <https://octofarm.net/>`_
179+
* `FarmPi <https://farmpi.kevenaar.name/>`_ - An Ubuntu ARM 64bit Raspberry Pi image running `OctoFarm <https://octofarm.net/>`_
160180
* `FullPageOS <https://github.com/guysoft/FullPageOS>`_ - A Raspberry Pi distro to display a full page browser on boot
161181
* `Zynthian <http://zynthian.org/>`_ - Open Synth Platform
162182
* `ElectricSheepPi <https://github.com/guysoft/ElectricSheepPi>`_ - A Raspberry Pi distribution to run Electric Sheep digital art
@@ -167,9 +187,13 @@ List of Distributions using CustomPiOS
167187
* `HotSpotOS <https://github.com/guysoft/HostSpotOS>`_ - Makes a Raspberry Pi start a hotspot, if no wifi was found to connect to
168188
* `MtigOS <https://github.com/guysoft/MtigOS>`_ - Distro that lets you receive, store and graph sensor information from ESP8266 chips. It uses and MTIG stack: Mosquitto, Telegraf, InfluxDB and Grafana which are all pre-configured to work together. They automatically update using Docker.
169189
* `Tilti-Pi <https://github.com/myoung34/tilty-pi>`_ - Distro that lets you submit BLE data for the `tilt hydrometer <https://tilthydrometer.com/>`_ via the `tilty <https://github.com/myoung34/tilty>`_ package and a built in `dashboard <https://github.com/myoung34/tilty-dashboard>`_
170-
* `MainsailOS <https://github.com/raymondh2/MainsailOS>`_ - Distro that packages the `Mainsail <https://github.com/meteyou/mainsail>`_ web UI, the `Moonraker <https://github.com/Arksine/moonraker>`_ API, and the `Klipper <https://github.com/KevinOConnor/klipper>`_ 3D printer firmware in an easy to package.
190+
* `MainsailOS <https://github.com/mainsail-crew/mainsailos>`_ - Distro that packages the `Mainsail <https://github.com/mainsail-crew/mainsail>`_ web UI, the `Moonraker <https://github.com/Arksine/moonraker>`_ API, and the `Klipper <https://github.com/klipper3d/klipper>`_ 3D printer firmware in an easy to package.
171191
* `UbuntuDockerPi <https://github.com/guysoft/UbuntuDockerPi>`_ - Distro ships with Ubuntu ARM 64bit Docker and docker-compose ready to build stuff for arm64v8/aarch64 or host whatever you like.
172192
* `FluiddPi <https://github.com/cadriel/fluiddpi>`_ - Distro that packages `Fluidd <https://github.com/cadriel/fluidd>`_, `Moonraker <https://github.com/Arksine/moonraker>`_, and `Klipper <https://github.com/KevinOConnor/klipper>`_ into the ultimate 3D printer firmware package.
173193
* `My Naturewatch Camera <https://github.com/interactionresearchstudio/NaturewatchCameraServer>`_ - A Python / OpenCV camera server to stream Pi camera content to a remote client through a website.
194+
* `PiFireOS <https://github.com/calonmerc/PiFireOS>`_ - Distro for pellet grill/smoker control, running `PiFire <https://nebhead.github.io/PiFire>`_.
195+
* `MonsterPi <https://docs.fdm-monster.net/guides/monsterpi>`_ - An Ubuntu ARM 64bit Raspberry Pi image running `FDM Monster <https://fdm-monster.net/>`_. This 3D Print server will help you connect 200+ OctoPrints together while providing a strong, professional workflow.
196+
* `AllStarLink <https://allstarlink.org>`_ - AllStarLink is a network of Amateur Radio repeaters, remote base stations and hot spots accessible to each other via Voice over Internet Protocol. The ASL3 Pi Appliance uses CustomPiOS
197+
* `LEDPotato <https://github.com/guysoft/LEDPotato>`_ - A Le Potato AML-S905X-CC distrubtion that controls ws2812 LEDs over uart right on boot
174198

175199
Code contribution would be appreciated!

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[tool.poetry]
2+
name = "custompios"
3+
version = "2.0.0"
4+
description = "A Raspberry Pi and other ARM devices distribution builder. CustomPiOS opens an already existing image, modifies it and repackages the image ready to ship."
5+
authors = ["Guy Sheffer <guysoft@gmail.com>"]
6+
license = "GPLv3"
7+
readme = "README.rst"
8+
packages = [
9+
# { include = "src/*" },
10+
{ include = "custompios_core", from = "src" }
11+
]
12+
13+
[tool.poetry.dependencies]
14+
python = "^3.11"
15+
GitPython = "^3.1.41"
16+
17+
[tool.poetry.group.dev.dependencies]
18+
types-PyYAML = "^6.0.12.12"
19+
20+
[tool.poetry.scripts]
21+
custompios_build = 'custompios_core.multi_build:main'
22+
23+
[build-system]
24+
requires = ["poetry-core"]
25+
build-backend = "poetry.core.masonry.api"

src/Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
1-
FROM debian:buster
1+
FROM debian:bookworm-backports
22

33
MAINTAINER Guy Sheffer <guysoft at gmail dot com>
44

5-
RUN set -x \
6-
&& apt-get update && apt-get install -y \
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
sudo \
79
build-essential \
10+
sudo \
811
curl \
912
git \
1013
wget \
1114
p7zip-full \
1215
python3 \
16+
python3-distutils \
17+
python3-dev \
18+
python3-git \
19+
python3-yaml \
1320
binfmt-support \
14-
qemu \
21+
qemu-system \
22+
qemu-user \
1523
qemu-user-static \
1624
sudo \
25+
file \
26+
fdisk \
27+
btrfs-progs \
28+
jq \
1729
zip \
30+
xz-utils \
1831
lsof \
19-
&& rm -rf /var/lib/apt/lists/*
32+
f2fs-tools \
33+
&& rm -rf /var/lib/apt/lists/* \
34+
&& apt -qyy clean
2035

2136
RUN ln -s /CustomPiOS/nightly_build_scripts/custompios_nightly_build /usr/bin/build
2237
RUN ln -s /usr/bin/python3 /usr/bin/python
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set +x
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
source "$DIR/argparse.bash" || exit 1
6+
argparse "$@" <<EOF || exit 1
7+
8+
parser.add_argument('WORKSPACE_SUFFIX', nargs='?', default="default", help="The workspace folder suffix used folder")
9+
parser.add_argument('-s', '--sha256', action='store_true', help='Create a sha256 hash for the .img file in .sha256')
10+
EOF
11+
12+
if [ -z "${CUSTOM_PI_OS_PATH}" ];then
13+
echo "Error: you must have \${CUSTOM_PI_OS_PATH} set"
14+
exit 1
15+
fi
16+
17+
# source "${DIST_PATH}/config"
18+
source "${CUSTOM_PI_OS_PATH}/config" "${WORKSPACE_SUFFIX}"
19+
20+
python3 ${CUSTOM_PI_OS_PATH}/custompios_core/base_image_downloader.py "${WORKSPACE_SUFFIX}"
21+

src/build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ define(){ IFS='\n' read -r -d '' ${1} || true; }
1010

1111
define SCRIPT <<'EOF'
1212
BUILD_SCRIPT_PATH=$(dirname $(realpath -s $BASH_SOURCE))
13+
export EXTRA_BOARD_CONFIG=$(mktemp)
14+
${BUILD_SCRIPT_PATH}/custompios_core/generate_board_config.py "${EXTRA_BOARD_CONFIG}"
15+
echo "Temp source file: ${EXTRA_BOARD_CONFIG}"
16+
1317
source ${BUILD_SCRIPT_PATH}/common.sh
1418
install_cleanup_trap
1519
1620
CUSTOM_OS_PATH=$(dirname $(realpath -s $0))
1721
18-
source ${CUSTOM_PI_OS_PATH}/config ${@}
22+
source ${CUSTOM_PI_OS_PATH}/config "${1}" "${EXTRA_BOARD_CONFIG}" ${@}
1923
${CUSTOM_PI_OS_PATH}/config_sanity
2024
21-
[ "$CONFIG_ONLY" == "yes" ] || source ${CUSTOM_OS_PATH}/custompios
25+
[ "$CONFIG_ONLY" == "yes" ] || source ${CUSTOM_OS_PATH}/custompios ${@}
2226
EOF
2327

2428
if [ "$LOG" != "no" ]; then

0 commit comments

Comments
 (0)