summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake/sound.pm
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-05-18 23:02:11 +0000
committerColin Guthrie <colin@mageia.org>2011-05-18 23:02:11 +0000
commit0f2835a86fe8d8eb820db0544513c9bef8ac466e (patch)
treec78b3ef9c83d33025bfa4a1f8b34f3f585e562e6 /perl-install/harddrake/sound.pm
parent985fd0995bb2cefe30e3e829b33bfb44e54885f2 (diff)
downloaddrakx-0f2835a86fe8d8eb820db0544513c9bef8ac466e.tar
drakx-0f2835a86fe8d8eb820db0544513c9bef8ac466e.tar.gz
drakx-0f2835a86fe8d8eb820db0544513c9bef8ac466e.tar.bz2
drakx-0f2835a86fe8d8eb820db0544513c9bef8ac466e.tar.xz
drakx-0f2835a86fe8d8eb820db0544513c9bef8ac466e.zip
draksound: Do not write PA config files if they do not exist
Diffstat (limited to 'perl-install/harddrake/sound.pm')
-rw-r--r--perl-install/harddrake/sound.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index d06dd708d..8b6efeb5c 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -190,6 +190,10 @@ sub set_pulseaudio {
my ($val) = @_;
my $alterative = '/etc/sound/profiles/' . ($val ? 'pulse' : 'alsa');
+ if ( ! -d $alterative ) {
+ return;
+ }
+
common::symlinkf_update_alternatives('soundprofile', $alterative);
# (cg) This config file will eventually be dropped, but it is still needed for now
@@ -216,6 +220,11 @@ sub is_pulseaudio_glitchfree_enabled() {
sub set_pulseaudio_glitchfree {
my ($val) = @_;
+
+ if ( ! -f $pa_defaultsconfig_file ) {
+ return;
+ }
+
substInFile {
if ($val) {
s/^(load-module\s+module-(udev|hal)-detect)\s+tsched=0/$1/;
@@ -229,6 +238,11 @@ my $pa_client_conffile = "$::prefix/etc/pulse/client.conf";
sub set_PA_autospan {
my ($val) = @_;
+
+ if ( ! -f $pa_client_conffile ) {
+ return;
+ }
+
$val = 'autospawn = ' . bool2yesno($val) . "\n";
my $done;
substInFile {
@@ -298,6 +312,7 @@ sub switch {
push @alternative, $driver;
my %des = modules::category2modules_and_description('multimedia/sound');
+ my $is_pulseaudio_installed = ( -f $pa_defaultsconfig_file && -f $pa_client_conffile && -d '/etc/sound/profiles/pulse' );
my $is_pulseaudio_enabled = is_pulseaudio_enabled();
my $is_pulseaudio_glitchfree_enabled = is_pulseaudio_glitchfree_enabled();
@@ -323,11 +338,12 @@ sub switch {
{
text => N("Enable PulseAudio"),
type => 'bool', val => \$is_pulseaudio_enabled,
+ disabled => sub { !$is_pulseaudio_installed },
},
{
text => N("Use Glitch-Free mode"),
type => 'bool', val => \$is_pulseaudio_glitchfree_enabled,
- disabled => sub { !$is_pulseaudio_enabled },
+ disabled => sub { !$is_pulseaudio_installed || !$is_pulseaudio_enabled },
},
{
advanced => 1,