Initialize Git Repository: 'Pironman5'
All checks were successful
Pironman 5 Daemon (Bookworm) / Pironman 5 Daemon [arm64] (push) Successful in 11s
Pironman 5 Daemon (Trixie) / Pironman 5 Daemon [arm64] (push) Successful in 11s

This commit is contained in:
Cantibra
2026-01-26 06:10:22 +01:00
commit 80210e740a
19 changed files with 1117 additions and 0 deletions

1
root/DEBIAN/conffiles Normal file
View File

@@ -0,0 +1 @@
/etc/pironman5.cfg

10
root/DEBIAN/control Normal file
View File

@@ -0,0 +1,10 @@
Package: pironman5
Version: 1.0.0
Architecture:
Installed-Size:
Depends: git, python3-pyudev, python3-venv, python3-dev
Priority: optional
Section: misc
Homepage: http://www.privlab.it
Maintainer: PrivLab <repository@privlab.it>
Description: Sunfounder Pironman 5 Case

58
root/DEBIAN/postinst Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/sh
set -e
set -u
GIT='https://github.com/sunfounder'
GIT_PIRONMAN5="${GIT}/pironman5.git"
GIT_PM_AUTO="${GIT}/pm_auto.git"
GIT_SF_RPI_STATUS="${GIT}/sf_rpi_status.git"
if [ -d '/run/systemd/system' ]; then
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
/usr/bin/true
fi
case "${1}" in
configure)
if [ -x '/usr/bin/deb-systemd-helper' ]; then
/usr/bin/deb-systemd-helper unmask 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper unmask 'pironman5-err.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
if /usr/bin/deb-systemd-helper --quiet was-enabled 'pironman5.service'; then
/usr/bin/deb-systemd-helper enable 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
else
/usr/bin/deb-systemd-helper update-state 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
if [ -x '/etc/init.d/pironman5' ]; then
/usr/sbin/update-rc.d 'pironman5' defaults > '/dev/null' 2>&1 || \
/usr/bin/true
fi
/usr/bin/install --directory '/var/log/pironman5'
/usr/bin/install --directory '/var/logrotate/pironman5'
/usr/bin/python3 -m 'venv' --system-site-packages "/opt/pironman5/venv"
/usr/bin/git -c "advice.detachedHead=false" clone --quiet "${GIT_PIRONMAN5}" '/opt/pironman5/pironman5'
# /usr/bin/git clone --quiet "${GIT_PM_AUTO}" '/opt/pironman5/pm_auto'
/usr/bin/git -c "advice.detachedHead=false" clone --branch '1.2.5' --quiet "${GIT_PM_AUTO}" '/opt/pironman5/pm_auto'
/usr/bin/git -c "advice.detachedHead=false" clone --quiet "${GIT_SF_RPI_STATUS}" '/opt/pironman5/sf_rpi_status'
/opt/pironman5/venv/bin/pip3 --require-virtualenv --quiet --no-cache-dir install '/opt/pironman5/pironman5' > '/dev/null' 2>&1
/opt/pironman5/venv/bin/pip3 --require-virtualenv --quiet --no-cache-dir install '/opt/pironman5/pm_auto' > '/dev/null' 2>&1
/opt/pironman5/venv/bin/pip3 --require-virtualenv --quiet --no-cache-dir install '/opt/pironman5/sf_rpi_status' > '/dev/null' 2>&1
/usr/bin/ln --force --symbolic '/dev/null' '/opt/pironman5/1'
if [ -x '/usr/bin/deb-systemd-invoke' ]; then
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
/usr/bin/true
if [ -n "${2}" ]; then
_dh_action='restart'
else
_dh_action='start'
fi
/usr/bin/deb-systemd-invoke "${_dh_action}" 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
;;
esac

44
root/DEBIAN/postrm Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/sh
set -e
set -u
if [ -d '/run/systemd/system' ]; then
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
/usr/bin/true
fi
case "${1}" in
remove)
if [ -x '/usr/bin/deb-systemd-helper' ]; then
/usr/bin/deb-systemd-helper mask 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper mask 'pironman5-led.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
;;
purge)
if [ -x '/usr/bin/deb-systemd-helper' ]; then
/usr/bin/deb-systemd-helper purge 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper unmask 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper purge 'pironman5-err.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-helper unmask 'pironman5-err.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
/usr/bin/rm --force --recursive '/opt/pironman5'
/usr/bin/sed --in-place --expression='/^\s*$/N; /## sunfounder-pironman5/,/dtoverlay=sunfounder-pironman5,ir=off/d' '/boot/config.txt'
/usr/bin/echo ''
/usr/bin/echo '################################################'
/usr/bin/echo '# #'
/usr/bin/echo '# ! Restart the device to unload the drivers ! #'
/usr/bin/echo '# #'
/usr/bin/echo '################################################'
/usr/bin/echo ''
;;
esac
/usr/bin/rm --force --recursive '/var/log/gitea'
/usr/bin/rm --force --recursive '/var/logrotate/gitea'

42
root/DEBIAN/preinst Normal file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/sh
set -e
set -u
TMP=$(/usr/bin/mktemp --directory --quiet)
trap "/usr/bin/rm --force --recursive ${TMP}" EXIT
BOOT=$(/usr/bin/grep '/boot' '/etc/fstab' | /usr/bin/mawk '$1 !~ /^#/ && $2 ~ /^[/]/ {print $2}')
/usr/bin/test -n "${BOOT}"
case "${1}" in
install)
/usr/bin/install --directory '/opt/pironman5'
if ! /usr/bin/grep --quiet 'sunfounder-pironman5' "${BOOT}/config.txt"; then
/usr/bin/echo '' >> "${BOOT}/config.txt"
/usr/bin/echo '## sunfounder-pironman5' >> "${BOOT}/config.txt"
/usr/bin/echo '## Enable the SunFounder Pironman 5 driver.' >> "${BOOT}/config.txt"
/usr/bin/echo '##' >> "${BOOT}/config.txt"
/usr/bin/echo 'dtoverlay=sunfounder-pironman5,ir=off' >> "${BOOT}/config.txt"
fi
/usr/bin/echo 'BOOT_UART=1' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'BOOT_ORDER=0xf41' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'POWER_OFF_ON_HALT=1' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'WAIT_FOR_POWER_BUTTON=1 ' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'BOOT_WATCHDOG_TIMEOUT=15 ' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'MAX_RESTARTS=1 ' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo 'DISABLE_HDMI=1' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/echo '' >> "${TMP}/raspberrypi-eeprom.cfg"
/usr/bin/rpi-eeprom-config --apply "${TMP}/raspberrypi-eeprom.cfg" > '/dev/null' 2>&1
/usr/bin/echo ''
/usr/bin/echo '########################################################'
/usr/bin/echo '# #'
/usr/bin/echo '# ! Restart the device to load the necessary drivers ! #'
/usr/bin/echo '# #'
/usr/bin/echo '########################################################'
/usr/bin/echo ''
;;
upgrade)
/usr/bin/rm --force --recursive '/opt/pironman5'
/usr/bin/install --directory '/opt/pironman5'
;;
esac

21
root/DEBIAN/prerm Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/sh
set -e
set -u
case "${1}" in
remove)
if [ -x '/usr/bin/deb-systemd-invoke' ]; then
/usr/bin/deb-systemd-invoke stop 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-invoke stop 'pironman5-err.service' > '/dev/null' 2>&1 || \
/usr/bin/true
/usr/bin/deb-systemd-invoke disable 'pironman5.service' > '/dev/null' 2>&1 || \
/usr/bin/true
fi
if [ -x '/etc/init.d/pironman5' ]; then
/usr/sbin/update-rc.d 'pironman5' remove > '/dev/null' 2>&1 || \
/usr/bin/true
fi
;;
esac

81
root/etc/init.d/pironman5 Normal file
View File

@@ -0,0 +1,81 @@
#!/usr/bin/sh
### BEGIN INIT INFO
# Provides: pironman5
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Sunfounder Pironman5 Daemon
# Description: The Pironman5 project is software specifically designed
# for use with the Raspberry Pi 5. The software includes
# functionalities for controlling and monitoring the
# Raspberry Pi within a specialized case aimed at optimal
# cooling and user-friendliness.
NAME='pironman5'
DESC='Sunfounder Pironman5 Daemon'
USER='root'
GROUP='root'
PIDFOLDER="/run/${NAME}"
PIDFILE="${PIDFOLDER}/${NAME}.pid"
DAEMON='/usr/sbin/pironman5-service'
set -e
. /lib/lsb/init-functions
[ -x "${DAEMON}" ]
case "${1}" in
start)
/usr/bin/install --directory --group="${GROUP}" ---mode='0755' --owner="${USER}" "${PIDFOLDER}"
log_daemon_msg "Starting ${DESC}" "${NAME}"
/usr/sbin/pironman5-service 'normal'
if /usr/sbin/start-stop-daemon --quiet \
--start \
--oknodo \
--make-pidfile \
--pidfile "${PIDFILE}" \
--user "${USER}" \
--group "${GROUP}" \
--exec "${DAEMON}"; then
log_end_msg 0
else
log_end_msg 1
/usr/bin/test -f "${PIDFILE}" && \
/usr/bin/rm --force "${PIDFILE}"
fi
;;
stop)
log_daemon_msg "Stopping ${DESC}" "${NAME}"
if /usr/sbin/start-stop-daemon --quiet \
--stop \
--oknodo \
--retry 30 \
--remove-pidfile \
--pidfile "${PIDFILE}" \
--user "${USER}" \
--group "${GROUP}" \
--exec "${DAEMON}"; then
/usr/bin/test -f "${PIDFILE}" && \
/usr/bin/rm --force "${PIDFILE}"
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
"${0}" stop
"${0}" start
;;
status)
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}" && \
exit 0 || \
exit "${?}"
;;
*)
echo "Usage: /etc/init.d/${NAME} {start|stop|restart|status}" >&2
exit 1
;;
esac

View File

@@ -0,0 +1,75 @@
/var/log/pironman5/*.log {
# Truncate the original log file in place after creating a copy,
# instead of moving the old log file and optionally creating a
# new one. It can be used when some program cannot be told to
# close its logfile and thus might continue writing (appending)
# to the previous log file forever. Note that there is a very
# small time slice between copying the file and truncating it, so
# some logging data might be lost. When this option is used, the
# create option will have no effect, as the old log file stays in
# place.
copytruncate
# Log files are rotated every day.
daily
# Archive old versions of log files adding a daily extension like
# YYYYMMDD instead of simply adding a number. The extension may
# be configured using the dateformat option.
dateext
# Specify the extension for dateext using the notation similar to
# strftime(3) function. Only %Y %m %d and %s specifiers are allowed.
# The default value is -%Y%m%d. Note that also the character
# separating log name from the extension is part of the dateformat
# string. The system clock must be set past Sep 9th 2001 for %s to
# work correctly. Note that the datestamps generated by this format
# must be lexically sortable (i.e., first the year, then the month
# then the day. e.g., 2001/12/01 is ok, but 01/12/2001 is not, since
# 01/11/2002 would sort lower while it is later). This is because when
# using the rotate option, logrotate sorts all rotated filenames to
# find out which logfiles are older and should be removed.
dateformat .%Y-%m-%d
# Use yesterday's instead of today's date to create the dateext
# extension, so that the rotated log file has a date in its name that
# is the same as the timestamps within it.
dateyesterday
# Postpone compression of the previous log file to the next rotation
# cycle. This only has effect when used in combination with compress.
# It can be used when some program cannot be told to close its logfile
# and thus might continue writing to the previous log file for some time.
delaycompress
# If the log file is missing, go on to the next one without issuing an
# error message.
missingok
# Do not copy the original log file and leave it in place.
nocopy
# New log files are not created.
nocreate
# Don't mail old log files to any address.
nomail
# Do not use shred when deleting old log files.
noshred
# Do not rotate the log if it is empty.
notifempty
# Logs are moved into directory for rotation. The directory must be on the
# same physical device as the log file being rotated, and is assumed to be
# relative to the directory holding the log file unless an absolute path
# name is specified. When this option is used all old versions of the log
# end up in directory.
olddir /var/logrotate/pironman5
# Log files are rotated count times before being removed or mailed to the
# address specified in a mail directive. If count is 0, old versions are
# removed rather than rotated.
rotate 7
}

130
root/etc/pironman5.cfg Normal file
View File

@@ -0,0 +1,130 @@
#
# Pironman 5 Configuration
#
#
# --- Daemon
#
# DEBUG_LEVEL
# Debug Level:
# - debug
# - info
# - warning
# - error
# - critical
# Default: 'info'
DEBUG_LEVEL='info'
#
# --- OLED
#
# OLED_ENABLED
# OLED enable
# 'true' / 'false'
# Default: 'true'
OLED_ENABLED='true'
# OLED_ROTATION
# Set to rotate OLED display
# '0' / '180'
# Default: '0'
OLED_ROTATION='0'
# OLED_DISK
# Display which disk on OLED
# 'total' / '(devicepath)'
# Default: 'total'
OLED_DISK='total'
# OLED_NETWORK_INTERFACE
# Display which ip of network interface on OLED
# 'all' / '(interface)'
# Default: 'all'
OLED_NETWORK_INTERFACE='all'
#
# --- RGB
#
# RGB_ENABLED
# RGB enable
# 'true' / 'false'
# Default: 'true'
RGB_ENABLED='true'
# RGB_LED_COUNT
# RGB LED count
# '1' - '4'
# Default: '4'
RGB_LED_COUNT='4'
# RGB_COLOR
# RGB color
# hex format without '#'
# Default: '0a1aff'
RGB_COLOR='0a1aff'
# RGB_BRIGHTNESS
# RGB brightness
# '0' - '100'
# Default: '50'
RGB_BRIGHTNESS='50'
# RGB_SPEED
# RGB speed
# '0' - '100'
# Default: '50'
RGB_SPEED='50'
# RGB_STYLE
# RGB light modes:
# - solid
# - breathing
# - flow
# - flow_reverse
# - rainbow
# - rainbow_reverse
# - hue_cycle
# Default: 'breathing'
RGB_STYLE='breathing'
#
# --- Temperature
#
# TEMP_UNIT
# Temperature unit
# 'C' (Celsius) / 'F' (Fahrenheit)
# Default: 'C'
TEMP_UNIT='C'
#
# --- Temperature
#
# FAN_MODE
# GPIO fan modes:
# - 0: Always On
# - 1: Performance
# - 2: Cool
# - 3: Balanced
# - 4: Quiet
# Default: '0'
FAN_MODE='0'
# FAN_GPIO_PIN
# GPIO fan pin
# Default: '6'
FAN_GPIO_PIN='6'

View File

@@ -0,0 +1,17 @@
[Unit]
Description=Sunfounder Pironman5 Daemon
Conflicts=pironman5.service
[Service]
Type=forking
ExecStartPre=/usr/sbin/pironman5-service error
ExecStart=/usr/sbin/pironman5-service start
ExecStartPost=/usr/bin/sh -c "umask '022'; /usr/bin/pgrep --newest 'pironman5' > '/run/pironman5/pironman5.pid'"
ExecStop=/usr/sbin/pironman5-service stop
ExecStop=/usr/bin/rm --force '/run/pironman5/pironman5.pid'
Restart=on-failure
RestartSec=3
RuntimeDirectory=pironman5
RuntimeDirectoryMode=755
RuntimeDirectoryPreserve=yes
WorkingDirectory=/opt/pironman5

View File

@@ -0,0 +1,20 @@
[Unit]
Description=Sunfounder Pironman5 Daemon
Conflicts=pironman5-err.service
[Service]
Type=forking
ExecStartPre=/usr/sbin/pironman5-service normal
ExecStart=/usr/sbin/pironman5-service start
ExecStartPost=/usr/bin/sh -c "umask '022'; /usr/bin/pgrep --newest 'pironman5' > '/run/pironman5/pironman5.pid'"
ExecStop=/usr/sbin/pironman5-service stop
ExecStop=/usr/bin/rm --force '/run/pironman5/pironman5.pid'
Restart=on-failure
RestartSec=3
RuntimeDirectory=pironman5
RuntimeDirectoryMode=755
RuntimeDirectoryPreserve=yes
WorkingDirectory=/opt/pironman5
[Install]
WantedBy=basic.target

View File

@@ -0,0 +1,86 @@
#!/usr/bin/env bash
###
#
# Options Section
#
###
set -e
set -u
set -o pipefail
###
#
# Variables Section
#
###
source '/etc/pironman5.cfg'
DEBUG_LEVEL="${DEBUG_LEVEL:='info'}"
OLED_ENABLED="${OLED_ENABLED:='true'}"
OLED_ROTATION="${OLED_ROTATION:='0'}"
OLED_DISK="${OLED_DISK:='total'}"
OLED_NETWORK_INTERFACE="${OLED_NETWORK_INTERFACE:='all'}"
RGB_ENABLED="${RGB_ENABLED:='true'}"
RGB_LED_COUNT="${RGB_LED_COUNT:='4'}"
RGB_COLOR="${RGB_COLOR:='0a1aff'}"
RGB_BRIGHTNESS="${RGB_BRIGHTNESS:='50'}"
RGB_SPEED="${RGB_SPEED:='50'}"
RGB_STYLE="${RGB_STYLE:='breathing'}"
TEMP_UNIT="${TEMP_UNIT:='C'}"
FAN_MODE="${FAN_MODE:='0'}"
FAN_GPIO_PIN="${FAN_GPIO_PIN:='6'}"
###
#
# Runtime Environment
#
###
case "${1}" in
start)
/opt/pironman5/venv/bin/pironman5-service start --debug-level "${DEBUG_LEVEL}" 2>1 1> '/dev/null' &
/usr/bin/pgrep --newest 'pironman5' > '/run/pironman5/pironman5.pid'
;;
stop)
/opt/pironman5/venv/bin/pironman5-service stop 2>1 1> '/dev/null'
/usr/bin/sleep '3s'
;;
normal)
/opt/pironman5/venv/bin/pironman5-service --oled-enable "${OLED_ENABLED}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-rotation "${OLED_ROTATION}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-disk "${OLED_DISK}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-network-interface "${OLED_NETWORK_INTERFACE}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-enable "${RGB_ENABLED}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-led-count "${RGB_LED_COUNT}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-color "${RGB_COLOR}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-brightness "${RGB_BRIGHTNESS}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-speed "${RGB_SPEED}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-style "${RGB_STYLE}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --temperature-unit "${TEMP_UNIT}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --gpio-fan-mode "${FAN_MODE}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --gpio-fan-pin "${FAN_GPIO_PIN}" &> '/dev/null'
;;
error)
/opt/pironman5/venv/bin/pironman5-service --oled-enable "${OLED_ENABLED}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-rotation "${OLED_ROTATION}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-disk "${OLED_DISK}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --oled-network-interface "${OLED_NETWORK_INTERFACE}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-enable 'true' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-led-count '4' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-color 'ff0000' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-brightness '100' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-speed '100' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --rgb-style 'breathing' &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --temperature-unit "${TEMP_UNIT}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --gpio-fan-mode "${FAN_MODE}" &> '/dev/null'
/opt/pironman5/venv/bin/pironman5-service --gpio-fan-pin "${FAN_GPIO_PIN}" &> '/dev/null'
;;
*)
/opt/pironman5/venv/bin/pironman5-service "$@"
;;
esac