unattended-upgrades: add new recipe version 2.6

The unattended-upgrades is a set of scripts that allows to execute
unattended upgrades in debian based systems in this case when
enable package_deb and add package management into the image.

At this moment installs all the required script and files into the image
leaving the configuration and execution to be implemented by distro.

Signed-off-by: Aníbal Limón <limon.anibal@gmail.com>
Signed-off-by: Aníbal Limón <anibal@rzerosystems.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
An?bal Lim?n 2022-01-27 20:46:28 -06:00 committed by Khem Raj
parent a95d3a0f33
commit 2855fb2de8
2 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,78 @@
From a52d763559d1017ca73d2a2933aba1c78ad354c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal@rzerosystems.com>
Date: Thu, 27 Jan 2022 16:32:25 -0600
Subject: [PATCH] unattended-upgrade: Remove distro_info usage to check devel
releases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The distro-info python3 package is used to check if the release is a
devel release and choice if continue with unattended-upgrade for now
remove it because needs support into python3-distro-info [1].
[1] https://salsa.debian.org/debian/distro-info
Signed-off-by: Aníbal Limón <anibal@rzerosystems.com>
Upstream-Status: Inappropriate
---
unattended-upgrade | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/unattended-upgrade b/unattended-upgrade
index 802d4d5..3b4e83e 100755
--- a/unattended-upgrade
+++ b/unattended-upgrade
@@ -83,9 +83,6 @@ import apt
import apt_inst
import apt_pkg
-import distro_info
-
-
# the reboot required flag file used by packages
REBOOT_REQUIRED_FILE = "/var/run/reboot-required"
KEPT_PACKAGES_FILE = "var/lib/unattended-upgrades/kept-back"
@@ -2061,41 +2058,6 @@ def run(options, # type: Options
if should_stop():
return UnattendedUpgradesResult(False)
- # check to see if want to auto-upgrade the devel release
- if apt_pkg.config.find("Unattended-Upgrade::DevRelease") == "auto":
- try:
- if DISTRO_ID.lower() == 'ubuntu':
- devel = (distro_info.UbuntuDistroInfo() .
- devel(result="object"))
- elif DISTRO_ID.lower() == 'debian':
- devel = (distro_info.DebianDistroInfo() .
- devel(result="object"))
- else:
- devel = (distro_info.DistroInfo(DISTRO_ID) .
- devel(result="object"))
- except Exception as e:
- logging.warning("Could not figure out development release: %s" % e)
- else:
- if ((devel.series == DISTRO_CODENAME
- and devel.release is not None
- and devel.release - date.today() > DEVEL_UNTIL_RELEASE)):
- syslog.syslog((_("Not running on this development "
- "release before %s") %
- (devel.release - DEVEL_UNTIL_RELEASE
- - datetime.timedelta(days=1))))
- logging.warning(_("Not running on this development "
- "release before %s") %
- (devel.release - DEVEL_UNTIL_RELEASE
- - datetime.timedelta(days=1)))
- return UnattendedUpgradesResult(True)
-
- logging.debug("Running on the development release")
- elif "(development branch)" in DISTRO_DESC and not\
- apt_pkg.config.find_b("Unattended-Upgrade::DevRelease", True):
- syslog.syslog(_("Not running on the development release."))
- logging.info(_("Not running on the development release."))
- return UnattendedUpgradesResult(True)
-
logging.info(_("Starting unattended upgrades script"))
# check and get lock

View File

@ -0,0 +1,31 @@
SUMMARY = "This script upgrades packages automatically and unattended."
DESCRIPTION = "The purpose of unattended-upgrades is to keep the computer current with the latest security (and other) updates automatically."
HOMEPAGE = "https://wiki.debian.org/UnattendedUpgrades"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
file://debian/copyright;md5=62b5f2ac0ede901fb245eefbe54c181f"
SRC_URI = "git://github.com/mvo5/unattended-upgrades.git;protocol=https;branch=master \
file://0001-unattended-upgrade-Remove-distro_info-usage-to-check.patch \
"
SRCREV = "c6db6fad26a2b83ba301b52ff5dee98cef7558ca"
S = "${WORKDIR}/git"
inherit setuptools3
DEPENDS += "apt intltool-native python3-distutils-extra-native"
RDEPENDS:${PN} += "apt lsb-release python3-apt python3-core python3-datetime python3-email python3-fcntl python3-io python3-logging python3-stringold python3-syslog"
do_install:prepend () {
cp -v ${S}/data/50unattended-upgrades.Debian ${S}/data/50unattended-upgrades
}
do_install:append () {
# fix bad installation path's
mv -v ${D}/usr/usr/share/* ${D}/usr/share/
rm -r ${D}/usr/usr
}
FILES:${PN} = "${bindir} ${exec_prefix}/etc ${libdir} ${datadir}"