summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOla Lundqvist <ola@inguza.com>2022-07-11 22:39:27 +0200
committerOla Lundqvist <ola@inguza.com>2022-07-11 23:23:41 +0200
commit55001d9ca28e4b3fe79ec838334d866d5cec5ed0 (patch)
tree31a476833e69ac9b6d7c729ba7871f1f3e61677f /bin
parent391fef271d0897389daf517a4c516f2536db6077 (diff)
Wrote a script to bulk add EOL entries for LTS buster.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lts-auto-eol68
1 files changed, 68 insertions, 0 deletions
diff --git a/bin/lts-auto-eol b/bin/lts-auto-eol
new file mode 100755
index 0000000000..51d46e9ae5
--- /dev/null
+++ b/bin/lts-auto-eol
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+use File::Copy;
+my $pkg = $ARGV[0];
+shift @ARGV;
+while (my $cve = shift @ARGV) {
+ &addEol($pkg, $cve);
+}
+exit;
+
+sub addEol {
+ my ($pkg, $cve) = @_;
+ print "Searching for $cve\n";
+ # Mode
+ # d - default
+ # c - cve found
+ # p - pkg found
+ # e - eol printed, just continue to end of file as we are done
+ my $mode = "d";
+ open IF, "data/CVE/list";
+ open OF, ">data/CVE/list.x";
+ while (my $line = <IF>) {
+ if ($mode eq "e") {
+ print OF $line;
+ next;
+ }
+ if ($mode eq "d") {
+ if ($line =~ /$cve\s/) {
+ print " CVE $cve found\n";
+ $mode = "c";
+ print OF $line;
+ next;
+ }
+ }
+ if ($mode eq "c") {
+ if ($line =~ /^\s+- $pkg\s/) {
+ $mode = "p";
+ print " Package $pkg found\n";
+ print OF $line;
+ next;
+ }
+ }
+ if ($mode eq "p") {
+ if ($line =~ /^\s+\[buster\] - $pkg\s/) {
+ $mode = "e";
+ print " Existing LTS line found, skipping: $line";
+ print OF $line;
+ next;
+ }
+ foreach my $rel ("bullseye", "bookworm", "trixie") {
+ if ($line =~ /^\s+\[$rel\] - $pkg\s/) {
+ # skipping through other distribution info
+ print OF $line;
+ next;
+ }
+ }
+ # End of package entry add EOL
+ print " EOL $cve for $pkg added.\n";
+ print OF "\t[buster] - $pkg <end-of-life> (No longer supported in LTS buster)\n";
+ print OF $line;
+ $mode = "e";
+ next;
+ }
+ print OF $line;
+ }
+ close IF;
+ close OF;
+ move ("data/CVE/list.x", "data/CVE/list");
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy