Commit 895bbbe7 authored by Thom's avatar Thom 🛠

Only install UAU when argument is given and add extra subarguments (#25)

parent f46ea6f3
......@@ -108,17 +108,30 @@ maxretry = 3';
}
protected function installUnattendedUpgrades() {
ISPConfigLog::info('Installing UnattendedUpgrades', true);
$packages = array(
'unattended-upgrades',
'apt-listchanges'
);
$this->installPackages($packages);
// Enable UnattendUpgrades to run every day
$unattendedupgrades = 'APT::Periodic::Update-Package-Lists "1";' . "\n" . 'APT::Periodic::Unattended-Upgrade "1";';
file_put_contents('/etc/apt/apt.conf.d/20auto-upgrades', $unattendedupgrades);
ISPConfigLog::info('Installing UnattendedUpgrades', true);
$packages = array(
'unattended-upgrades',
'apt-listchanges'
);
$this->installPackages($packages);
// Enable UnattendUpgrades to run every day
$unattendedupgrades = 'APT::Periodic::Update-Package-Lists "1";' . "\n" . 'APT::Periodic::Unattended-Upgrade "1";';
file_put_contents('/etc/apt/apt.conf.d/20auto-upgrades', $unattendedupgrades);
// Enable extra options if set in the arguments
$unattendedupgrades_options = ISPConfig::getUnattendedUpgradesOptions();
if (!empty($unattendedupgrades_options)) {
if (in_array("autoclean", $unattendedupgrades_options)) {
$unattendedupgrades = "\n" . 'APT::Periodic::AutocleanInterval "7";' . "\n" . 'Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";' . "\n" . 'Unattended-Upgrade::Remove-Unused-Dependencies "true";';
file_put_contents('/etc/apt/apt.conf.d/20auto-upgrades', $unattendedupgrades, FILE_APPEND | LOCK_EX);
}
if (in_array("reboot", $unattendedupgrades_options)) {
$unattendedupgrades = "\n" . 'Unattended-Upgrade::Automatic-Reboot "true";' . "\n" . 'Unattended-Upgrade::Automatic-Reboot-Time "03:30";';
file_put_contents('/etc/apt/apt.conf.d/20auto-upgrades', $unattendedupgrades, FILE_APPEND | LOCK_EX);
}
}
// Enable normal updates
$replacements = array(
......
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