mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-06 01:54:52 +08:00
Compare commits
2 Commits
b0dbfcb805
...
8e2490e6bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e2490e6bc | ||
|
|
399243886e |
@ -1,9 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
dsm:
|
dsm:
|
||||||
container_name: dsm
|
container_name: dsm
|
||||||
image: vdsm/virtual-dsm
|
image: ghcr.io/vdsm/virtual-dsm
|
||||||
environment:
|
environment:
|
||||||
ALLOCATE: "Y"
|
|
||||||
RAM_SIZE: "half"
|
RAM_SIZE: "half"
|
||||||
DISK_SIZE: "max"
|
DISK_SIZE: "max"
|
||||||
CPU_CORES: "max"
|
CPU_CORES: "max"
|
||||||
|
|||||||
@ -1,19 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "Virtual DSM",
|
"name": "Virtual DSM",
|
||||||
"service": "dsm",
|
"service": "vdsm",
|
||||||
"containerEnv": {
|
|
||||||
"ALLOCATE": "Y"
|
|
||||||
},
|
|
||||||
"forwardPorts": [5000],
|
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"5000": {
|
"5000": {
|
||||||
"label": "Web",
|
"label": "Web",
|
||||||
"onAutoForward": "openBrowser"
|
"onAutoForward": "notify"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"otherPortsAttributes": {
|
"otherPortsAttributes": {
|
||||||
"onAutoForward": "ignore"
|
"onAutoForward": "ignore"
|
||||||
},
|
},
|
||||||
"dockerComposeFile": "codespaces.yml",
|
"dockerComposeFile": "codespaces.yml",
|
||||||
|
"workspaceFolder": "/workspaces/vdsm",
|
||||||
"initializeCommand": "docker system prune --all --force"
|
"initializeCommand": "docker system prune --all --force"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
info="/run/shm/msg.html"
|
||||||
|
|
||||||
escape () {
|
escape () {
|
||||||
local s
|
local s
|
||||||
s=${1//&/\&}
|
s=${1//&/\&}
|
||||||
@ -14,25 +16,30 @@ escape () {
|
|||||||
file="$1"
|
file="$1"
|
||||||
total="$2"
|
total="$2"
|
||||||
body=$(escape "$3")
|
body=$(escape "$3")
|
||||||
info="/run/shm/msg.html"
|
|
||||||
|
|
||||||
if [[ "$body" == *"..." ]]; then
|
if [[ "$body" == *"..." ]]; then
|
||||||
body="<p class=\"loading\">${body/.../}</p>"
|
body="<p class=\"loading\">${body::-3}</p>"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
if [ -s "$file" ]; then
|
|
||||||
|
if [ ! -s "$file" ] && [ ! -d "$file" ]; then
|
||||||
|
bytes="0"
|
||||||
|
else
|
||||||
bytes=$(du -sb "$file" | cut -f1)
|
bytes=$(du -sb "$file" | cut -f1)
|
||||||
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/')
|
|
||||||
else
|
|
||||||
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
|
|
||||||
size="$size%"
|
|
||||||
fi
|
|
||||||
echo "${body//(\[P\])/($size)}"> "$info"
|
|
||||||
fi
|
|
||||||
fi
|
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/')
|
||||||
|
else
|
||||||
|
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
|
||||||
|
size="$size%"
|
||||||
|
fi
|
||||||
|
echo "${body//(\[P\])/($size)}"> "$info"
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 1 & wait $!
|
sleep 1 & wait $!
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user