#!/bin/sh -xe
grep -q ^https://10t.dev/alpine-iot /etc/apk/repositories && exit
cat<<EOF>/etc/apk/repositories
#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/v3.15/main
http://dl-cdn.alpinelinux.org/alpine/v3.15/community
#http://dl-cdn.alpinelinux.org/alpine/edge/main
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing
https://10t.dev/alpine-iot/v3.15
EOF
wget -P /etc/apk/keys https://10t.dev/alpine-iot/keys/takesako@namazu.org-587ad2bb.rsa.pub
apk update
apk upgrade
# (1/1) Upgrading linux-virt (5.15.32-r0 -> 5.15.32-r101)
# modprobe snd-pcm-oss
echo snd-pcm-oss >> /etc/modules
cat<<EOF>/etc/aumixrc
vol:100:100:P
pcm:100:100:P
speaker:100:100:P
line:100:100:P
mic:0:0:R
cd:0:0:P
igain:0:0:P
line1:0:0:P
phin:0:0:P
phout:0:0:P
video:0:0:P
EOF
apk add aumix
rc-update add aumix
# service aumix start

# audio
cat<<'EOF'>/etc/local.d/audio.start
#!/bin/sh
chown :audio /dev/dsp /dev/audio /dev/mixer
chmod go+rw  /dev/dsp /dev/audio /dev/mixer
EOF
chmod 755 /etc/local.d/audio.start

