NCSC-NL / taranis3

Taranis
Other
59 stars 17 forks source link

Centos 8 'policycoreutils-python' dependency #54

Open MedRayenn opened 2 years ago

MedRayenn commented 2 years ago

After running

root# tar xzf taranis-$version.tar.gz taranis-$version/taranis-bootstrap
root# mv taranis-$version/taranis-bootstrap .
root# ./taranis-bootstrap taranis-$version.tar.gz

you need to change line 33 from 'policycoreutils-python' to 'python3-policycoreutils' in : /home/taranis/sources/taranis-$version/install/012.distribution-centos

and run again this command root# ./taranis-bootstrap taranis-$version.tar.gz

markov2 commented 2 years ago

Thanks for your report. The installation scripts do need to support multiple versions of CentOS at the same time, and sometimes package names change. Therefore, I need to know how to discover the major version number of the OS.

I am not running CentOS myself. Can you please help me with a piece of logic? https://linuxconfig.org/how-to-check-centos-version shows different ways to find-out the major number of the release, but it is probably only output which contains the version number. Can you produce a short BASH script which says '8' on CentOS8 and '7' on CentOS7?

MedRayenn commented 2 years ago

Hello, I may suggest this command :

  . /etc/os-release
echo $VERSION_ID
markov2 commented 2 years ago

I hope this works for next release

commit 4b4732fc671c6003e1b43dbb320a4d6b98bc33ab
Author: Mark Overmeer <mark@overmeer.net>
Date:   Sat Feb 5 22:22:54 2022 +0100

    issue #54 CentOS python3-policycoreutils

diff --git a/install/012.distribution-centos b/install/012.distribution-centos
index ff3aae88..367d09c8 100755
--- a/install/012.distribution-centos
+++ b/install/012.distribution-centos
@@ -4,7 +4,7 @@
 use warnings;
 use strict;

-use Taranis::Install::Bare   qw(is_centos);
+use Taranis::Install::Bare   qw(is_centos get_os_info);
 use Taranis::Install::CentOS qw(centos_packages);

 unless(is_centos) {
@@ -30,7 +30,18 @@ centos_packages
        'perl-CPAN',
        'perl-Data-Dumper',  # to be able to create the CPAN Config
        'perl-File-Remove',  # needed by "taranis install"
-       'policycoreutils-python',
        ;

+my $version = get_os_info->{VERSION_ID};
+if($version gt '8') {    # maybe not numeric
+       centos_packages
+               'python3-policycoreutils',
+       ;
+}
+else {
+       centos_packages
+               'policycoreutils-python',
+       ;
+}
+
 exit 0;