]> git.aero2k.de Git - dfde/tinycore_radio.git/commitdiff
init master
authorThorsten <mail@aero2k.de>
Sun, 7 Dec 2025 14:42:12 +0000 (15:42 +0100)
committerThorsten <mail@aero2k.de>
Sun, 7 Dec 2025 14:42:27 +0000 (15:42 +0100)
13 files changed:
.gitignore [new file with mode: 0644]
alle_antennen.txt [new file with mode: 0755]
bootlocal.sh [new file with mode: 0755]
download_playlists.sh [new file with mode: 0755]
install_prereqs.sh [new file with mode: 0755]
make_mpd.sh [new file with mode: 0755]
play.sh [new file with mode: 0755]
remount_ext.sh [new file with mode: 0755]
resize.sh [new file with mode: 0755]
run_once.sh [new file with mode: 0755]
setup.sh [new file with mode: 0755]
setup_wifi.sh [new file with mode: 0755]
util.sh [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..b57978d
--- /dev/null
@@ -0,0 +1,3 @@
+wpa_supplicant.conf
+authorized_keys
+.profile
diff --git a/alle_antennen.txt b/alle_antennen.txt
new file mode 100755 (executable)
index 0000000..5185218
--- /dev/null
@@ -0,0 +1,53 @@
+https://play.antenne.de/antenne.m3u
+https://play.antenne.de/2000er-hits.m3u
+https://play.antenne.de/2010er-hits.m3u
+https://play.antenne.de/70er-hits.m3u
+https://play.antenne.de/antenne-bayern-70er-rock.m3u
+https://play.antenne.de/antenne-bayern-80er-disco-hits.m3u
+https://play.antenne.de/80er-kulthits.m3u
+https://play.antenne.de/antenne-bayern-80er-new-wave.m3u
+https://play.antenne.de/antenne-bayern-80er-party.m3u
+https://play.antenne.de/antenne-bayern-80er-rock.m3u
+https://play.antenne.de/antenne-bayern-90er-eurodance.m3u
+https://play.antenne.de/90er-hits.m3u
+https://play.antenne.de/antenne-bayern-90er-party.m3u
+https://play.antenne.de/antenne-bayern-90er-rock.m3u
+https://play.antenne.de/antenne-nrw.m3u
+https://play.antenne.de/apres-ski.m3u
+https://play.antenne.de/bayerische-weihnacht.m3u
+https://play.antenne.de/bayern-sound.m3u
+https://play.antenne.de/black-beatz.m3u
+https://play.antenne.de/country-antenne.m3u
+https://play.antenne.de/chillout.m3u
+https://play.antenne.de/classic-rock-live.m3u
+https://play.antenne.de/coffee.m3u
+https://play.antenne.de/dance-xxl.m3u
+https://play.antenne.de/deutsch-pop.m3u
+https://play.antenne.de/faschings-hits.m3u
+https://play.antenne.de/fresh.m3u
+https://play.antenne.de/fruehlings-hits.m3u
+https://play.antenne.de/greatest-hits.m3u
+https://play.antenne.de/event.m3u
+https://play.antenne.de/halli-galli-gaudi.m3u
+https://play.antenne.de/happy-hits.m3u
+https://play.antenne.de/herbst-hits.m3u
+https://play.antenne.de/hits-fuer-kids.m3u
+https://play.antenne.de/in-the-mix.m3u
+https://play.antenne.de/antenne-bayern-italo-hits.m3u
+https://play.antenne.de/lounge.m3u
+https://play.antenne.de/lovesongs.m3u
+https://play.antenne.de/mallorca-party.m3u
+https://play.antenne.de/antenne-bayern-ndw.m3u
+https://play.antenne.de/nur-die-musik.m3u
+https://play.antenne.de/oldie-antenne.m3u
+https://play.antenne.de/oktoberfest-hits.m3u
+https://play.antenne.de/party-hits.m3u
+https://play.antenne.de/pop-xxl.m3u
+https://play.antenne.de/rockantenne-bayern.m3u
+https://play.antenne.de/relax.m3u
+https://play.antenne.de/das-schlager-karussell.m3u
+https://play.antenne.de/sommer-hits.m3u
+https://play.antenne.de/top-1000.m3u
+https://play.antenne.de/top-40.m3u
+https://play.antenne.de/weihnachts-hits.m3u
+https://play.antenne.de/workout-hits.m3u
\ No newline at end of file
diff --git a/bootlocal.sh b/bootlocal.sh
new file mode 100755 (executable)
index 0000000..b83cdd2
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# To start serial terminal /w console
+# Add the following to the cmdline.txt console=serial0,115200
+# Reference https://www.raspberrypi.org/documentation/configuration/uart.md for UART configuration
+# Uncomment the next line
+# /usr/sbin/startserialtty &
+
+# Set CPU frequency governor to ondemand (default is performance)
+echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+
+# Load modules - i2c-dev needs manually loaded even if enabled in config.txt
+#/sbin/modprobe i2c-dev
+
+# Start openssh daemon
+/usr/local/etc/init.d/openssh start
+
+# ------ Put other system startup commands below this line
+alsactl restore
+
+wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
+udhcpc -i wlan0
+
+screen -dmS ntp ntpd -dn -p ptbtime1.ptb.de
+
+sudo -u tc mpd /home/tc/.mpd/mpd.conf
+sudo -u tc screen -dmS bootyplay sh /home/tc/play.sh
+
diff --git a/download_playlists.sh b/download_playlists.sh
new file mode 100755 (executable)
index 0000000..a773ede
--- /dev/null
@@ -0,0 +1,4 @@
+cd ~/Playlists
+    for url in $(cat $HOME/alle_antennen.txt); do wget -qc $url; done
+    mpc update
+cd ~
\ No newline at end of file
diff --git a/install_prereqs.sh b/install_prereqs.sh
new file mode 100755 (executable)
index 0000000..062ba22
--- /dev/null
@@ -0,0 +1,21 @@
+source ./util.sh
+
+# dev and platform setup
+tce-load -wi vim squashfs-tools
+# alsa setup
+tce-load -wi alsa alsa-utils
+
+# should serve as replacement for calling "alsamixer", I guess...
+amixer
+
+ensure var/lib/alsa /opt/.filetool.lst
+ensure etc/asound.conf /opt/.filetool.lst
+#ensure "alsactl restore" /opt/bootlocal.sh
+
+# persist alsa runtime
+filetool.sh -b
+
+# build dependencies
+tce-load -wi compiletc meson ninja
+tce-load -wi boost-dev curl-dev expat2-dev faad2-dev git glib2-dev icu-dev lame-dev libid3tag-dev libmad-dev libsndfile-dev liblz4 mpg123-dev sqlite3-dev
+
diff --git a/make_mpd.sh b/make_mpd.sh
new file mode 100755 (executable)
index 0000000..d2901d7
--- /dev/null
@@ -0,0 +1,40 @@
+BUILDROOT=$HOME
+
+set -xe
+
+source ./util.sh
+
+install libmpdclient https://github.com/MusicPlayerDaemon/libmpdclient "v2.22"
+sh $HOME/remount_ext.sh libmpdclient
+wget -O - http://slackware.cs.utah.edu/pub/slackware/slackware-current/source/l/libid3tag/id3tag.pc \
+       | sed 's#prefix=/usr#prefix=/usr/local#' \
+       | sudo tee /usr/local/lib/pkgconfig/id3tag.pc
+install mpd https://github.com/MusicPlayerDaemon/mpd "v0.23.17" output/release "-Dlibmpdclient=enabled -Dadplug=disabled -Dao=disabled -Dbzip2=disabled -Ddsd=false -Dffmpeg=disabled -Dfluidsynth=disabled -Dgme=disabled -Did3tag=enabled -Dipv6=disabled -Djack=disabled -Dmikmod=disabled -Dmms=disabled -Dmodplug=disabled -Dmpcdec=disabled -Dnfs=disabled -Dopenal=disabled -Dopus=disabled -Doss=disabled -Dpipe=false -Dpulse=disabled -Drecorder=false -Dshine=disabled -Dshout=disabled -Dsidplay=disabled -Dsmbclient=disabled -Dsoundcloud=disabled -Dsoxr=disabled -Dtwolame=disabled -Dupnp=disabled -Dwavpack=disabled -Dwave_encoder=false -Dwildmidi=disabled -Dzzip=disabled -Dzeroconf=disabled"
+install mpd_client https://github.com/MusicPlayerDaemon/mpc "v0.35"
+
+mkdir -p $HOME/.mpd $HOME/.local/state/mpd
+
+cat << EOF > $HOME/.mpd/mpd.conf
+bind_to_address                        "any"
+port                                   "6600"
+
+db_file                         "$HOME/.local/state/mpd/database"
+state_file                      "$HOME/.local/state/mpd/state"
+playlist_directory              "$HOME/Playlists"
+music_directory                 "$HOME/Music"
+
+input {
+        plugin "curl"
+}
+audio_output {
+       type            "alsa"
+       name            "My ALSA Device"
+}
+
+EOF
+
+if which filetool.sh; then
+       echo "sudo -u tc mpd /home/tc/.mpd/mpd.conf" | tee -a /opt/bootlocal.sh
+       filetool.sh -b
+fi
+
diff --git a/play.sh b/play.sh
new file mode 100755 (executable)
index 0000000..088e3e6
--- /dev/null
+++ b/play.sh
@@ -0,0 +1,5 @@
+
+while ! ping -c1 8.8.8.8; do sleep 1; done
+while ! mpc status | grep playing; do
+       mpc play
+done
diff --git a/remount_ext.sh b/remount_ext.sh
new file mode 100755 (executable)
index 0000000..b0ffac0
--- /dev/null
@@ -0,0 +1,15 @@
+EXT=$1
+
+set -xe
+
+if [ ! -e /tmp/tcloop/$EXT ]; then
+        echo "Extension $EXT not loaded yet!"
+else
+       sudo umount -d /tmp/tcloop/$EXT || echo "Info: $EXT not mounted yet"
+       sleep 1
+       sudo rm -f "/usr/local/tce.installed/$EXT"
+       sleep 1
+fi
+
+tce-load -i $EXT
+sleep 1
\ No newline at end of file
diff --git a/resize.sh b/resize.sh
new file mode 100755 (executable)
index 0000000..900cbd4
--- /dev/null
+++ b/resize.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Check if device argument is provided
+if [ $# -ne 1 ]; then
+    echo "Usage: $0 <partition>"
+    exit 1
+fi
+
+PARTITION=$1
+DEVICE=$(sed 's/[0-9]*$//g' <<< $PARTITION)
+
+# Check if device exists
+if ! [ -b "$PARTITION" ]; then
+    echo "Device $PARTITION not found"
+    exit 1
+fi
+
+# Get the partition number
+PARTITION_NUMBER=$(echo "$PARTITION" | grep -oE '[0-9]+$')
+
+
+# Resize partition and filesystem
+if [[ "$(grep -c $PARTITION /etc/mtab)" -gt 0 ]]; then
+    sudo umount $PARTITION
+fi
+sudo parted -s "$DEVICE" resizepart "$PARTITION_NUMBER" 100%
+sudo e2fsck -fy "$PARTITION" || true
+sudo resize2fs "$PARTITION"
diff --git a/run_once.sh b/run_once.sh
new file mode 100755 (executable)
index 0000000..b17f2df
--- /dev/null
@@ -0,0 +1,51 @@
+if [ -f $HOME/.install_in_progress ]; then
+    echo "broken installation!"
+    exit 1
+elif [ -f $HOME/.installed ]; then
+    echo "installation already done"
+    exit 0
+fi
+
+# wait for cert generation
+
+while ! pgrep sshd; do sleep 5; done
+
+sudo chown -R tc:staff $HOME/.ssh
+touch $HOME/.install_in_progress
+
+tce-load -wi screen
+
+TERM=xterm
+[ -f .installed_prereqs ] || screen -L -Logfile install_prereqs.log sh -xe $HOME/install_prereqs.sh && touch .installed_prereqs
+[ -f .installed_mpd ] || screen -L -Logfile make_mpd.log sh -xe $HOME/make_mpd.sh && touch .installed_mpd
+
+$HOME/remount_ext.sh mpd
+$HOME/remount_ext.sh mpd_client
+
+# sudo alsactl restore
+
+touch $HOME/.installed
+rm $HOME/.install_in_progress
+
+source ./util.sh
+
+ensure "#mpc vol 20" $HOME/.profile
+ensure "mpc clear; mpc load oldie-antenne" $HOME/.profile
+ensure "mpc play" $HOME/.profile
+
+mkdir -p ~/Playlists ~/Music
+
+# will filetool preserve empty folders?
+touch ~/Playlists/.empty
+touch ~/Music/
+
+mpd .mpd/mpd.conf
+
+$HOME/download_playlists.sh
+
+mpc load classic-rock-live
+mpc vol 10
+mpc play
+sleep 10
+filetool.sh -b
+sudo reboot
diff --git a/setup.sh b/setup.sh
new file mode 100755 (executable)
index 0000000..66dd025
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,37 @@
+DISK=/dev/sdb
+WORKROOT=/mnt/sdcard
+IMAGE=/files/Daten/Images/Software/piCore-16.0.0.img.gz
+
+[ -b $DISK ] || exit 3
+
+pv $IMAGE | gunzip -c | sudo dd of=$DISK
+bash -xe resize.sh ${DISK}2
+
+sudo mount ${DISK}2 $WORKROOT
+
+trap "sudo umount $WORKROOT" EXIT
+
+sudo gunzip $WORKROOT/tce/mydata.tgz
+# uid workaround, tcl 16 uses 1001
+sudo chown $(id -u) $WORKROOT/tce/mydata.tar
+
+if [ ! -f authorized_keys ]; then 
+    cat ~/.ssh/*.pub > authorized_keys
+fi
+
+# dont run in home folder, dumbass
+[ -f .profile ] && exit 2
+
+tar -Oxf /mnt/sdcard/tce/mydata.tar home/tc/.profile > .profile
+
+echo '/home/tc/run_once.sh' >> .profile
+tar --owner=1001 -uvf $WORKROOT/tce/mydata.tar authorized_keys --transform='s|^|home/tc/.ssh/|'
+tar --owner=1001 -uvf $WORKROOT/tce/mydata.tar .profile alle_antennen.txt *.sh --transform='s|^|home/tc/|'
+tar --owner=1001 -uvf $WORKROOT/tce/mydata.tar wpa_supplicant.conf --transform='s|^|etc/wpa_supplicant/|'
+
+rm .profile
+
+sudo gzip $WORKROOT/tce/mydata.tar
+sudo chown 1001 $WORKROOT/tce/mydata.tar.gz
+sudo mv $WORKROOT/tce/mydata.tar.gz $WORKROOT/tce/mydata.tgz
+
diff --git a/setup_wifi.sh b/setup_wifi.sh
new file mode 100755 (executable)
index 0000000..a135d28
--- /dev/null
@@ -0,0 +1,8 @@
+source ./util.sh
+
+tce-load -wi wpa_supplicant wireless_tools.tcz firmware-rtlwifi util-linux
+
+ensure "wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B && sleep 5" /opt/bootlocal.sh
+ensure "udhcpc -i wlan0" /opt/bootlocal.sh
+
+
diff --git a/util.sh b/util.sh
new file mode 100755 (executable)
index 0000000..009edd7
--- /dev/null
+++ b/util.sh
@@ -0,0 +1,30 @@
+function ensure {
+    grep -q "$1" "$2" || (echo "$1" | sudo tee -a "$2")
+}
+
+function install {
+       cd $BUILDROOT
+       extname=$1
+       git_url=$2
+    git_rev=$3
+       outdir=${4:-"output"}
+       extbuildopts=${5:-""}
+
+       git_name=$(echo $git_url | rev | cut -d/ -f1 | rev)
+       prefix=/tmp/${extname}Ext
+
+       [ -d "${git_name}" ] || git clone $git_url -b $git_rev
+       cd $git_name
+       # ignore git from backup
+       echo "$PWD" | sed 's#^/##' | sudo tee -a /opt/.xfiletool.lst
+
+       mkdir -p $prefix
+       meson setup . $outdir --buildtype=release --prefix=$prefix/usr/local --reconfigure $extbuildopts
+
+       ninja -C $outdir
+       ninja -C $outdir install
+
+       mksquashfs $prefix /mnt/mmcblk0p2/tce/optional/${extname}.tcz
+
+       grep -q "^${extname}.tcz$" /mnt/mmcblk0p2/tce/onboot.lst || echo "${extname}.tcz" | sudo tee -a /mnt/mmcblk0p2/tce/onboot.lst
+}