avoid odd file

master
Mikhail Novosyolov 3 years ago
parent a209f37401
commit 15dc0cde75

@ -8,7 +8,6 @@ then
else
source /usr/share/linux-infosec-setupper/common.sh
fi
source "${SHARE_DIR_PWQUALITY}/parse_pwquality.sh"
_mk_pwquality_conf() {
local failed=0

@ -102,3 +102,12 @@ _validate_email(){
return 1
fi
}
_pw_parse_conf() {
while read -r line; do
case "$line" in
*=*) echo "${line// /}" ;;
*) echo "${line}=1" ;;
esac
done < "${DESTDIR}/etc/security/pwquality.conf"
}

@ -6,10 +6,8 @@ set -e
if [ -f ./common.sh ] && [ -f "$0" ]
then
source common.sh
source parse_pwquality.sh
else
source /usr/share/linux-infosec-setupper/common.sh
source "${SHARE_DIR_PWQUALITY}/parse_pwquality.sh"
fi
PWQUALITY_FRONT=1

@ -2,6 +2,16 @@
source "${DESTDIR}/usr/share/linux-infosec-setupper/common.sh"
# detect running from git tree
if [ -f ./common.sh ] && [ -f "$0" ]
then
source common.sh
source back_pwquality.sh
else
source /usr/share/linux-infosec-setupper/common.sh
source "${SHARE_DIR_PWQUALITY}/back_pwquality.sh"
fi
# Check whether we are running the script for the first time
# Since the config may be standard from the package, it may not be parsed correctly.
# We write our default config instead of the original one, so that the parsing works correctly
@ -10,9 +20,6 @@ if ! [[ -f "${VAR_DIR_PWQUALITY}/pw_changed" ]]; then
install -D -m 444 /dev/null "${VAR_DIR_PWQUALITY}/pw_changed" || { error $"Unable to write to file %s" "${VAR_DIR_PWQUALITY}/pw_changed"; exit 1; }
fi
source "${SHARE_DIR_PWQUALITY}/parse_pwquality.sh"
source "${SHARE_DIR_PWQUALITY}/back_pwquality.sh"
while read -r line; do declare "$line" || { error $"Unable to parse /etc/security/pwquality.conf correctly; execute \n%s" "rm ${VAR_DIR_PWQUALITY}/pw_changed"; exit 1; }; done < <(_pw_parse_conf)
PWQUALITY_FRONT=1

@ -1,8 +0,0 @@
_pw_parse_conf() {
while read -r line; do
case "$line" in
*=*) echo "${line// /}" ;;
*) echo "${line}=1" ;;
esac
done < "${DESTDIR}/etc/security/pwquality.conf"
}
Loading…
Cancel
Save