/usr/share/tcos/hooks-addons/21pulseaudio is in initramfs-tools-tcos 0.89.86.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | # pulseaudio hook
#
# clients must connect in two ways:
#
# connecting to server: tcp:thin_client_ip:4713
# or
# importing X11 cookie with: $ pax11publish -i
# or
# using this env var PULSE_SERVER="thin_client_hostname"
if [ ${TCOS_PULSEAUDIO} ] && [ ${TCOS_SOUND} ]; then
# check for apps
check1=0
[ -x /usr/bin/pulseaudio ] && check1=1
#check2=0
#[ -e /usr/lib/pulse*/modules/module-esound-protocol-tcp.so ] && check2=1
#[ -d ${TCOS_PKG_CACHE}/pulseaudio-esound-compat/usr/lib ] && check2=1
if [ $check1 = 0 ]; then
echo " WARNING:"
echo " pulseaudio is not installed, disable it from tcos.conf!!!"
#elif [ $check2 = 0 ]; then
# echo " WARNING:"
# echo " pulseaudio-esound-compat is not installed, need some esound modules"
# echo " install this package or disable PulseAudio in /etc/tcos/tcos.conf"
# echo " You can install a cached package with:"
# echo " # gentcos -instpkg pulseaudio-esound-compat"
# echo ""
# echo " See /usr/share/doc/initramfs-tools-tcos/README.cache"
# echo ""
else
stat_before
cpifexists /usr/bin/pulseaudio /usr/bin/
cpifexists /usr/bin/pax11publish /usr/bin/
cpifexists /usr/bin/pactl /usr/bin/
mkdir -p ${DESTDIR}/usr/lib
copydir /usr/lib/pulse-* /usr/lib/
mkdir -p ${DESTDIR}/var/lib/pulse
# clean unneeded modules
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*.la
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*jack*
# rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*rtp*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*lirc*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*evdev*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*sine*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*x11-bell*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*zeroconf*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*avahi*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*gconf*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*hal*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*pipe*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*tunel*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*volume-restore*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*cli*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*http*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*console-kit*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*ladspa*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*bluetooth*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*augment*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*phone*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*position-event*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*filter*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*equalizer*
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*rygel*
# don't use suspend-idle (we don't use dbus yet to reload pulseaudio)
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*idle*
# don't copy x11 modules
rm -f ${DESTDIR}/usr/lib/pulse-*/modules/*x11*
# copy channel configuration files if exists
if [ -d /usr/share/pulseaudio/ ]; then
copydir /usr/share/pulseaudio /usr/share/
fi
# needed for pulse -> esound -> OSS
[ -e /usr/lib/pulse-*/modules/libsocket-client.so ] && \
cpifexists /usr/lib/pulse-*/modules/libsocket-client.so /usr/lib/pulse-*/modules/
# delete modules and copy again to put linked libs
for _lib in $DESTDIR/usr/lib/pulse-*/modules/*so; do
librel=$(basename $_lib)
rm -f $_lib
cpifexists /usr/lib/pulse-*/modules/${librel} /usr/lib/pulse-*/modules/
done
echo "pulse:x:111:120:PulseAudio daemon,,,:/var/run/pulse:/bin/false" >> $DESTDIR/etc/passwd
echo "pulse:x:120:" >> $DESTDIR/etc/group
#copydir /etc/pulse /etc/
mkdir -p $DESTDIR/etc/pulse
cp /etc/pulse/client.conf $DESTDIR/etc/pulse/
cp /etc/pulse/daemon.conf $DESTDIR/etc/pulse/
if [ "$TCOS_SOUND_REMOTE_ESD" ]; then
_SERVER=";\$(read_server "xdmcp-server")"
else
_SERVER=""
fi
#if [ -e /usr/lib/pulse-*/modules/module-udev-detect.so ]; then
# _MODULE="module-udev-detect"
#else
# _MODULE="module-detect"
#fi
# disable udev-detect by now, (in my system don't find cards)
_MODULE="module-detect"
cat << EOF >> ${DESTDIR}/sbin/startpulseaudio
#!/bin/sh
. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions
# limit PulseAudio SHM memory in low memory systems (<96MiB = 98304)
if [ "\$(awk '/MemTotal/ {print \$2}' /proc/meminfo)" -lt 98305 ]; then
if grep -q shm-size-bytes /etc/pulse/daemon.conf; then
echo "shm-size-bytes = 16" >> /etc/pulse/daemon.conf
fi
if grep -q enable-shm /etc/pulse/daemon.conf; then
echo "enable-shm = no" >> /etc/pulse/daemon.conf
fi
fi
# don't allow to exit_idle (by default 20 seconds)
if grep -q exit-idle-time /etc/pulse/daemon.conf; then
echo "exit-idle-time = -1" >> /etc/pulse/daemon.conf
fi
# generate conf
rm -f /etc/pulse/default.pa
if [ "\$(pidof esd | sed '/^\$/d')" != "" ]; then
cat << FIN > /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
load-module module-esound-sink server=127.0.0.1
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;\$(read_server "xdmcp-server")
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif
FIN
else
cat << FIN > /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
load-module $_MODULE
load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1$_SERVER
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;\$(read_server "xdmcp-server")
load-module module-esound-protocol-unix
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif
.nofail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-always-sink
.fail
FIN
fi
DISPLAY=:0
export DISPLAY
cpu=\$(grep MHz /proc/cpuinfo | tail -1 | awk -F":" '{if(int(\$2) < 1024) printf "low"}')
realtime=\$(pulseaudio --help 2>&1 | grep -c realtime)
OPTS="--log-target=stderr "
if [ \${TCOS_PULSEAUDIO_RESAMPLE_METHOD} ]; then
OPTS="\${OPTS} --resample-method=\${TCOS_PULSEAUDIO_RESAMPLE_METHOD}"
fi
OPTS="--no-cpu-limit \${OPTS}"
if [ "\$cpu" = "low" ]; then
#OPTS="--no-cpu-limit \${OPTS}"
# old versions of pulseaudio don't have realtime switch (Etch)
if [ "\$realtime" != "0" ]; then
OPTS="\${OPTS} --realtime "
fi
fi
_log "STARTPULSEAUDIO starting pulseaudio server..."
pulseaudio \${OPTS} &
sleep 4
#
# wait for Xorg is started
#
waitforX || exit
sleep 2
#
DISPLAY=:0 pax11publish -e
#
exit 0
EOF
chmod +x ${DESTDIR}/sbin/startpulseaudio
stat_after "PulseAudio (sound server)"
fi # end of else of /usr/bin/pulseaudio
else
_verbose "(21pulseaudio) TCOS_PULSEAUDIO && sound disabled"
fi # end of TCOS_PULSEAUDIO
|