Lots of reorganization. Added stormux package repository. Removed unneeded packages. Switched to systemd management of logging to ram. Use existing tools to resize the image to fill the device, no more growpartfs. No packages installed from AUR any more.

This commit is contained in:
Storm Dragon
2025-08-19 15:18:04 -04:00
parent f80ea1e056
commit 8a7fb83be3
8 changed files with 214 additions and 160 deletions

View File

@@ -4,3 +4,4 @@
# <file system> <dir> <type> <options> <dump> <pass>
LABEL=STRMX_BOOT /boot vfat defaults 0 1
LABEL=STRMX_ROOT / ext4 defaults,noatime 0 1
tmpfs /var/log tmpfs defaults,noatime,nosuid,nodev,noexec,mode=0755,size=128M 0 0

View File

@@ -1,37 +0,0 @@
# Configuration file for Log2Ram (https://github.com/azlux/log2ram) under MIT license.
# This configuration file is read by the log2ram service
# Size for the ram folder, it defines the size the log folder will reserve into the RAM.
# If it's not enough, log2ram will not be able to use ram. Check you /var/log size folder.
# The default is 40M and is basically enough for a lot of applications.
# You will need to increase it if you have a server and a lot of log for example.
SIZE=128M
# This variable can be set to true if you prefer "rsync" rather than "cp".
# I use the command cp -u and rsync -X, so I don't copy the all folder every time for optimization.
# You can choose which one you want. Be sure rsync is installed if you use it.
USE_RSYNC=true
# If there are some errors with available RAM space, a system mail will be send
# Change it to false and you will have only a log if there is no place on RAM anymore.
MAIL=false
# Variable for folders to put in RAM. You need to specify the real folder `/path/folder` , the `/path/hdd.folder` will be automatically created. Multiple path can be separeted by `;`. Do not add the final `/` !
# example : PATH_DISK="/var/log;/home/test/FolderInRam"
PATH_DISK="/var/log"
# **************** Zram backing conf *************************************************
# ZL2R Zram Log 2 Ram enables a zram drive when ZL2R=true ZL2R=false is mem only tmpfs
ZL2R=false
# COMP_ALG this is any compression algorithm listed in /proc/crypto
# lz4 is fastest with lightest load but deflate (zlib) and Zstandard (zstd) give far better compression ratios
# lzo is very close to lz4 and may with some binaries have better optimisation
# COMP_ALG=lz4 for speed or Zstd for compression, lzo or zlib if optimisation or availabilty is a problem
COMP_ALG=lz4
# LOG_DISK_SIZE is the uncompressed disk size. Note zram uses about 0.1% of the size of the disk when not in use
# LOG_DISK_SIZE is expected compression ratio of alg chosen multiplied by log SIZE
# lzo/lz4=2.1:1 compression ratio zlib=2.7:1 zstandard=2.9:1
# Really a guestimate of a bit bigger than compression ratio whilst minimising 0.1% mem usage of disk size
LOG_DISK_SIZE=100M

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Setup RAM logging and restore logs from disk
DefaultDependencies=false
After=local-fs.target
Before=sysinit.target
RequiresMountsFor=/var
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/mkdir -p /var/log.hdd
ExecStartPre=/bin/sh -c 'if [ -d /var/log.hdd ] && [ "$(ls -A /var/log.hdd 2>/dev/null)" ]; then cp -au /var/log.hdd/* /var/log/ 2>/dev/null || true; fi'
ExecStart=/bin/true
[Install]
WantedBy=sysinit.target

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Sync logs to disk before shutdown
DefaultDependencies=false
Before=shutdown.target reboot.target halt.target
Conflicts=shutdown.target reboot.target halt.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/sh -c 'rsync -aXv --delete --exclude="*.hdd" /var/log/ /var/log.hdd/ 2>/dev/null || true'
TimeoutStopSec=30
[Install]
WantedBy=shutdown.target reboot.target halt.target

View File

@@ -0,0 +1,8 @@
[Unit]
Description=Sync logs from RAM to disk
After=local-fs.target
[Service]
Type=oneshot
ExecStartPre=/bin/mkdir -p /var/log.hdd
ExecStart=/bin/sh -c 'rsync -aXv --delete --exclude="*.hdd" /var/log/ /var/log.hdd/ 2>/dev/null || true'

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Sync logs from RAM to disk every hour
Requires=log-to-ram-sync.service
[Timer]
OnBootSec=15min
OnUnitActiveSec=1h
Persistent=true
[Install]
WantedBy=timers.target

View File

@@ -24,29 +24,33 @@ if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
exit 0
fi
# make sure the system is at a decent volume
# Wait for pipewire to become available and set volume
echo "Waiting for audio system to initialize..."
volume=50
wait=0
# Wait for pipewire to become available
while [[ $wait -lt 30 ]]; do
if pgrep pipewire &> /dev/null ; then
wait=30 # We don't want to continue the loop
echo "Audio system ready. Setting up volume..."
break
else
sleep 1
continue
((wait++))
fi
done
# Volume calibration - this should be the first interactive part
while [[ $volume -le 130 ]]; do
clear
echo "Volume calibration (current: ${volume}%)"
pactl set-sink-volume @DEFAULT_SINK@ "${volume}%" 2>/dev/null
spd-say "If this is loud enough, press enter."
if read -t4 ; then
echo "Volume set to ${volume}%"
break
else
((volume+=5))
fi
while [[ $volume -le 130 ]]; do
clear
spd-say "If this is loud enough, press enter."
if read -t4 ; then
break
else
((volume+=5))
fi
pactl set-sink-volume @DEFAULT_SINK@ "${volume}%"
done
((wait++))
done
export DIALOGOPTS='--insecure --no-lines --visit-items'
@@ -98,7 +102,16 @@ if [[ $diskSize -le 7 ]]; then
read -r continue
continue="${continue::1}"
if [[ "${continue,}" == "y" ]];then
sudo "${sudoFlags[@]}" growpartfs $diskSource
# Extract base device name (handles mmcblk0p2, nvme0n1p2, sda2, etc.)
if [[ "$diskSource" =~ (.*[0-9]+)p[0-9]+$ ]]; then
# Handle mmcblk0p2, nvme0n1p2 style
diskDevice="${BASH_REMATCH[1]}"
else
# Handle sda2, sdb3 style
diskDevice="$(echo "$diskSource" | sed 's/[0-9]*$//')"
fi
sudo "${sudoFlags[@]}" parted "$diskDevice" resizepart 2 100%
sudo "${sudoFlags[@]}" resize2fs "$diskSource"
fi
fi