Raspberry Pi
====== RaspEX ======
===== Installation =====
* Write image onto MicroSD
* Boot, take note of MAC addresses and add to LAN DHCP/DNS accordingly
* Run the ''resize_rootfs.sh'' script as ''root'' (its in ''/root'')
* Change hostname (in both ''/etc/hostname'' and ''/etc/hosts'') and reboot
===== Initialization Tips & Tricks =====
==== Date/Time ====
* Set timezone: ''dpkg-reconfigure tzdata''
* Calibrate date/time: ''ntpdate us.pool.ntp.org''
* Edit ''/etc/ntp.conf'' and start NTPD with ''/etc/init.d/ntp start''
==== Migrate user(s) ====
* Create desired login(s)groupadd -g 1xx0 yourgroup
useradd -u 1xx0 -g 1xx0 -d /home/yourlogin -s /bin/bash -c "Your Name" -m yourlogin
* Add login(s) to groups (use ''id -a raspex'' to identify list of groups needed for admin login)usermod -a -G list,of,group,names yourlogin
* Add login to ''/etc/sudoers''
* Delete default user: ''deluser raspex ; rm -rf /home/raspex''
==== Disable Auto-Login ====
Edit ''/etc/slim.conf'' and change the ''auto_login'' value to ''no'' \\
==== Details ... ====
* Wallpaper location: ''/usr/share/images/bunsen/wallpapers/default''
* Disable conky: ''apt remove --purge conky conky-all''
==== Packages ====
* ''apt install xscreensaver''
* ''apt install git''
====== Notes ======
===== Basic Installation =====
* Get raspbian image (typically a ZIP from [[https://www.raspberrypi.org/downloads/raspbian]])
* Unzip image, write to SD card:dd if=raspbiandownload.img of=/dev/sdX bs=4M conv=fsync
* Default login is ''pi'' with password ''raspberry''
===== misc =====
* Change root and pi passwords
* Enable SSH at boot, use raspi-config in the "Interfacing Options" section
* Add user, ensure groups, and sudoers
* Update host name in:
* ''/etc/hostname''
* ''/etc/hosts''
* If necesary, resize root partition, reboot, resize fs
* Install (via apt-get) some basics:
* ksh
* htop
* xterm
* rsync
* git
* libudev-dev
* libusb-1.0-0-dev
* libfox-1.6-dev
* autotools-dev
* autoconf
* automake
* libtool
* xfe (optional)
===== MythTV Front End =====
See original for complete reference: [[https://www.mythtv.org/wiki/Raspberry_Pi]]
* Configure gpu_mem=256 using ''raspi-config''
* Configure this to be run at each boot (put in ''/etc/rc.local''):echo "performance" | /usr/bin/tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
* Disable pulseaudio
* In ''/etc/pulse/client.conf'' set ''autospawn=no'' and ''daemon-binary=/bin/true''
* Install MythTV Light per instructions at [[https://www.mythtv.org/wiki/MythTV_Light]]
* In ''/etc/apt/sources.list'' add a line like:deb http://dl.bintray.com/bennettpeter/deb stretch myth28
* Add key:wget -O - https://bintray.com/user/downloadSubjectPublicKey?username=bintray | apt-key add -
* ''apt update''
* ''apt install mythtv-light''
* ''apt install mythplugins-light''
===== USB Relay =====
* Make a copy of /var to /home/sys
* Prune /home/sys/var
* Set up tmpfs mounts, like (pay attention to mode and size): \\ ''tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0''
* /tmp, no mode, size=100M
* /var/tmp, no mode, size=30M
* /var/log, mode=0755, size=100M
* /var/spool/mqueue, mode=700, gid=12, size=30M
* Clone source for USB relay control: git clone git://github.com/signal11/hidapi.git
git clone https://github.com/darrylb123/usbrelay.git
* Build HIDAPI, cd to source dir and:./bootstrap
./configure --prefix=/usr --enable-testgui
make
make install
You need HIDAPI and USBRELAY: \\
git clone git://github.com/signal11/hidapi.git
Check out the readme, and install dependencies before installing. \\
then: git clone https://github.com/darrylb123/usbrelay.git
Then, in usbrelay folder: gcc -o usbrelay usbrelay.c -lhidapi-libusb
Then do: ldconfig
Read more here:
* http://www.signal11.us/oss/hidapi/
* https://github.com/darrylb123/usbrelay
To get status: ./usbrelay 2>/dev/null
\\
To get status in bash script: \\
$ eval $(sudo ./usbrelay 2>/dev/null)
$ echo $PSUIS_2
Turn on: /usbrelay EO5ZA_1=1
Turn off: /usbrelay EO5ZA_1=0