Compare commits

...

2 Commits

Author SHA1 Message Date
Kroese
8e2490e6bc
feat: Improve Github Codespaces configuration (#1082) 2025-10-19 10:40:03 +02:00
Kroese
399243886e
feat: Show directory size (#1083) 2025-10-19 09:40:45 +02:00
3 changed files with 23 additions and 20 deletions

View File

@ -1,9 +1,8 @@
services:
dsm:
container_name: dsm
image: vdsm/virtual-dsm
image: ghcr.io/vdsm/virtual-dsm
environment:
ALLOCATE: "Y"
RAM_SIZE: "half"
DISK_SIZE: "max"
CPU_CORES: "max"

View File

@ -1,19 +1,16 @@
{
"name": "Virtual DSM",
"service": "dsm",
"containerEnv": {
"ALLOCATE": "Y"
},
"forwardPorts": [5000],
"service": "vdsm",
"portsAttributes": {
"5000": {
"label": "Web",
"onAutoForward": "openBrowser"
"onAutoForward": "notify"
}
},
"otherPortsAttributes": {
"onAutoForward": "ignore"
},
"dockerComposeFile": "codespaces.yml",
"workspaceFolder": "/workspaces/vdsm",
"initializeCommand": "docker system prune --all --force"
}

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -Eeuo pipefail
info="/run/shm/msg.html"
escape () {
local s
s=${1//&/\&}
@ -14,16 +16,20 @@ escape () {
file="$1"
total="$2"
body=$(escape "$3")
info="/run/shm/msg.html"
if [[ "$body" == *"..." ]]; then
body="<p class=\"loading\">${body/.../}</p>"
body="<p class=\"loading\">${body::-3}</p>"
fi
while true
do
if [ -s "$file" ]; then
if [ ! -s "$file" ] && [ ! -d "$file" ]; then
bytes="0"
else
bytes=$(du -sb "$file" | cut -f1)
fi
if (( bytes > 1000 )); then
if [ -z "$total" ] || [[ "$total" == "0" ]] || [ "$bytes" -gt "$total" ]; then
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
@ -33,6 +39,7 @@ do
fi
echo "${body//(\[P\])/($size)}"> "$info"
fi
fi
sleep 1 & wait $!
done