Inhaltsverzeichnis

Cubietruck als headless Video Disk Recorder (VDR)

Installation von ARMbian (GNU Debian 10.x aka. Buster) auf dem Cubietruck (ARMv7 AllWinner A20)

Quellen

ARMbian 10.x aka. Buster Installation

Installation wie unter [2] beschrieben durchführen.

wget https://dl.armbian.com/cubietruck/nightly/Armbian_5.97.190916_Cubietruck_Debian_buster_dev_5.3.0_minimal.7z
7z e Armbian_5.97.190916_Cubietruck_Debian_buster_dev_5.3.0_minimal.7z
sudo su
dd bs=1M if=Armbian_5.97.190916_Cubietruck_Debian_buster_dev_5.3.0_minimal.img of=/dev/sdc

Konfiguration des Grundsystems

Erster Login: Root Password setzen und einen normalen Benutzer anlegen …

#login als root, PW: 1234, via SSH
ssh -l root <CUBIE-IP>

Zum SSH-Login ohne Passworteingabe eine SSH Schüsseldatei auf den Cubietruck kopieren

ssh-copy-id -i ~/.ssh/cubietruck.wg.pub root@<CUBIE-IP>
# dann immer mit: 
ssh cubietest
#
install_system.sh
#!/bin/bash
# System aktualisieren und zwei wichtige Tools installieren
apt-get -y update
apt-get -y upgrade
apt-get -y install mc aptitude
#
# HostAP & WPA Support (WLAN) abschalten - wird nicht benötigt ...
systemctl stop hostapd
systemctl disable hostapd
systemctl stop wpa_supplicant
systemctl disable wpa_supplicant
#
# Zeitzone auf Europa - Berlin einstellen:
timedatectl set-timezone Europe/Berlin
# Check mit:
date
# Systemsprache auf "Deutsch" ändern damit VDRAdmin-AM auch 'schön' aussieht und Umlaute sowohl im EPG als auch in den Aufnahmen korrekt dargestellt werden:
sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
update-locale LANG=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 LANGUAGE=de_DE.UTF-8
sed -i 's/LC_ALL="C"/LC_ALL=de_DE.UTF-8/g' /etc/environment
echo "LANG=de_DE.UTF-8" >> /etc/environment

Netzwerkkonfiguration

install_network.sh
#!/bin/bash
# Statische Netzwerkkonfiguration --> Networkmanager abschalten - wird bei mir nicht benötigt
systemctl stop NetworkManager
systemctl disable NetworkManager
 
# Netzwerkkonfiguration schreiben:
cat << EOF >> /etc/network/interfaces
 
auto eth0
iface eth0 inet static
	address 192.168.100.101
	broadcast 192.168.100.255
	netmask 255.255.255.0
	gateway 192.168.100.1
	dns-nameservers 192.168.100.1
EOF
 
# Netzwerkdienste neu starten
systemctl restart networking
systemctl restart resolvconf

NTP Server ändern

# eigenen NTP Server eintragen:
grep -v '^pool' /etc/chrony/chrony.conf > /etc/chrony/chrony.tmp; echo "server 192.168.100.1" >> /etc/chrony/chrony.tmp; mv /etc/chrony/chrony.tmp /etc/chrony/chrony.conf

Festplatte einbinden

mount_hdd.sh
#!/bin/bash
# Die eindeutige ID meiner Festplatte ermitteln und damit einen Eintrag zum mounten beim Systemstart in der ''fstab'' erstellen:
UUID=`blkid -o value -s UUID /dev/sda1`; echo "UUID=$UUID /mnt/sda1 ext4 defaults 1 1" >> /etc/fstab
#UUID=`blkid | grep -i sda1 | cut -d'"' -f2`; echo "UUID=$UUID  /mnt/sda1 ext4 defaults 1 1" >> /etc/fstab
#
# HOME-Verzeichnis umleiten damit ich mehr Platz zur Verfügung habe ;-)
mkdir -p /mnt/sda1
mount -a
mkdir -p /mnt/sda1/christoph
cd /home/
mv christoph christoph_orig
ln -s /mnt/sda1/christoph christoph
chown -R christoph:christoph /mnt/sda1/christoph
cd /home/christoph_orig
find . -depth -print | cpio -pdm --quiet ../christoph/

Installation Sundtek Treiber

install_sundtek.sh
#!/bin/bash
mkdir -p sundtek
cd sundtek
# Installations-Script vom Hersteller Sundtek herunter laden und ausführen:
wget http://www.sundtek.de/media/sundtek_netinst.sh
chmod +x sundtek_netinst.sh
./sundtek_netinst.sh -easyvdr -nolirc
/opt/bin/mediaclient --dtvtransfermode=bulk -d /dev/dvb/adapter0/frontend0
# Reconnect Tuner #1
/opt/bin/mediaclient --dtvtransfermode=bulk -d /dev/dvb/adapter1/frontend0
# Reconnect Tuner #2
#
# VDR erneut starten wenn DVB-Tuner Treiber geladen sind:
echo "device_attach=service vdr restart" >> /etc/sundtek.conf

VDR installieren

install_vdr.sh
#!/bin/bash
# VDR, StreamDev-Server, VNSI-Plugin, EPGSearch und VDRAdmin-AM installieren:
apt-get -y install vdr vdr-plugin-streamdev-server vdr-plugin-vnsiserver vdradmin-am vdr-plugin-epgsearch w-scan
# VDR stoppen damit weitere Änderungen an den Konfigurationsdateien erfolgen können.
/etc/init.d/vdr stop

VDR Konfiguration

configure_vdr.sh
# Verzeichnis für die Aufnahmen anlegen
mkdir -p /mnt/sda1/video0
chown -R vdr:vdr /mnt/sda1/video0/
chmod g+w /mnt/sda1/video0/
 
# VDR Konfigurationsdateien (nach-) bearbeiten:
sed -i 's/ENABLED="0"/ENABLED="1"/g' /etc/default/vdradmin-am
sed -i 's/UpdateChannels = 5/UpdateChannels = 0/g' /var/lib/vdr/setup.conf
sed -i 's/--video=\/var\/lib\/video/--video=\/mnt\/sda1\/video0/g' /etc/vdr/conf.d/00-vdr.conf
sed -i 's/--lirc/#--lirc/g' /etc/vdr/conf.d/00-vdr.conf
sed -i 's/--vfat/#--vfat/g' /etc/vdr/conf.d/00-vdr.conf
 
# Aktionen im Anschluss einer Aufnahme: Zugriffsrechte ändern:
cp /etc/vdr/recording-hooks/R90.custom /etc/vdr/recording-hooks/R90.custom_orig
sed -i '/ENDED/a \ \ \ \ \ \ \ \ chmod -R g+w $2/..' /etc/vdr/recording-hooks/R90.custom
 
# Konfiguration von VDRAdmin-AM anpassen:
sed -i 's/PASSWORD = linvdr/PASSWORD = vdr/g' /var/lib/vdradmin-am/vdradmind.conf
sed -i 's/USERNAME = linvdr/USERNAME = vdr/g' /var/lib/vdradmin-am/vdradmind.conf
if [[ -z `grep -w "LANG" /var/lib/vdradmin-am/vdradmind.conf` ]]; then
  echo "LANG = de_DE.utf8" >> /var/lib/vdradmin-am/vdradmind.conf
else
  sed -i 's/LANG = en_US.utf8/LANG = de_DE.utf8/g' /var/lib/vdradmin-am/vdradmind.conf
  sed -i 's/LANG = /LANG = de_DE.utf8/g' /var/lib/vdradmin-am/vdradmind.conf
fi
sed -i 's/SERVERHOST = ::/SERVERHOST = 0.0.0.0/g' /var/lib/vdradmin-am/vdradmind.conf
 
if [[ -z `grep -w "LOCAL_NET" /var/lib/vdradmin-am/vdradmind.conf` ]]; then
  echo "LOCAL_NET = 192.168.0.0/16" >> /var/lib/vdradmin-am/vdradmind.conf
else
  sed -i 's/LOCAL_NET = 0.0.0.0\/32/LOCAL_NET = 192.168.0.0\/16/g' /var/lib/vdradmin-am/vdradmind.conf
fi
echo "VIDEODIR = /mnt/sda1/video0" >> /var/lib/vdradmin-am/vdradmind.conf
echo "TM_MARGIN_BEGIN = 10" >> /var/lib/vdradmin-am/vdradmind.conf
sed -i 's/GUEST_ACCOUNT = 0/GUEST_ACCOUNT = 1/g' /var/lib/vdradmin-am/vdradmind.conf
echo "PASSWORD_GUEST = gast" >> /var/lib/vdradmin-am/vdradmind.conf
echo "USERNAME_GUEST = gast" >> /var/lib/vdradmin-am/vdradmind.conf
 
# Lokale Netzwerke zulassen:
echo "192.168.0.0/16" >> /etc/vdr/svdrphosts.conf 
sed -i 's/#192.168.100.0\/24/192.168.0.0\/16/g' /etc/vdr/plugins/streamdevhosts.conf
sed -i 's/192.168.0.0\/24/192.168.0.0\/16/g' /etc/vdr/plugins/vnsiserver/allowed_hosts.conf

Sendersuchlauf manuell starten

sudo su
#apt-get install w-scan
# w_scan -fc -c DE >> /root/channels.conf
w_scan -fc -c DE >> /root/`date +%Y%m%d`_channels.conf

angepasste Kanalliste verwenden

Kanalliste kopieren nach /var/lib/vdr/channels.conf

mk_channels_conf.sh
#!/bin/bash
# Backup der Originl-Kanalliste anlegen:
cp /var/lib/vdr/channels.conf /var/lib/vdr/channels_`date +%Y%m%d`.conf
 
# meine persönliche Kanalliste erstellen:
cat << EOF > /var/lib/vdr/channels.conf
Das Erste HD;ARD:330000:M256:C:6900:5101=27:0;5102=@106,5103=@106:5104;5105:0:11100:1:1051:0
ZDF HD;ZDFvision:450000:M256:C:6900:6110=27:0;6120=@106,6121=@106,6123=@106:6130;6131:0:11110:1:1079:0
NDR FS NDS HD;ARD:458000:M256:C:6900:5221=27:0;5222=@106,5223=@106:5224;5225:0:10327:1:1073:0
SAT.1;Digital Free:122000:M64:C:6900:2701=2:2702=ger@3;2703=@106:2704:0:53626:61441:10000:0
RTL;Digital Free:122000:M64:C:6900:1401=2:1402=ger@3;1403=@106:1404;6261:0:53601:61441:10000:0
ProSieben;Digital Free:442000:M256:C:6900:2201=2:2202=ger@3;2203=@106:2204:0:53621:61441:10008:0
VOX;Digital Free:394000:M256:C:6900:1701=2:1702=ger@3:1704;1700:0:53604:61441:10003:0
kabel eins;Digital Free:442000:M256:C:6900:2301=2:2302=ger@3:2304:0:53622:61441:10008:0
kabel eins Doku;Digital Free:610000:M64:C:6900:1511=2:1512=ger@3:1514:0:50122:61441:10021:0
3sat HD;ZDFvision:562000:M256:C:6900:6691=27:0;6692=@106,6693=@106,6697=@106:6694;6690:0:11150:61441:10017:0
arte HD;ARD:418000:M256:C:6900:6661=27:0;6662=@106,6663=@106,6669=@106:6664;6665,6666:0:11120:61441:10014:0
PHOENIX HD;ARD:474000:M256:C:6900:581=27:0;582=@106,583=@106:584:0:10331:61441:10009:0
zdf_neo HD;ZDFvision:474000:M256:C:6900:541=27:0;542=@106,543=@106,547=@106:544;540:0:11130:61441:10009:0
ZDFinfo HD;ZDFvision:450000:M256:C:6900:6710=27:0;6720=@106,6721=@106,6723=@106:6730;6731:0:11170:1:1079:0
tagesschau24 HD;Digital Free:586000:M256:C:6900:1221=27:0;1222=@106,1223=@106:1224:0:50062:61441:10018:0
n-tv;Digital Free:394000:M256:C:6900:1901=2:1902=ger@3,1903=qaa@4:1904:0:53606:61441:10003:0
N24 Doku;Digital Free:610000:M64:C:6900:1471=2:1472=ger@3:1474:0:51037:61441:10021:0
ONE HD;Digital Free:570000:M256:C:6900:1721=27:0;1722=@106,1723=@106:1724;1720:0:10376:61441:10023:0
ARD alpha HD;Digital Free:586000:M256:C:6900:1211=27:0;1212=@106,1213=@106:1214;1210:0:50061:61441:10018:0
KiKA HD;ZDFvision:474000:M256:C:6900:431=27:0;432=@106,433=@106:434;430:0:11160:61441:10009:0
TOGGO plus;Digital Free:402000:M256:C:6900:591=2:592=ger@3:0:0:53326:61441:10002:0
ProSieben MAXX;Digital Free:562000:M256:C:6900:6431=2:6432=ger@3;6433=@106:6434:0:53009:61441:10017:0
Welt der Wunder TV;Digital Free:610000:M64:C:6900:1421=2:1422=ger@3:0:0:51043:61441:10021:0
BR Fernsehen Süd HD;ARD:338000:M256:C:6900:5201=27:0;5202=@106,5203=@106:5204;5205:0:10325:1:1101:0
SR Fernsehen HD;Digital Free:586000:M256:C:6900:1271=27:0;1272=@106,1273=@106:1274;1270:0:50064:61441:10018:0
rbb Berlin HD;ARD:450000:M256:C:6900:5311=27:0;5312=@106,5313=@106:5314;5315:0:10351:1:1079:0
NDR FS HH HD;ARD:338000:M256:C:6900:5241=27:0;5242=@106,5243=@106:5244;5245:0:10329:1:1101:0
MDR Sachsen HD;ARD:338000:M256:C:6900:5321=27:0;5322=@106,5323=@106:5324;5325:0:10352:1:1101:0
SWR RP HD;ARD:330000:M256:C:6900:5131=27:0;5132=@106,5133=@106:5134;5135:0:10304:1:1051:0
WDR HD Köln;ARD:330000:M256:C:6900:5501=27:0;5502=@106,5503=@106:5504;5505:0:28325:1:1051:0
hr-fernsehen HD;ARD:418000:M256:C:6900:6551=27:0;6552=@106,6553=@106:6554;6550:0:10355:61441:10014:0
sixx;Digital Free:442000:M256:C:6900:1181=2:1182=ger@3:1184:0:50700:61441:10008:0
TELE 5;Digital Free:442000:M256:C:6900:411=2:412=ger@3:414:0:53002:61441:10008:0
SUPER RTL;Digital Free:394000:M256:C:6900:1501=2:1502=ger@3:1504;1500:0:53602:61441:10003:0
RTL II;Digital Free:394000:M256:C:6900:1601=2:1602=ger@3:1604;1600:0:53603:61441:10003:0
DMAX;Digital Free:466000:M256:C:6900:2291=2:2292=ger@3:2294:0:53617:61441:10007:0
SAT.1 Gold;Digital Free:538000:M256:C:6900:2431=2:2432=deu@3:2434:0:53324:61441:10022:0
EOF
 
chown vdr:vdr /var/lib/vdr/channels.conf

Radiorecorder mit Web-GUI

sudo su
apt-get -y install lighttpd streamripper at
systemctl status lighttpd
usermod -G vdr -a www-data
# PHP7.x
apt-get -y install php-common php-cgi php
lighty-enable-mod fastcgi
service lighttpd force-reload
lighty-enable-mod fastcgi-php
service lighttpd force-reload
systemctl restart lighttpd
echo "<?php phpinfo(); ?>" >> /var/www/html/phpinfo.php
# Im Browser öffnen: http://VDR-IP/phpinfo.php
# www-data aus /etc/at.deny entfernen
sed -i -e '/www-data/d' /etc/at.deny
cd ~
wget https://netcologne.dl.sourceforge.net/project/radiorecwebgui/0.3.x/radiorecorder_0.3.1.tar.gz
tar xfz radiorecorder_0.3.1.tar.gz
mkdir -p /var/www/html/radiorecorder
cp -R radiorecorder_0.3.1/* /var/www/html/radiorecorder/
touch /var/www/html/radiorecorder/res/streams.txt

/var/www/html/radiorecorder/res/streams.txt

streams.txt
NDR2;http://ndr-ndr2-niedersachsen.cast.addradio.de/ndr/ndr2/niedersachsen/mp3/128/stream.mp3
NDR Kultur;http://ndr-ndrkultur-live.cast.addradio.de/ndr/ndrkultur/live/mp3/128/stream.mp3
NDR Info;http://ndr-ndrinfo-niedersachsen.cast.addradio.de/ndr/ndrinfo/niedersachsen/mp3/128/stream.mp3
N-Joy;http://ndr-njoy-live.cast.addradio.de/ndr/njoy/live/mp3/128/stream.mp3
NDR Blue;http://ndr-ndrblue-live.cast.addradio.de/ndr/ndrblue/live/mp3/128/stream.mp3
NDR Plus;http://ndr-ndrplus-live.cast.addradio.de/ndr/ndrplus/live/mp3/128/stream.mp3
chown -R www-data:www-data /var/www/html/
mkdir /mnt/sda1/video0/radiorecorder
chown -R vdr:vdr /mnt/sda1/video0/radiorecorder/
chmod -R g+w /mnt/sda1/video0/radiorecorder/
systemctl restart lighttpd
# Im Browser öffnen: http://<VDR-IP/radiorecorder/

/var/www/html/radiorecorder/res/settings.php

settings.php
<?php
 
class Settings {
 
  public static $siteRoot = '/var/www/html/radiorecorder';
  public static $recordedFilesDestination = '/mnt/sda1/video0/radiorecorder';
  public static $language = 'de'; //"de" for german or "en" for english
  public static $locale = 'C'; // default is "C"; other possible locales: "de_AT.UTF-8" to enable all corresponding characters for the filename
  public static $defaultStreamripperParams = '';	// adds streamripper params to each call
  public static $addDatePrefixToFilename = null;	// prefix format (e.g. 'Y-m-d') or null if no prefix to add
  public static $postCommand = '';	// command to be executed after the recording is finished
  public static $logThreshold = 3; //Level of log messages, possible values : LEVEL_DEBUG=4, LEVEL_INFO=3, LEVEL_WARN=2, LEVEL_ERROR=1
 
}
 
?> 

SAMBA installieren und einrichten

apt-get -y install samba cifs-utils
adduser christoph
smbpasswd -a christoph
usermod -G vdr -a christoph
adduser gast
smbpasswd -a gast
systemctl restart smbd

Samba Konfiguration

cp /etc/samba/smb.conf /etc/samba/smb.conf_orig
mcedit /etc/samba/smb.conf
smb.conf
#======================= Global Settings =======================
 
[global]
   workgroup = WG
   server string = %h server
   wins support = no
 
   wins server = 192.168.100.1
   dns proxy = no
   name resolve order = lmhosts host wins bcast
   unix extensions = no
 
#### Networking ####
;   interfaces = 127.0.0.0/8 eth0
;   bind interfaces only = yes
 
#### Logging ####
   log file = /var/log/samba/log.%m
 
# Cap the size of the individual log files (in KiB).
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
 
####### Authentication #######
   security = user
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
 
#======================= Share Definitions =======================
[homes]
   comment = Home Directories
   browseable = yes
   writeable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S
 
[Aufnahmen]
   comment = VDR Aufnahmen
   path = /mnt/sda1/video0
   browseable = yes
   writeable = yes
   read only = no
   #create mask = 0700
   #directory mask = 0700
   #valid users = %S
   create mask = 0664
   directory mask = 0775
   force group = users
   follow symlinks = yes
   wide links = yes
 
 load printers = no
 printing = bsd
 printcap name = /dev/null
 disable spoolss = yes

Alles zusammen in einem Script...

wget -O install_all.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=19" && chmod +x install_all.sh && ./install_all.sh
install_all.sh
#!/bin/bash
echo "Lade Installations-Scripte herunter ..."
wget -O install_system.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=3" && chmod +x install_system.sh
wget -O install_network.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=4" && chmod +x install_network.sh
wget -O mount_hdd.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=6" && chmod +x mount_hdd.sh
wget -O install_sundtek.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=7" && chmod +x install_sundtek.sh
wget -O install_vdr.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=8" && chmod +x install_vdr.sh
wget -O configure_vdr.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=9" && chmod +x configure_vdr.sh
wget -O mk_channels_conf.sh "https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_armbian_buster?do=export_code&codeblock=11" && chmod +x mk_channels_conf.sh
echo " ... fertig. Starte System- und VDR Installation..."
read -n1 -rsp $'Press any key to start system installation or Ctrl+C to exit...\n'
./install_system.sh
read -n1 -rsp $'Press any key to start network configuration or Ctrl+C to exit...\n'
./install_network.sh
read -n1 -rsp $'Press any key to mount hdd, configure \"video0\" directory and move \"home\" directory or Ctrl+C to exit...\n'
./mount_hdd.sh
read -n1 -rsp $'Press any key to install Sundtek DVB-C driver or Ctrl+C to exit...\n'
./install_sundtek.sh
read -n1 -rsp $'Press any key to install VDR and VDRadmin-AM or Ctrl+C to exit...\n'
./install_vdr.sh
read -n1 -rsp $'Press any key to configure VDR and VDRadmin-AM or Ctrl+C to exit...\n'
./configure_vdr.sh
read -n1 -rsp $'Press any key to generate \"channels.conf\" file or Ctrl+C to exit...\n'
./mk_channels_conf.sh
echo "Done!"
read -n1 -rsp $'Press any key to reboot your system now (recommended!) or Ctrl+C to exit...\n'
shutdown -r now