Skip to content

Commit

Permalink
Use $() substitution instead of ``
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcanonical committed Dec 16, 2024
1 parent 2b0a499 commit c96cfc5
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions shared/macros/10-bash.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -908,28 +908,22 @@ DEBIAN_FRONTEND=noninteractive pam-auth-update
{{%- macro bash_pam_unix_enable() -%}}
conf_name=cac_unix
conf_path="/usr/share/pam-configs/"
remediate=false

if [ ! -f "$conf_path"/"$conf_name" ]; then
if [ -f "$conf_path"/unix ]; then
if grep -q `md5sum "$conf_path"/unix | cut -d ' ' -f 1` /var/lib/dpkg/info/libpam-runtime.md5sums;then
if grep -q $(md5sum "$conf_path"/unix | cut -d ' ' -f 1) /var/lib/dpkg/info/libpam-runtime.md5sums;then
cp "$conf_path/unix" "$conf_path/"$conf_name""
remediate=true
sed '/Default: yes/a Priority: 257\
Conflicts: unix' "$conf_path"/"$conf_name"
DEBIAN_FRONTEND=noninteractive pam-auth-update
else
echo "Not remediating - checksum of $conf_path/unix does not match the original." >&2
echo "Not applicable - checksum of $conf_path/unix does not match the original." >&2
fi
else
echo "Not remediating - $conf_path/unix does not exist" >&2
echo "Not applicable - $conf_path/unix does not exist" >&2
fi
else
remediate=true
fi

if [ $remediate = "true" ]; then
sed '/Default: yes/a Priority: 257\
Conflicts: unix' "$conf_path"/"$conf_name"
DEBIAN_FRONTEND=noninteractive pam-auth-update
fi
{{%- endmacro -%}}


Expand Down

0 comments on commit c96cfc5

Please sign in to comment.