mirror of
https://github.com/ovh/debian-cis.git
synced 2025-06-21 18:23:42 +02:00
IMP(shellcheck): fix harmless warnings
This commit is contained in:
@ -15,6 +15,7 @@ backup_file() {
|
||||
TARGET="$BACKUPDIR/$TARGET"
|
||||
debug "Backuping $FILE to $TARGET"
|
||||
cp -a $FILE $TARGET
|
||||
# shellcheck disable=2034
|
||||
FNRET=0
|
||||
fi
|
||||
}
|
||||
|
@ -8,16 +8,26 @@ export LANG=C
|
||||
#### Useful Color constants settings for loglevels
|
||||
|
||||
# Reset Color (for syslog)
|
||||
# shellcheck disable=2034
|
||||
NC='\033[0m'
|
||||
# shellcheck disable=2034
|
||||
WHITE='\033[0m'
|
||||
# Colors
|
||||
# shellcheck disable=2034
|
||||
RED='\033[0;31m'
|
||||
# shellcheck disable=2034
|
||||
GREEN='\033[0;32m'
|
||||
# shellcheck disable=2034
|
||||
YELLOW='\033[0;33m'
|
||||
# shellcheck disable=2034
|
||||
GRAY='\033[0;40m' # Gray
|
||||
|
||||
# Bold
|
||||
BRED='\033[1;31m' # Red
|
||||
BGREEN='\033[1;32m' # Green
|
||||
# shellcheck disable=2034
|
||||
BRED='\033[1;31m' # Red
|
||||
# shellcheck disable=2034
|
||||
BGREEN='\033[1;32m' # Green
|
||||
# shellcheck disable=2034
|
||||
BYELLOW='\033[1;33m' # Yellow
|
||||
BWHITE='\033[1;37m' # White
|
||||
# shellcheck disable=2034
|
||||
BWHITE='\033[1;37m' # White
|
||||
|
@ -23,7 +23,7 @@ SUDO_CMD=""
|
||||
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
|
||||
# Arguments parsing
|
||||
while [[ $# > 0 ]]; do
|
||||
while [[ $# -gt 0 ]]; do
|
||||
ARG="$1"
|
||||
case $ARG in
|
||||
--audit-all)
|
||||
|
10
lib/utils.sh
10
lib/utils.sh
@ -76,8 +76,10 @@ has_file_correct_ownership() {
|
||||
local FILE=$1
|
||||
local USER=$2
|
||||
local GROUP=$3
|
||||
local USERID=$(id -u $USER)
|
||||
local GROUPID=$(getent group $GROUP | cut -d: -f3)
|
||||
local USERID
|
||||
local GROUPID
|
||||
USERID=$(id -u $USER)
|
||||
GROUPID=$(getent group $GROUP | cut -d: -f3)
|
||||
debug "$SUDO_CMD stat -c '%u %g' $FILE"
|
||||
if [ "$($SUDO_CMD stat -c "%u %g" $FILE)" = "$USERID $GROUPID" ]; then
|
||||
FNRET=0
|
||||
@ -275,7 +277,8 @@ is_kernel_option_enabled() {
|
||||
# the admin compiled it separately later (or out-of-tree)
|
||||
# as a module (regardless of the fact that we have =m or not)
|
||||
debug "Checking if we have $MODULE_NAME.ko"
|
||||
local modulefile=$($SUDO_CMD find "/lib/modules/$(uname -r)/" -type f -name "$MODULE_NAME.ko")
|
||||
local modulefile
|
||||
modulefile=$($SUDO_CMD find "/lib/modules/$(uname -r)/" -type f -name "$MODULE_NAME.ko")
|
||||
if $SUDO_CMD [ -n "$modulefile" ]; then
|
||||
debug "We do have $modulefile!"
|
||||
# ... but wait, maybe it's blacklisted? check files in /etc/modprobe.d/ for "blacklist xyz"
|
||||
@ -433,6 +436,7 @@ get_debian_major_version() {
|
||||
if [ $FNRET ]; then
|
||||
DEB_MAJ_VER=$(cut -d '.' -f1 /etc/debian_version)
|
||||
else
|
||||
# shellcheck disable=2034
|
||||
DEB_MAJ_VER=$(lsb_release -r | cut -f2 | cut -d '.' -f 1)
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user