summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin/twk_audio.pl
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/tweaker/bin/twk_audio.pl')
-rwxr-xr-xabs/core-testing/tweaker/bin/twk_audio.pl12
1 files changed, 6 insertions, 6 deletions
diff --git a/abs/core-testing/tweaker/bin/twk_audio.pl b/abs/core-testing/tweaker/bin/twk_audio.pl
index b3bdd89..37b2201 100755
--- a/abs/core-testing/tweaker/bin/twk_audio.pl
+++ b/abs/core-testing/tweaker/bin/twk_audio.pl
@@ -83,7 +83,7 @@ sub implement_option {
# output.
$command1 = "/bin/cp \$TWEAKER_ROOT/fs$asound_conf /etc/";
if (($card >= 0) && ($device >= 0)) {
- $command2 = "sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf";
+ $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf";
} else {
my $logger = get_logger('tweaker.script');
$logger->error("ERROR: Unable to poll for digital sound output device.");
@@ -110,9 +110,9 @@ sub implement_option {
sub edit_mplayer_conf {
my($option) = @_;
# delete any old entries that Tweaker made, relevant to this particular edit
- my $delete_old_tweaker_edits = "sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf";
+ my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf";
# comment out old entries that some other process may have made
- my $comment_out_external_edits = "sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf";
+ my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf";
my $command1;
my $command2="";
($card, $device) = poll_for_digital_output_device;
@@ -143,7 +143,7 @@ sub implement_option {
my @digital_audio_device_patterns = (
[
# Asus T3-M2NC51PV onboard audio
- ".*0403.*10de.*026c.*1043.*821f", "T3-M2NC51PV", "sed -i 's/plughw.* #TWEAKER/spdif #TWEAKER/g' $mplayer_conf"
+ ".*0403.*10de.*026c.*1043.*821f", "T3-M2NC51PV", "[ -e $mplayer_conf ] && sed -i 's/plughw.* #TWEAKER/spdif #TWEAKER/g' $mplayer_conf"
]
);
@@ -166,9 +166,9 @@ sub implement_option {
sub edit_xine_conf {
my($option)=@_;
# delete any old entries that Tweaker made, relevant to this particular edit
- my $delete_old_tweaker_edits = "sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf";
+ my $delete_old_tweaker_edits = "[ -e $xine_conf ] && sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf";
# comment out entries that some other process may have made
- my $comment_out_external_edits = "sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf";
+ my $comment_out_external_edits = "[ -e $xine_conf ] && sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf";
my $logger = get_logger('tweaker.script');
if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) {