Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11722092
D3680.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D3680.diff
View Options
diff --git a/.arclint b/.arclint
--- a/.arclint
+++ b/.arclint
@@ -5,9 +5,6 @@
},
"shell": {
"type": "shellcheck",
- "shellcheck.exclude": [
- "SC3028"
- ],
"include": [
"(\\.sh$)"
]
diff --git a/roles/core/certificates/files/delete-certbot-certificate.sh b/roles/core/certificates/files/delete-certbot-certificate.sh
--- a/roles/core/certificates/files/delete-certbot-certificate.sh
+++ b/roles/core/certificates/files/delete-certbot-certificate.sh
@@ -15,6 +15,7 @@
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# shellcheck disable=SC3028
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
diff --git a/roles/core/network/files/Linux/routes.sh b/roles/core/network/files/Linux/routes.sh
--- a/roles/core/network/files/Linux/routes.sh
+++ b/roles/core/network/files/Linux/routes.sh
@@ -19,10 +19,15 @@
ROUTES_CONFIG_PATH=/etc/routes.conf
-# Runs as root only
-test -z $UID && UID=$(id -u)
-if [ "$UID" -ne 0 ]; then
- echo This script must be run as root. >&2
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# shellcheck disable=SC3028
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
+ echo "This command must be run as root." >&2
exit 1
fi
diff --git a/roles/dbserver-mysql/treasure-chest/files/db-treasure-import.sh b/roles/dbserver-mysql/treasure-chest/files/db-treasure-import.sh
--- a/roles/dbserver-mysql/treasure-chest/files/db-treasure-import.sh
+++ b/roles/dbserver-mysql/treasure-chest/files/db-treasure-import.sh
@@ -26,7 +26,8 @@
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-if [ "$(id -u)" -ne 0 ]; then
+# shellcheck disable=SC3028
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
fi
diff --git a/roles/salt-primary/software/files/autochmod-git.sh b/roles/salt-primary/software/files/autochmod-git.sh
--- a/roles/salt-primary/software/files/autochmod-git.sh
+++ b/roles/salt-primary/software/files/autochmod-git.sh
@@ -24,7 +24,8 @@
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-if [ "$(id -u)" -ne 0 ]; then
+# shellcheck disable=SC3028
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
fi
diff --git a/roles/webserver-alkane/php/files/restart-php-fpm.sh b/roles/webserver-alkane/php/files/restart-php-fpm.sh
--- a/roles/webserver-alkane/php/files/restart-php-fpm.sh
+++ b/roles/webserver-alkane/php/files/restart-php-fpm.sh
@@ -17,6 +17,7 @@
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# shellcheck disable=SC3028
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
diff --git a/utils/bootstrap/hello-FreeBSD.sh b/utils/bootstrap/hello-FreeBSD.sh
--- a/utils/bootstrap/hello-FreeBSD.sh
+++ b/utils/bootstrap/hello-FreeBSD.sh
@@ -8,7 +8,14 @@
# License: BSD-2-Clause
# -------------------------------------------------------------
-if [ "$(id -u)" -ne 0 ]; then
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# shellcheck disable=SC3028
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "This command must be run as root." >&2
exit 1
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 17, 00:36 (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2989665
Default Alt Text
D3680.diff (3 KB)
Attached To
Mode
D3680: Address SC3028 at instruction level
Attached
Detach File
Event Timeline
Log In to Comment