Merge branch 'master' into codespaces

This commit is contained in:
Kroese 2025-10-17 13:23:43 +02:00 committed by GitHub
commit a77be56353
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 14 deletions

View File

@ -1,4 +1,5 @@
.dockerignore
.devcontainer
.git
.github
.gitignore

View File

@ -22,3 +22,8 @@ jobs:
dockerfile: Dockerfile
ignore: DL3008,DL3003,DL3006,DL3013
failure-threshold: warning
-
name: Validate JSON and YML files
uses: GrantBirki/json-yaml-validate@v4
with:
yaml_exclude_regex: ".*\\kubernetes\\.yml$"

View File

@ -18,8 +18,8 @@ cd /run
. proc.sh # Initialize processor
. serial.sh # Initialize serialport
. power.sh # Configure shutdown
. config.sh # Configure arguments
. memory.sh # Check available memory
. config.sh # Configure arguments
. finish.sh # Finish initialization
trap - ERR

View File

@ -2,7 +2,7 @@
set -Eeuo pipefail
RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}')
if [[ "$RAM_CHECK" != [Nn]* && "${RAM_SIZE,,}" != "max" && "${RAM_SIZE,,}" != "half" ]]; then
AVAIL_MEM=$(formatBytes "$RAM_AVAIL")
@ -59,15 +59,15 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
RAM_WANTED=$(( RAM_WANTED / 1073741825 ))
if (( "$RAM_WANTED" < 1 )); then
RAM_WANTED=$(( RAM_AVAIL - RAM_SPARE ))
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
if (( "$RAM_WANTED" < 1 )); then
RAM_WANTED=$(( RAM_AVAIL ))
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
fi
RAM_SIZE="${RAM_WANTED}M"
@ -80,7 +80,7 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
else
RAM_SIZE="${RAM_WANTED}G"
fi
fi
return 0

View File

@ -271,6 +271,7 @@ getSlirp() {
configureSlirp() {
NETWORK="slirp"
[[ "$DEBUG" == [Yy1]* ]] && echo "Configuring slirp networking..."
local ip="$IP"
@ -302,6 +303,7 @@ configureSlirp() {
configurePasst() {
NETWORK="passt"
[[ "$DEBUG" == [Yy1]* ]] && echo "Configuring user-mode networking..."
local log="/var/log/passt.log"
@ -785,7 +787,7 @@ else
fi
case "${NETWORK,,}" in
"user"* | "passt" | "slirp" ) ;;
"passt" | "slirp" | "user"* ) ;;
"tap" | "tun" | "tuntap" | "y" )
# Configure tap interface
@ -800,11 +802,9 @@ else
esac
[[ "${NETWORK,,}" == "user"* ]] && NETWORK="passt"
case "${NETWORK,,}" in
"tap" | "tun" | "tuntap" | "y" ) ;;
"passt" )
"passt" | "user"* )
# Configure for user-mode networking (passt)
if ! configurePasst; then

View File

@ -1,16 +1,31 @@
#!/usr/bin/env bash
set -Eeuo pipefail
lastmsg=""
path="/run/shm/msg.html"
if [ -f "$path" ] && [ -s "$path" ]; then
echo -n "s: " && cat "$path"
fi
refresh() {
[ ! -f "$path" ] && return 0
[ ! -s "$path" ] && return 0
msg=$(< "$path")
msg="${msg%$'\n'}"
[ -z "$msg" ] && return 0
[[ "$msg" == "$lastmsg" ]] && return 0
lastmsg="$msg"
echo "s: $msg"
return 0
}
refresh
inotifywait -m "$path" |
while read -r fp event fn; do
case "${event,,}" in
"modify"* ) echo -n "s: " && cat "$path" ;;
"modify"* ) refresh ;;
"delete_self" ) echo "c: vnc" ;;
esac
done