summaryrefslogtreecommitdiff
path: root/configs/profile/root-image/usr/bin
diff options
context:
space:
mode:
Diffstat (limited to 'configs/profile/root-image/usr/bin')
-rwxr-xr-xconfigs/profile/root-image/usr/bin/livecd-alsa-unmuter8
-rwxr-xr-xconfigs/profile/root-image/usr/bin/pick-a-card54
-rwxr-xr-xconfigs/profile/root-image/usr/bin/talk-to-me16
3 files changed, 78 insertions, 0 deletions
diff --git a/configs/profile/root-image/usr/bin/livecd-alsa-unmuter b/configs/profile/root-image/usr/bin/livecd-alsa-unmuter
new file mode 100755
index 0000000..6de05a0
--- /dev/null
+++ b/configs/profile/root-image/usr/bin/livecd-alsa-unmuter
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Properly initialize the sound card so that we have audio at boot.
+# This script is released under the GNU General Public License.
+source /usr/share/livecd-sound/functions
+
+preinit_levels all
+sanify_levels all
diff --git a/configs/profile/root-image/usr/bin/pick-a-card b/configs/profile/root-image/usr/bin/pick-a-card
new file mode 100755
index 0000000..7f469e8
--- /dev/null
+++ b/configs/profile/root-image/usr/bin/pick-a-card
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# If there are multiple usable sound cards, prompt the user to choose one,
+# using auditory feedback.
+# This script is released under the GNU General Public License.
+
+source /usr/share/livecd-sound/functions
+
+nwords() {
+ echo $#
+}
+
+is_numeric() {
+ local str=$1
+ expr match "$str" '[[:digit:]]\+$' > /dev/null 2>&1
+}
+
+set_default_card() {
+ local card=$1
+ sed -e "s/%card%/$card/g" < /usr/share/livecd-sound/asound.conf.in \
+ > /etc/asound.conf
+}
+
+play_on_card() {
+ local card=$1 file=$2
+ aplay "-Dplughw:$card,0" "$file"
+}
+
+set -f
+usable_cards="$(list_non_pcsp_cards)"
+num_usable_cards=$(nwords $usable_cards)
+
+if [ "$num_usable_cards" -eq 1 ]; then
+ exit 0
+fi
+
+for card in $usable_cards; do
+ if ! is_numeric "$card"; then
+ continue
+ fi
+ play_on_card "$card" /usr/share/livecd-sound/sounds/pick-a-card.wav&
+done
+wait
+sleep 1
+for card in $usable_cards; do
+ if ! is_numeric "$card"; then
+ continue
+ fi
+ play_on_card "$card" /usr/share/livecd-sound/sounds/beep.wav
+ if read -t 10; then
+ set_default_card "$card"
+ break
+ fi
+done
diff --git a/configs/profile/root-image/usr/bin/talk-to-me b/configs/profile/root-image/usr/bin/talk-to-me
new file mode 100755
index 0000000..118b013
--- /dev/null
+++ b/configs/profile/root-image/usr/bin/talk-to-me
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Initialize the Speakup screenreader
+# This script is released under the GNU General Public License.
+
+started_flag=/run/speech-is-running
+
+if [[ ! -f $started_flag ]]; then
+ systemctl stop espeakup
+
+ sleep 5
+ pick-a-card
+
+ systemctl start espeakup
+ touch $started_flag
+fi