summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2023-03-31 18:59:59 +0200
committerGiuseppe Ghibò <ghibo@mageia.org>2023-04-08 12:39:03 +0200
commit0413c64502c126e66d9b230137f58af1f97806ff (patch)
treeb5362fe6cfaf5dc5df4d826917196c5315a93587 /perl-install/harddrake
parent03dba17e96df43421a147c66b1b17fcc0d51c9e8 (diff)
downloaddrakx-0413c64502c126e66d9b230137f58af1f97806ff.tar
drakx-0413c64502c126e66d9b230137f58af1f97806ff.tar.gz
drakx-0413c64502c126e66d9b230137f58af1f97806ff.tar.bz2
drakx-0413c64502c126e66d9b230137f58af1f97806ff.tar.xz
drakx-0413c64502c126e66d9b230137f58af1f97806ff.zip
Add checking for task packages availability
Diffstat (limited to 'perl-install/harddrake')
-rw-r--r--perl-install/harddrake/sound.pm73
1 files changed, 46 insertions, 27 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index aed60e119..7801bf8c8 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -1,15 +1,5 @@
package harddrake::sound;
-# 2023-03-18 ghibo: cleanup against perl_checker
-# 2023-03-18 anaselli: add reboot requester
-# 2023-03-17 ghibo: stop also wireplumber in disable_all_pipewire
-# 2023-03-17 ghibo: stop pulseaudio with the running user
-# 2023-03-17 anaselli: suspend pipewire before configuring pulseaudio
-# 2023-03-13 ghibo: added {start|stop}_{pipewire,wireplumber,pipewire-media-session}(), _pidof_pid(); _user_pid()
-# 2023-03-13 ghibo: use rooted_get_stdout instead of get_stdout
-# 2023-03-11 Angelo Naselli: added pipewire support
-#
-#
# TODO:
# o ensure sound is not user (either dsp/midi/sequencer/mixer)
# o fix sound/alsa services
@@ -22,9 +12,10 @@ use list_modules;
use detect_devices;
use log;
-sub is_pulseaudio_enabled() {
+sub is_pulseaudio_enabled {
+ my ($in) = @_;
my $soundprofile = common::read_alternative('soundprofile');
- $soundprofile =~ /pulse$/;
+ return $in->do_pkgs->is_installed('task-pulseaudio') && ($soundprofile =~ /pulse$/);
}
sub set_pulseaudio {
@@ -71,6 +62,16 @@ sub set_pulseaudio_glitchfree {
} $pa_startup_scriptfile;
}
+sub is_pipewire_wireplumber_enabled {
+ my ($in) = @_;
+ return $in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('wireplumber');
+}
+
+sub is_pipewire_media_session_enabled {
+ my ($in) = @_;
+ return $in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('pipewire-media-session');
+}
+
sub rooted {
run_program::rooted($::prefix, @_);
}
@@ -441,8 +442,7 @@ sub config {
push @alternative, $driver;
my %des = modules::category2modules_and_description('multimedia/sound');
- my $is_pulseaudio_installed = -f $pa_startup_scriptfile && -d $::prefix . '/etc/sound/profiles/pulse';
- my $is_pulseaudio_enabled_val = is_pulseaudio_enabled();
+ my $is_pulseaudio_enabled_val = is_pulseaudio_enabled($in);
my $is_pulseaudio_glitchfree_enabled_val = is_pulseaudio_glitchfree_enabled();
my $audiosystem = 'None';
@@ -450,9 +450,9 @@ sub config {
$audiosystem = 'PulseAudioGF';
} elsif ($is_pulseaudio_enabled_val) {
$audiosystem = 'PulseAudio';
- } elsif (_pidof('/usr/bin/wireplumber')) {
+ } elsif (is_pipewire_wireplumber_enabled($in) || _pidof('/usr/bin/wireplumber')) {
$audiosystem = 'PipeWireWP';
- } elsif (_pidof('/usr/bin/pipewire-media-session')) {
+ } elsif (is_pipewire_media_session_enabled($in) || _pidof('/usr/bin/pipewire-media-session')) {
$audiosystem = 'PipeWireMS';
}
@@ -490,10 +490,28 @@ sub config {
#TODO Error here
}
- $in->ask_warn('', N("You need to reboot for changes to take effect"));
+ $in->ask_warn('', N("You need to reboot for changes to take effect")) if $::isStandalone;
};
+ my $warn_both = ($in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('pulseaudio')) ?
+ N("WARNING both pulseaudio and pipewire are installed, please fix configuration applying your choice") :
+ "";
+
+ my $is_pipewire_available = $in->do_pkgs->is_available('task-pipewire');
+ my $warn_pipewire_unavailable = (not $is_pipewire_available) ?
+ N("Warning: task-pipewire is not available on any media sources, so pipewire cannot be set up. Plese fix your repo configuration.") :
+ "";
+
+ my @service_list = (
+ 'None',
+ 'PulseAudio',
+ 'PulseAudioGF',
+ );
+ if ($is_pipewire_available) {
+ push @service_list, 'PipeWireWP';
+ push @service_list, 'PipeWireMS';
+ }
my @common = (
{
label => N("Select the sound server"),
@@ -501,13 +519,7 @@ sub config {
},
{
val => \$audiosystem,
- list => [
- 'None',
- 'PulseAudio',
- 'PulseAudioGF',
- 'PipeWireWP',
- 'PipeWireMS',
- ],
+ list => \@service_list,
format => sub {
my ($choice) = @_;
+{
@@ -531,6 +543,15 @@ sub config {
},
);
+ my @messages = ( "<b><i>" . $device->{description} . "</i></b>",
+ N("Your card uses the <b>\"%s\"</b> driver\n", $driver) );
+
+ if ($warn_both) {
+ push @messages, ("<b>" . $warn_both . "</b>") ;
+ }
+ if (not $is_pipewire_available) {
+ push @messages, "<b>" . $warn_pipewire_unavailable . "</b>" ;
+ }
if ($driver eq 'unknown') {
if ($in->ask_from_({
title => N("No alternative driver"),
@@ -543,9 +564,7 @@ sub config {
}
} elsif ($in->ask_from_({ title => N("Sound configuration"),
interactive_help_id => 'soundConfig',
- messages =>
- "<b><i>" . $device->{description} . "</i></b>" .
- "\n\n" . N("Your card uses the <b>\"%s\"</b> driver\n", $driver),
+ messages => \@messages
},
\@common,
))