Commit 6fa0d687 authored by Ander Punnar's avatar Ander Punnar

__apt_unattended_upgrades: alternative approach

parent f5f70671
......@@ -34,81 +34,41 @@ APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
EOF
conf='# this file is managed by cdist'
if [ -f "$__object/parameter/mail" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::Mail "%s";\n' \
"$conf" \
"$( cat "$__object/parameter/mail" )"
)"
fi
# lets not write into upstream 50unattended-upgrades file,
# but use our own config file to avoid clashes
if [ -f "$__object/parameter/mail-only-on-error" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::MailOnlyOnError "true";\n' \
"$conf"
)"
fi
conf_file='/etc/apt/apt.conf.d/51unattended-upgrades-cdist'
if [ -f "$__object/parameter/no-auto-fix-interrupted-dpkg" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::AutoFixInterruptedDpkg "false";\n' \
"$conf"
)"
fi
conf='# this file is managed by cdist'
if [ -f "$__object/parameter/no-minimal-steps" ]
if [ -f "$__object/parameter/option" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::MinimalSteps "false";\n' \
"$conf"
)"
fi
o=''
if [ -f "$__object/parameter/install-on-shutdown" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::InstallOnShutdown "true";\n' \
"$conf"
)"
fi
while read -r l
do
k="$( echo "$l" | awk -F= '{print $1}' )"
v="$( echo "$l" | awk -F= '{print $2}' )"
o="$( printf '%s\nUnattended-Upgrade::%s "%s";\n' "$o" "$k" "$v" )"
done \
< "$__object/parameter/option"
if [ -f "$__object/parameter/automatic-reboot" ]
then
conf="$(
printf \
'%s\nUnattended-Upgrade::Automatic-Reboot "true";\n' \
"$conf"
)"
conf="$( printf '%s\n%s\n' "$conf" "$o" )"
fi
if [ -f "$__object/parameter/blacklist" ]
then
bl='Unattended-Upgrade::Package-Blacklist {';
b='Unattended-Upgrade::Package-Blacklist {'
while read -r l
do
bl="$( printf '%s\n"%s";\n' "$bl" "$l" )"
b="$( printf '%s\n"%s";\n' "$b" "$l" )"
done \
< "$__object/parameter/blacklist"
conf="$( printf '%s\n%s\n}\n' "$conf" "$bl" )"
conf="$( printf '%s\n%s\n}\n' "$conf" "$b" )"
fi
# lets not write into upstream 50unattended-upgrades file,
# but use our own config file to avoid clashes
conf_file='/etc/apt/apt.conf.d/51unattended-upgrades-cdist'
if [ "$( echo "$conf" | wc -l )" -gt 1 ]
then
echo "$conf" \
......
mail-only-on-error
no-auto-fix-interrupted-dpkg
no-minimal-steps
install-on-shutdown
automatic-reboot
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment