Add Unraid automation script templates
This commit is contained in:
@@ -24,26 +24,35 @@ add_result() {
|
||||
parse_compose() {
|
||||
local compose="$1"
|
||||
awk '
|
||||
function clean(value) {
|
||||
gsub(/\r/, "", value)
|
||||
gsub(/["'\''"]/, "", value)
|
||||
return value
|
||||
}
|
||||
function emit() {
|
||||
if (service && image) {
|
||||
print clean(container) "\t" clean(image)
|
||||
}
|
||||
}
|
||||
/^ [A-Za-z0-9_.-]+:/ {
|
||||
emit()
|
||||
service=$1
|
||||
sub(/:$/, "", service)
|
||||
image=""
|
||||
container=service
|
||||
next
|
||||
}
|
||||
service && /^ image:/ {
|
||||
image=$2
|
||||
gsub(/["'\'']/, "", image)
|
||||
image=$0
|
||||
sub(/^[[:space:]]*image:[[:space:]]*/, "", image)
|
||||
next
|
||||
}
|
||||
service && /^ container_name:/ {
|
||||
container=$2
|
||||
gsub(/["'\'']/, "", container)
|
||||
}
|
||||
service && image && container {
|
||||
print container "\t" image
|
||||
service=""
|
||||
image=""
|
||||
container=""
|
||||
container=$0
|
||||
sub(/^[[:space:]]*container_name:[[:space:]]*/, "", container)
|
||||
next
|
||||
}
|
||||
END { emit() }
|
||||
' "$compose"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user