diff --git a/CHANGES b/CHANGES index 40dd31768..b39b2ac47 100644 --- a/CHANGES +++ b/CHANGES @@ -2274,3 +2274,5 @@ * import all boxdata settings into the database * volumes: generate systemd mount configs based on type * postgresql: set max conn limit per db +* ubuntu 16: add alert about EOL + diff --git a/src/cloudron.js b/src/cloudron.js index 07e33d431..750fb6695 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -167,6 +167,10 @@ function runStartupTasks() { function getConfig(callback) { assert.strictEqual(typeof callback, 'function'); + const release = safe.fs.readFileSync('/etc/lsb-release', 'utf-8'); + if (release === null) return callback(new BoxError(BoxError.FS_ERROR, safe.error.message)); + const ubuntuVersion = release.match(/DISTRIB_DESCRIPTION="(.*)"/)[1]; + settings.getAll(function (error, allSettings) { if (error) return callback(error); @@ -178,6 +182,7 @@ function getConfig(callback) { adminFqdn: settings.dashboardFqdn(), mailFqdn: settings.mailFqdn(), version: constants.VERSION, + ubuntuVersion, isDemo: settings.isDemo(), cloudronName: allSettings[settings.CLOUDRON_NAME_KEY], footer: branding.renderFooter(allSettings[settings.FOOTER_KEY] || constants.FOOTER), @@ -209,7 +214,8 @@ function runSystemChecks(callback) { async.parallel([ checkMailStatus, - checkRebootRequired + checkRebootRequired, + checkUbuntuVersion ], callback); } @@ -237,6 +243,14 @@ function checkRebootRequired(callback) { }); } +function checkUbuntuVersion(callback) { + assert.strictEqual(typeof callback, 'function'); + + const isXenial = fs.readFileSync('/etc/lsb-release', 'utf-8').includes('16.04'); + + if (isXenial) notifications.alert(notifications.ALERT_UPDATE_UBUNTU, 'Ubuntu Upgrade Required', 'Ubuntu 16.04 has reached end of life and will not receive security and maintenance updates. Please follow https://docs.cloudron.io/guides/upgrade-ubuntu-18/ to upgrade to Ubuntu 18 at the earliest.', callback); +} + function getLogs(unit, options, callback) { assert.strictEqual(typeof unit, 'string'); assert(options && typeof options === 'object'); diff --git a/src/notifications.js b/src/notifications.js index 86cafee1e..da2f34bb1 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -10,12 +10,12 @@ exports = module.exports = { appUpdatesAvailable, boxUpdateAvailable, - // NOTE: if you add an alert, be sure to add title below ALERT_BACKUP_CONFIG: 'backupConfig', ALERT_DISK_SPACE: 'diskSpace', ALERT_MAIL_STATUS: 'mailStatus', ALERT_REBOOT: 'reboot', ALERT_BOX_UPDATE: 'boxUpdate', + ALERT_UPDATE_UBUNTU: 'ubuntuUpdate', alert, @@ -23,7 +23,7 @@ exports = module.exports = { _add: add }; -let apps = require('./apps.js'), +const apps = require('./apps.js'), assert = require('assert'), async = require('async'), auditSource = require('./auditsource.js'),