Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,37 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build DEB package
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up build environment
run: |
sudo apt-get -y update
sudo apt-get install -y --no-install-recommends \
build-essential \
debhelper \
devscripts \
dpkg-dev \
dh-python

- name: Build package
run: |
chmod -R 775 rockpi-penta/DEBIAN/
dpkg-deb --build -Z gzip rockpi-penta
- name: Upload DEB package
OUTPUT_DIR=_out dpkg-buildpackage -us -uc \
--buildinfo-option="-u_out" \
--buildinfo-option="-O" \
--changes-option="-u_out" \
--changes-option="-O_out/rockpi-penta.changes"

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: rockpi-penta.deb
path: rockpi-penta.deb
name: rockpi-penta-artifacts
path: _out/*

- name: Release
uses: crazy-max/ghaction-github-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: _out/rockpi-penta.changes
draft: true
files: _out/*
143 changes: 18 additions & 125 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,125 +1,18 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.venv
venv/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# Ignore generated files
*.deb
*.dsc
*.changes
*.build
*.buildinfo
*.tar.gz

# Only care about debian/ directory
!/*/debian

# Ignore files generated during build
debian/files
debian/*.substvars
debian/*.log
debian/*.debhelper
debian/*-stamp
debian/*/
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rockpi-penta (0.3.0-1) UNRELEASED; urgency=medium

* Initial release of the refactored Debian package.

-- Radxa <dev@radxa.com> Thu, 17 Oct 2024 13:44:35 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
17 changes: 17 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: rockpi-penta
Section: utils
Priority: optional
Maintainer: Radxa <dev@radxa.com>
Build-Depends: debhelper (>= 12), python3
Standards-Version: 4.5.0
Homepage: https://wiki.radxa.com/Penta_SATA_HAT
Vcs-Git: https://github.com/radxa/rockpi-penta
Vcs-Browser: https://github.com/radxa/rockpi-penta

Package: rockpi-penta
Architecture: all
Pre-Depends: python3-dev, device-tree-compiler
Depends: python3, ${misc:Depends}, ${python3:Depends}, python3-pip, python3-libgpiod, python3-pillow, procps
Description: Fan controller for Rock Pi with OLED display
A driver written in Python that allows to manage the fan and OLED display of RockPi Penta Hat
on various models of Rock Pi and Raspberry Pi.
16 changes: 16 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: rockpi-penta
Upstream-Contact: Radxa <dev@radxa.com>
Source: https://github.com/radxa/rockpi-penta

Files: *
Copyright: 2024 Radxa <dev@radxa.com>
License: MIT

Files: fonts/DejaVuSansMono-Bold.ttf fonts/DejaVuSansMono.ttf
Copyright: 2003 Bitstream, Inc.
License: Public-Domain

Files: fonts/NotoSansMono-Bold.ttf fonts/NotoSansMono-Regular.ttf
Copyright: 2022 The Noto Project Authors
License: OFL
10 changes: 10 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
src/fan.py usr/share/rockpi-penta/
src/main.py usr/share/rockpi-penta/
src/misc.py usr/share/rockpi-penta/
src/oled.py usr/share/rockpi-penta/
src/requirements.txt usr/share/rockpi-penta/
src/env/ usr/share/rockpi-penta/
src/fonts/ usr/share/rockpi-penta/
src/overlays/ usr/share/rockpi-penta/
src/rockpi-penta.conf etc/rockpi-penta/
src/rockpi-penta.service lib/systemd/system/
108 changes: 108 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/sh
# postinst script for rockpi-penta.
#
# See: dh_installdeb(1).

set -e

PACKAGE_DIR="/usr/share/rockpi-penta"

is_armbian() {
[ -f /boot/armbianEnv.txt ] || [ -f /boot/dietpiEnv.txt ]
}

armbian_require_overlay() {
envFile='/boot/armbianEnv.txt'
[ -f /boot/dietpiEnv.txt ] && envFile='/boot/dietpiEnv.txt'
overlays=$(grep '^overlays=' "$envFile" | cut -d'=' -f2)
for arg in "$@"; do
if echo $overlays | grep -qE "(^|[[:space:]])$arg([[:space:]]|$)"; then
echo "Overlay ${arg} was already added to $envFile, skip..."
else
overlays="${overlays} ${arg}"
echo "Added overlay: $arg"
fi
done
if grep -q "^overlays=" $envFile; then
sed '/^overlays=/c\'"overlays=$overlays" -i $envFile
else
echo "overlays=$overlays" >> $envFile
fi
}

dtbo_enable() {
for arg in "$@"; do
mv /boot/dtbo/${arg}.dtbo{.disabled,} || true
done
}

# Install Python packages from requirements.txt
requirements_path="$PACKAGE_DIR/requirements.txt"
if [ -f $requirements_path ]; then
if [ "$(python3 -c 'import sys; print(f"{sys.version_info.minor >= 11}")')" = "True" ]; then
pip3 install --root-user-action ignore --no-cache-dir -r $requirements_path --break-system-packages
else
pip3 install --root-user-action ignore --no-cache-dir -r $requirements_path
fi
fi

model=$(tr -d '\0' </proc/device-tree/model || true)

case "$model" in
*"Raspberry Pi 5"*)
raspi-config nonint do_i2c 0 >/dev/null || true
ln -sf $PACKAGE_DIR/env/rpi5.env /etc/rockpi-penta/environment
;;

*"Raspberry Pi 4"*)
raspi-config nonint do_i2c 0 >/dev/null || true
ln -sf $PACKAGE_DIR/env/rpi4.env /etc/rockpi-penta/environment
;;

*"ROCK 5"*)
if is_armbian; then
armbian_require_overlay rk3588-i2c8-m2 rk3588-pwm14-m1
ln -sf $PACKAGE_DIR/env/rock_5a_armbian.env /etc/rockpi-penta/environment
else
dtbo_enable rk3588-i2c8-m2 rk3588-pwm14-m1
ln -sf $PACKAGE_DIR/env/rock_5a.env /etc/rockpi-penta/environment
u-boot-update || true
fi
;;

*"ROCK3 Model C"*)
dtbo_enable rk3568-i2c3-m0
ln -sf $PACKAGE_DIR/env/rock_3c.env /etc/rockpi-penta/environment
u-boot-update || true
;;

*"ROCK3 Model A"*)
dtbo_enable rk3568-i2c3-m0 rk3568-pwm15-m0
ln -sf $PACKAGE_DIR/env/rock_pi_3.env /etc/rockpi-penta/environment
u-boot-update || true
;;

*"Radxa ROCK 4SE"* | *"ROCK Pi 4"*)
if is_armbian; then
dtc -o /boot/dtb/rockchip/overlay/rockchip-rk3399-pwm1-by-rockpi-penta.dtbo \
-I dts -O dtb -@ $PACKAGE_DIR/overlays/rk3399-pwm1.dts
armbian_require_overlay rk3399-i2c7 rk3399-pwm1-by-rockpi-penta
ln -sf $PACKAGE_DIR/env/rock_pi_4_armbian.env /etc/rockpi-penta/environment
else
dtbo_enable rk3399-i2c7 rk3399-pwm1
ln -sf $PACKAGE_DIR/env/rock_pi_4.env /etc/rockpi-penta/environment
u-boot-update || true
fi
;;

*)
echo "WARNING! Board ($model) not supported."
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
Loading