summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD36
-rw-r--r--lga.service8
-rw-r--r--modern-linux.patch104
-rw-r--r--no-install.patch87
5 files changed, 256 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..aa678932de99
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = linux-genuine-advantage
+ pkgdesc = This program makes sure that a given copy of Linux is Genuine
+ pkgver = 1.0.0
+ pkgrel = 1
+ url = http://www.linuxgenuineadvantage.org
+ arch = any
+ license = GPL
+ depends = perl
+ depends = perl-cgi
+ depends = perl-io-socket-inet6
+ source = http://www.linuxgenuineadvantage.org/downloads/linux-genuine-advantage-1.0.0.tar.gz
+ source = modern-linux.patch
+ source = no-install.patch
+ source = lga.service
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+
+pkgname = linux-genuine-advantage
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..21e5c972e613
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,36 @@
+# Maintainer: Nobody <nobody@anonymous.invalid>
+pkgname=linux-genuine-advantage
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="This program makes sure that a given copy of Linux is Genuine"
+arch=('any')
+url="http://www.linuxgenuineadvantage.org"
+license=('GPL')
+depends=("perl"
+ "perl-cgi"
+ "perl-io-socket-inet6")
+source=("$url/downloads/$pkgname-$pkgver.tar.gz"
+ "modern-linux.patch"
+ "no-install.patch"
+ "lga.service")
+md5sums=("SKIP"
+ "SKIP"
+ "SKIP"
+ "SKIP")
+
+prepare() {
+ cd "$pkgname-$pkgver"
+ patch -p1 -i "$srcdir/modern-linux.patch"
+ patch -p1 -i "$srcdir/no-install.patch"
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+ mkdir $pkgdir/usr
+ mkdir $pkgdir/usr/bin
+ cp $srcdir/$pkgname-$pkgver/$pkgname $pkgdir/usr/bin
+ mkdir $pkgdir/usr/lib
+ mkdir $pkgdir/usr/lib/systemd
+ mkdir $pkgdir/usr/lib/systemd/system
+ cp $srcdir/lga.service $pkgdir/usr/lib/systemd/system
+}
diff --git a/lga.service b/lga.service
new file mode 100644
index 000000000000..423f678a1788
--- /dev/null
+++ b/lga.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Linux Genuine Advantage - http://www.linuxgenuineadvantage.org/
+
+[Service]
+ExecStart=/usr/bin/linux-genuine-advantage daemon
+
+[Install]
+WantedBy=multi-user.target
diff --git a/modern-linux.patch b/modern-linux.patch
new file mode 100644
index 000000000000..c1641c5f8d6c
--- /dev/null
+++ b/modern-linux.patch
@@ -0,0 +1,104 @@
+--- aaa/linux-genuine-advantage
++++ bbb/linux-genuine-advantage
+@@ -48,7 +48,7 @@
+ my $config_key_file = $config_directory . '/product-key';
+
+ # key system files
+-my $inittab = '/etc/inittab';
++my $service = '/usr/lib/systemd/system/lga.service';
+ my $nologin = '/etc/nologin';
+
+ # Domain and URL to send product key and hardware hash to. From here we receive marching
+@@ -180,48 +180,46 @@
+ print "\n";
+ }
+
+-# adds a line to /etc/inittab so this program will perpetually run as a daemon.
++# adds a service so this program will perpetually run as a daemon.
+ # this will ensure that this copy of Linux is validated for Genuineness and Advantageousness constantly.
+ #
+ # accepts no arguments
+ # returns 1 on success, exits the program on error
+ sub do_install {
+ my @lines = ();
+- my $result = undef;
++ my $reload_result = undef;
++ my $service_result = undef;
+ my $installed = 0;
+
+- open(INITTAB, "$inittab") or show_error("Could not open $inittab for reading!");
+- @lines = <INITTAB>;
+- close(INITTAB);
+-
+- if (0 == @lines) {
+- show_error("Could not read $inittab!");
+- }
+-
+ # see if it's installed
+- foreach my $line (@lines) {
+- if ($line =~ m/linux\-genuine\-advantage/o) {
+- if ($line !~ m/#/o) {
+- $installed = 1;
+- last;
+- }
+- }
++ if (-e $service) {
++ $installed = 1;
+ }
+
+ # if it's not installed, install it
+ if (0 == $installed) {
+- # add this program to inittab
+- # /usr/local/sbin/linux-genuine-advantage is the only Genuine path to this program, so no auto-detection is necessary
+- open(INITTAB, ">> $inittab") or show_error("Could not install into $inittab!");
+- print INITTAB "\n";
+- print INITTAB "# Linux Genuine Advantage - http://www.linuxgenuineadvantage.org/\n";
+- print INITTAB "LGA:123456:respawn:/usr/local/sbin/$PROGRAM_NAME daemon\n";
+- close(INITTAB);
++ # add service
++ # /usr/local/sbin/linux-genuine-advantage is the only Genuine path to this program (but /usr/sbin is symlink to /usr/bin), so no auto-detection is necessary
++ open(SERVICE, ">> $service") or show_error("Could not install into $service!");
++ print SERVICE "[Unit]\n";
++ print SERVICE "Description=Linux Genuine Advantage - http://www.linuxgenuineadvantage.org/\n";
++ print SERVICE "\n";
++ print SERVICE "ExecStart=/usr/bin/$PROGRAM_NAME daemon\n";
++ print SERVICE "\n";
++ print SERVICE "[Install]\n";
++ print SERVICE "WantedBy=multi-user.target\n";
++ close(SERVICE);
+
+- # restart init (kill -HUP 1)
+- $result = kill(1, 1);
+- if (! $result) {
+- show_error("Could not restart init!");
++ # reload systemd state
++ $reload_result = system('systemctl daemon-reload');
++ if (! $reload_result) {
++ show_error("Could not reload systemd state!");
++ }
++
++ # enable service
++ $service_result = system('systemctl enable lga');
++ if (! $service_result) {
++ show_error("Could not enable service!");
+ }
+ }
+
+@@ -232,7 +230,7 @@
+ # if no money has changed hands after 30 days, make the computer less useful as punishment.
+ #
+ # accepts no arguments
+-# runs as a daemon forever (called from inittab, does not fork into the background)
++# runs as a daemon forever (called from service, does not fork into the background)
+ sub do_daemon {
+ my $result = undef;
+
+@@ -323,7 +321,7 @@
+ # accepts no arguments
+ # returns an md5sum that will cause unnecessary grief for the user if it doesn't match exactly
+ sub calculate_hardware_hash {
+- my $md5sum = `(/sbin/ifconfig | grep -i hwaddr | awk '{print \$5}' | sort -u; cat /proc/cpuinfo | egrep -i 'processor|vendor_id|cpu family|model|model name|stepping') | md5sum | awk '{print \$1}'`;
++ my $md5sum = `(/sbin/ifconfig | grep -i ether | awk '{print \$2}' | sort -u; egrep -i 'processor|vendor_id|cpu family|model|model name|stepping') /proc/cpuinfo | md5sum | awk '{print \$1}'`;
+ chomp($md5sum);
+ return ($md5sum);
+ }
diff --git a/no-install.patch b/no-install.patch
new file mode 100644
index 000000000000..5ada3b8199a7
--- /dev/null
+++ b/no-install.patch
@@ -0,0 +1,87 @@
+--- aaa/linux-genuine-advantage
++++ bbb/linux-genuine-advantage
+@@ -79,8 +79,6 @@
+ $cmd = $ARGV[0];
+ if ('register' eq $cmd) {
+ do_register();
+-} elsif ('install' eq $cmd) {
+- do_install();
+ } elsif ('daemon' eq $cmd) {
+ do_daemon();
+ } else {
+@@ -107,12 +105,7 @@
+ print STDERR "software, and you are welcome to redistribute it under certain\n";
+ print STDERR "conditions. See the GNU General Public License for details.\n";
+ print STDERR "\n";
+- print STDERR "Usage: $PROGRAM_NAME [register|install]\n";
+- print STDERR "\n";
+- print STDERR " install\n";
+- print STDERR "\n";
+- print STDERR " Installs the $PROGRAM_NAME service. This is required in\n";
+- print STDERR " order to get the Genuine Linux Advantage.\n";
++ print STDERR "Usage: $PROGRAM_NAME [register]\n";
+ print STDERR "\n";
+ print STDERR " register\n";
+ print STDERR "\n";
+@@ -146,8 +139,6 @@
+ sub do_register {
+ my $md5sum = calculate_hardware_hash();
+
+- do_install();
+-
+ print "\n";
+ print "------------------------------------------------------------------------------\n";
+ print "Linux Genuine Advantage Registration\n";
+@@ -180,52 +171,6 @@
+ print "\n";
+ }
+
+-# adds a service so this program will perpetually run as a daemon.
+-# this will ensure that this copy of Linux is validated for Genuineness and Advantageousness constantly.
+-#
+-# accepts no arguments
+-# returns 1 on success, exits the program on error
+-sub do_install {
+- my @lines = ();
+- my $reload_result = undef;
+- my $service_result = undef;
+- my $installed = 0;
+-
+- # see if it's installed
+- if (-e $service) {
+- $installed = 1;
+- }
+-
+- # if it's not installed, install it
+- if (0 == $installed) {
+- # add service
+- # /usr/local/sbin/linux-genuine-advantage is the only Genuine path to this program (but /usr/sbin is symlink to /usr/bin), so no auto-detection is necessary
+- open(SERVICE, ">> $service") or show_error("Could not install into $service!");
+- print SERVICE "[Unit]\n";
+- print SERVICE "Description=Linux Genuine Advantage - http://www.linuxgenuineadvantage.org/\n";
+- print SERVICE "\n";
+- print SERVICE "ExecStart=/usr/bin/$PROGRAM_NAME daemon\n";
+- print SERVICE "\n";
+- print SERVICE "[Install]\n";
+- print SERVICE "WantedBy=multi-user.target\n";
+- close(SERVICE);
+-
+- # reload systemd state
+- $reload_result = system('systemctl daemon-reload');
+- if (! $reload_result) {
+- show_error("Could not reload systemd state!");
+- }
+-
+- # enable service
+- $service_result = system('systemctl enable lga');
+- if (! $service_result) {
+- show_error("Could not enable service!");
+- }
+- }
+-
+- return (1);
+-}
+-
+ # loop continuously, checking periodically to see if the author of this program got paid.
+ # if no money has changed hands after 30 days, make the computer less useful as punishment.
+ #