# RIP ## Description **Rip** is a dedicated playout system wich launch a video using a PIR sensor on a [Raspberry Pi 400](https://www.raspberrypi.com/products/raspberry-pi-400/). It's based on the great work of [Alex Lubbock](https://alexlubbock.com/) with [vidlooper](https://github.com/alubbock/rpi-vidlooper). A **really light** apache *webapp* provide the ability to change the movie and the splashscreen. So the wifi interface of the raspberry pi 400 is turned into an access point. ## setup 1. setup hostname and basic raspbian setup By default raspberry OS (aka raspbian) boot in graphical mode in it's full version. *I think that the lite version does not.* ```console pi@RIP2:~ $ sudo raspi-config ``` In raspi-config change default password for security. 1 System Options > S3 Password Then change hostname to the one you want. 1 System Options > S4 Hostname Change default Boot to autologin console 1 System Options > S5 Autologin Now for the display properties, if you have some issues with a black border and the picture in center of it, go to. 2 Display Options >> D2 Underscan >> Yes Set the GPU memory amount to be enough for display HD video or more if you need. Be careful with this parameter because it's a fine tuned setting and may result in some performance issues. 4 Performance Options >> P2 Memory >> something like 512 Mo or 256 Mo will do. You can hang around to see other parameters but for now we're done with those basics setup. 2. update / upgrade raspbian Raspbian has release a new version so *--allow-releaseinfo-change* option is important and need to be done 2 times. ```console pi@RIP2:~ $ sudo apt-get update --allow-releaseinfo-change pi@RIP2:~ $ sudo apt-get update --allow-releaseinfo-change pi@RIP2:~ $ sudo apt-get upgrade pi@RIP2:~ $ sudo apt-get dist-upgrade ``` 3. Installing software ```console pi@RIP2:~ $ sudo apt-get install hostapd dnsmasq apache2 vsftpd php omxplayer fbi pi@RIP2:~ $ sudo pip3 install vidlooper ``` 4. Configure Wifi AP, dnsmasq and IP settings Many thanks to t2age [link on his github repo](https://github.com/t2age/wl-p2p-wifi) for the Wifi AP part. Stop all services that we have just install. ```console pi@RIP2:~ $ sudo service dnsmasq stop pi@RIP2:~ $ sudo service vsftpd stop pi@RIP2:~ $ sudo service apache2 stop pi@RIP2:~ $ sudo service hostapd stop ``` Save a copy of dhcpcd.conf and edit dhcpcd.conf ```console pi@RIP2:~ $ sudo mv /etc/dhcpcd.conf /etc/dhcpcd.conf.orig pi@RIP2:~ $ sudo nano /etc/dhcpcd.conf ``` add these lines : ```ini interface wlan0 static ip_address=192.168.50.1/24 nohook wpa_supplicant ``` and uncomment eth0 profile to enable dhcp fallback to a static IP ```ini # define static profile profile static_eth0 static ip_address=192.168.10.23/24 static routers=192.168.10.254 static domain_name_servers=8.8.8.8 8.8.4.4 # fallback to static profile on eth0 interface eth0 fallback static_eth0 ``` You can just send a copy of the dhcpcd.conf in this folder with scp. So close your remote session ```console pi@RIP2:~ $ exit ``` and then in the host command prompt do. ```console pi@RIP2:~ $ scp ./dhcpcd.conf pi@YOUR-PI-IP-ADDRESS:dhcpcd.conf pi@YOUR-PI-IP-ADDRESS's password: ``` Replace YOUR-PI-IP-ADDRESS by the raspberry pi ip address. You will be ask to type your ssh password. Then log back your pi with ssh and put the file in the right place. ```console pi@RIP2:~ $ sudo mv dhcpcd.conf /etc/dhcpcd.conf ``` Do the same for hostapd.conf and dnsmask.conf. of course replace YOUR-PI-IP-ADDRESS by your pi ip address. In host : ```console pi@RIP2:~ $ scp ./hostapd.conf pi@YOUR-PI-IP-ADDRESS:hostapd.conf pi@YOUR-PI-IP-ADDRESS's password: pi@RIP2:~ $ scp ./dnsmask.conf pi@YOUR-PI-IP-ADDRESS:dnsmask.conf pi@YOUR-PI-IP-ADDRESS's password: ``` And back in the pi. ```console pi@RIP2:~ $ sudo mv hostapd.conf /etc/hostapd/hostapd.conf pi@RIP2:~ $ sudo mv dnsmask.conf /etc/dnsmask.conf ``` Obviously, you have to change some configuration in /etc/hostapd/hostapd.conf to suite your needs. In fact adjust as minimal requirements the SSID and the PASSWORD on these lines. ```ini ssid=AP-SSID wpa_passphrase=AP-WIFI-PASSWORD ``` And we are not done yet with hostapd. you have to setup the default config file that hostapd will use. To do that, edit /etc/default/hostapd ```console pi@RIP2:~ $ sudo nano /etc/default/hostapd ``` And uncomment the line DAEMON_OPTS and put the path of the conf file we have copy. Ctrl-X to exit nano then yes to save changes again. ```ini DAEMON_CONF="/etc/hostapd/hostapd.conf" ``` Unmask (unlock) hostapd service ```console sudo systemctl unmask hostapd.service sudo systemctl enable hostapd.service ``` now we are ready to reboot and see if the access point is working properly. ```console pi@RIP2:~ $ sudo reboot ``` 5. Configure vsftpd, apache2 and php : From host copy vsftpd.conf ```console pi@RIP2:~ $ scp ./vsftpd.conf pi@YOUR-PI-IP-ADDRESS:vsftpd.conf pi@YOUR-PI-IP-ADDRESS's password: ``` ```console pi@RIP2:~ $ cd pi@RIP2:~ $ sudo mv vsftpd.conf /etc/vsftpd.conf pi@RIP2:~ $ mkdir VidLooper pi@RIP2:~ $ sudo chgrp -R www-data VidLooper pi@RIP2:~ $ sudo chmod -G www-data ftp pi@RIP2:~ $ sudo chmod -R g+rwx ./VidLooper pi@RIP2:~ $ git clone https://github.com/a2msystemes/RIP pi@RIP2:~ $ cd RIP pi@RIP2:~ $ cp -R site/ ../VidLooper pi@RIP2:~ $ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/site s-available/001-RIP-webApp.conf pi@RIP2:~ $ sudo a2dissite 000-default.conf Site 000-default disabled. To activate the new configuration, you need to run: systemctl reload apache2 pi@RIP2:~ $ sudo systemctl reload apache2.service pi@RIP2:~ $ cd RIP pi@RIP2:~ $ sudo cp ./001-RIP-webApp.conf /etc/apache2/sites-available/ pi@RIP2:~ $ sudo a2ensite 001-RIP-webApp.conf pi@RIP2:~ $ sudo apachectl configtest pi@RIP2:~ $ sudo systemctl reload apache2.service pi@RIP2:~ $ sudo cp ./php.ini /etc/php/[php-version]/apache2/php.ini pi@RIP2:~ $ sudo cp ./010_rip-reboot /etc/sudoers.d/010_rip-rebootc pi@RIP2:~ $ sudo reboot ``` 6. launch vidlooper at startup ## useful links [reboot php tricks](https://raspberry-projects.com/pi/software_utilities/web-servers/php-code-bits/reboot) [Youtube download python MAJ](https://stackoverflow.com/questions/71883661/pytube-error-get-throttling-function-name-could-not-find-match-for-multiple) [raspberry pi 400 pinout](https://www.theelectronics.co.in/2021/02/raspberry-pi-400-full-pc-in-keyboard.html) ## Credits []()