Skip to content

Commit 57db5b3

Browse files
committed
chore: fix coderabbit issues
1 parent 3657886 commit 57db5b3

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ start() {
3131

3232
# Ensure dependencies are installed
3333
if [ -x "$scripts_dir/dependencies.sh" ]; then
34-
"$scripts_dir/dependencies.sh" ensure
34+
"$scripts_dir/dependencies.sh" ensure || {
35+
echo "Failed to install dependencies – aborting start."
36+
return 1
37+
}
3538
else
3639
echo "Warning: dependencies.sh script not found or not executable"
3740
fi

plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/file_patches.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
NGINX_CHANGED=0
66
FILE=/etc/nginx/nginx.conf
77
if grep -q "SAMEORIGIN" "${FILE}" >/dev/null 2>&1; then
8-
cp "$FILE" "$FILE-"
8+
cp -p "$FILE" "$FILE-"
99
OLD="add_header X-Frame-Options 'SAMEORIGIN';"
1010
NEW="add_header Content-Security-Policy \"frame-ancestors 'self' https://connect.myunraid.net/\";"
11-
sed -i "s/${OLD}/${NEW}/" "${FILE}"
11+
sed -i "s|${OLD}|${NEW}|" "${FILE}"
1212
NGINX_CHANGED=1
1313
fi
1414

1515
# Patch robots.txt handling
1616
FILE=/etc/rc.d/rc.nginx
1717
if ! grep -q "#robots.txt any origin" "${FILE}" >/dev/null 2>&1; then
18-
cp "$FILE" "$FILE-"
18+
cp -p "$FILE" "$FILE-"
1919
FIND="location = \/robots.txt {"
2020
# escape tabs and spaces
2121
ADD="\t add_header Access-Control-Allow-Origin *; #robots.txt any origin"
@@ -32,15 +32,15 @@ fi
3232
# Fix update.htm to work in an iframe
3333
FILE=/usr/local/emhttp/update.htm
3434
if [ -f "${FILE}" ] && grep -q "top.document" "${FILE}" >/dev/null 2>&1; then
35-
cp -f "$FILE" "$FILE-"
36-
sed -i 's/top.document/parent.document/gm' "${FILE}"
35+
cp -p "$FILE" "$FILE-"
36+
sed -i 's|top.document|parent.document|gm' "${FILE}"
3737
fi
3838

3939
# Fix logging.htm to work in an iframe
4040
FILE=/usr/local/emhttp/logging.htm
4141
if [ -f "${FILE}" ] && grep -q "top.Shadowbox" "${FILE}" >/dev/null 2>&1; then
42-
cp -f "$FILE" "$FILE-"
43-
sed -i 's/top.Shadowbox/parent.Shadowbox/gm' "${FILE}"
42+
cp -p "$FILE" "$FILE-"
43+
sed -i 's|top.Shadowbox|parent.Shadowbox|gm' "${FILE}"
4444
fi
4545

4646
# Relax restrictions on built-in Firefox
@@ -53,7 +53,7 @@ if [ -z "$PROFILE_DIR" ]; then
5353
else
5454
FILE="$PROFILE_DIR/user.js"
5555
if [ -f "$FILE" ]; then
56-
cp -f "$FILE" "$FILE-"
56+
cp -p "$FILE" "$FILE-"
5757
# Append settings if they don't exist
5858
grep -q "privacy.firstparty.isolate" "$FILE" || echo 'user_pref("privacy.firstparty.isolate", false);' >> "$FILE"
5959
grep -q "javascript.options.asmjs" "$FILE" || echo 'user_pref("javascript.options.asmjs", true);' >> "$FILE"

plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/setup_api.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ fi
7272
# Restore dependencies using vendor archive from package
7373
if [ -x "/etc/rc.d/rc.unraid-api" ]; then
7474
echo "Restoring dependencies using auto-detection"
75-
/etc/rc.d/rc.unraid-api ensure
75+
if /etc/rc.d/rc.unraid-api ensure; then
76+
echo "Dependencies restored successfully"
77+
else
78+
echo "ERROR: Failed to restore dependencies" >&2
79+
exit 1
80+
fi
7681
else
7782
echo "Dependencies not restored: rc.unraid-api executable not found"
7883
fi

0 commit comments

Comments
 (0)