fix: Remove cat (#561)

This commit is contained in:
Kroese
2024-01-14 00:00:59 +01:00
committed by GitHub
parent fcd7b8a825
commit 6422aec780
6 changed files with 10 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ address="/run/shm/qemu.ip"
[ ! -f "$file" ] && echo "DSM has not enabled networking yet.." && exit 1
location=$(cat "$file")
location=$(<"$file")
if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then
@@ -19,7 +19,7 @@ if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then
echo "Failed to reach DSM at port $port"
else
echo "Failed to reach DSM at http://$location"
ip="$(cat "$address")"
ip=$(<"$address")
fi
echo "You might need to whitelist IP $ip in the DSM firewall." && exit 1

View File

@@ -4,7 +4,7 @@ set -Eeuo pipefail
: ${URL:=''} # URL of the PAT file to be downloaded.
if [ -f "$STORAGE/dsm.ver" ]; then
BASE=$(cat "$STORAGE/dsm.ver")
BASE=$(<"$STORAGE/dsm.ver")
else
# Fallback for old installs
BASE="DSM_VirtualDSM_42962"

View File

@@ -36,7 +36,7 @@ finish() {
if [ -f "$QEMU_PID" ]; then
pid="$(cat "$QEMU_PID")"
pid=$(<"$QEMU_PID")
echo && error "Forcefully terminating QEMU process, reason: $reason..."
{ kill -15 "$pid" || true; } 2>/dev/null
@@ -65,7 +65,7 @@ terminal() {
if [ -f "$QEMU_OUT" ]; then
local msg
msg="$(cat "$QEMU_OUT")"
msg=$(<"$QEMU_OUT")
if [ -n "$msg" ]; then
@@ -117,7 +117,7 @@ _graceful_shutdown() {
finish "$code" && return "$code"
fi
pid="$(cat "$QEMU_PID")"
pid=$(<"$QEMU_PID")
if ! isAlive "$pid"; then
echo && error "QEMU process does not exist?"

View File

@@ -61,7 +61,7 @@ done
[ -f "$shutdown" ] && exit 1
location=$(cat "$file")
location=$(<"$file")
if [[ "$location" != "20.20"* ]]; then
@@ -69,7 +69,7 @@ if [[ "$location" != "20.20"* ]]; then
else
ip="$(cat "$address")"
ip=$(<"$address")
port="${location##*:}"
if [[ "$ip" == "172."* ]]; then

View File

@@ -53,7 +53,7 @@ else
HTML=$(html "xxx")
{ echo "#!/bin/bash"
echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$(cat \"/run/shm/dsm.url\")"
echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$(</run/shm/dsm.url)"
echo "HTML=\"$HTML\"; [ -z \"\$LOCATION\" ] && BODY=\"$WAIT\" || BODY=\"$BODY\"; HTML=\${HTML/xxx/\$BODY}"
echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\""
} > "$TMP_FILE"