Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
install_pkg: Fix --cmd for sles, opensuse, ubuntu
Browse files Browse the repository at this point in the history
These commands prints nothing:
./install_pkg.pm --build --run --distro sles --cmd
./install_pkg.pm --build --run --distro opensuse --cmd
./install_pkg.pm --build --run --distro ubuntu --cmd

Fixes: 22db0cd ("install_pkg: Introduce openSUSE, SLES instead of suse")
Fixes: e572aa5 ("install_pkg: Introduce Ubuntu")

Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Nov 29, 2021
1 parent 4319466 commit e858293
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions install_pkg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,28 @@ sub detect_distro
sub pkg_to_m32
{
my ($distro, $pkg_name) = @_;
$distro = get_distro_alias($distro);

if ($distro eq "debian") {
#TODO: we need architecture detection for now default to i386
return "gcc-multilib" if ($pkg_name eq "gcc");
return "$pkg_name:i386";
}

return "$pkg_name-32bit" if ($distro eq "suse");
return "$pkg_name-32bit" if ($distro eq "opensuse");

return;
}

sub setup_m32
{
my ($distro) = @_;
$distro = get_distro_alias($distro);

if ($distro eq "debian") {
return ("dpkg --add-architecture i386");
}

return;
}

Expand All @@ -159,6 +162,7 @@ sub map_pkgs
sub install_pkg
{
my ($distro, $pkgs) = @_;
$distro = get_distro_alias($distro);

if ($distro eq "alpine") {
return 'apk add ' . join(' ', @$pkgs);
Expand All @@ -172,14 +176,15 @@ sub install_pkg
return 'yum install -y ' . join(' ', @$pkgs);
}

if ($distro eq 'suse') {
if ($distro eq 'opensuse') {
return 'zypper --non-interactive --ignore-unknown in ' . join(' ', @$pkgs);
}
}

sub update_pkg_db
{
my ($distro) = @_;
$distro = get_distro_alias($distro);

if ($distro eq "alpine") {
return "apk update";
Expand All @@ -193,7 +198,7 @@ sub update_pkg_db
return "yum update -y";
}

if ($distro eq "suse") {
if ($distro eq "opensuse") {
return "zypper --non-interactive ref";
}

Expand Down

0 comments on commit e858293

Please sign in to comment.