From eb5bfddfdf7c0f48ec22e66376db2ab84957398a Mon Sep 17 00:00:00 2001 From: aNullValue Date: Tue, 25 Jun 2019 21:54:51 -0400 Subject: [PATCH] Initial upload Signed-off-by: aNullValue --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++- cron_frequent.sh | 9 ++++ periodic_sync.sh | 72 ++++++++++++++++++++++++++++++++ rclocal_startup.sh | 3 ++ start_picture_frame.sh | 2 + wpa_supplicant.conf | 14 +++++++ 6 files changed, 192 insertions(+), 1 deletion(-) create mode 100755 cron_frequent.sh create mode 100755 periodic_sync.sh create mode 100755 rclocal_startup.sh create mode 100755 start_picture_frame.sh create mode 100755 wpa_supplicant.conf diff --git a/README.md b/README.md index a93f66c..2e156d9 100644 --- a/README.md +++ b/README.md @@ -1 +1,92 @@ -# rpi-pictureframe-slideshow-config \ No newline at end of file +# rpi-slideshow-config +My crappy little config to have an rpi 3b act as a "picture frame" + +## What + +this is woefully insecure. i don't recommend using it. use at your own risk. etc. etc. i've spent like 5 minutes on this. + +these are my notes-to-self as to how i got this rpi working as a picture frame, that would self-update from a gdrive file share + +last performed 2019-06-26 + +rpi 3b + +Dell UltraSharp LCD + +HDMI -> DVI adapter + +## Instructions + +0a. set up an account on a web file sharing doohickey like google drive. + +0b. create folders "picturesync" and "configsync" and note where in the path you put them. + +0c. put all of the files from this repo in the "configsync" folder. + +0c. edit wpa_supplicant.conf to ensure that it's correct for you (it's not by default). refer to wpa_supplicant on a real working rpi3b to get a feel for what it should be like. or google it, i'm not your boss, i'm you. + +0d. of course you should also review the rest of the files for accuracy because lord only knows what typos there might be + +0e. adjust "cron_frequent.sh" so that your preferred times are used for when the display should be put to sleep + +1. download noobs + +2. follow the instructions on the rpi official website to get noobs running + +3. +```bash +sudo nano /etc/lightdm/lightdm.conf +``` + +Now in here add the following line anywhere beneath the [SeatsDefaults] line. + +``` +xserver-command=X -s 0 +``` + +4. +```bash +sudo nano /etc/rc.local +``` + +Add just before exit 0: +```bash +bash /home/pi/rclocal_startup.sh & +``` + +5. +```bash +sudo apt-get install feh +curl https://rclone.org/install.sh | sudo bash +rclone configure # Use the knowledge you obtained during step 0 to properly configure rclone. in this doc the remote is called "remoteside" +mkdir /home/pi/picturesync +mkdir /home/pi/configsync +rclone sync remoteside:/configsync /home/pi/configsync +cp /home/pi/configsync/periodic_sync.sh /home/pi/periodic_sync.sh +chmod +x /home/pi/periodic_sync.sh +sudo /home/pi/periodic_sync.sh +sudo su - +mkdir /root/.config +mkdir /root/.config/rclone +cp /home/pi/.config/rclone/rclone.conf /root/.config/rclone/rclone.conf +``` + +6. +```bash +crontab -e +``` + +Add these lines: + +``` +0/15 * * * * sudo /home/pi/periodic_sync.sh +* * * * * /home/pi/cron_frequent.sh +``` + +7. +```bash +sudo /home/pi/periodic_sync.sh +reboot +``` + + diff --git a/cron_frequent.sh b/cron_frequent.sh new file mode 100755 index 0000000..267f670 --- /dev/null +++ b/cron_frequent.sh @@ -0,0 +1,9 @@ +#!/bin/bash +currenttime=$(date +%H:%M) +if [[ "$currenttime" > "21:00" ]] || [[ "$currenttime" < "06:30" ]]; then + # monitor should be off + vcgencmd display_power 0 +else + # monitor should be on + vcgencmd display_power 1 +fi diff --git a/periodic_sync.sh b/periodic_sync.sh new file mode 100755 index 0000000..7092902 --- /dev/null +++ b/periodic_sync.sh @@ -0,0 +1,72 @@ +#!/bin/bash +rclone sync farside:/configsync /home/pi/configsync + +if test -f "/home/pi/configsync/start_picture_frame.sh" +then + file1md5=$(md5sum < /home/pi/start_picture_frame.sh) + file2md5=$(md5sum < /home/pi/configsync/start_picture_frame.sh) + if [ "$file1md5" = "$file2md5" ] + then + : # do nothing + else + rm -f /home/pi/start_picture_frame.sh + cp /home/pi/configsync/start_picture_frame.sh /home/pi/start_picture_frame.sh + chmod +x /home/pi/start_picture_frame.sh + fi +fi + +if test -f "/home/pi/configsync/rclocal_startup.sh" +then + file1md5=$(md5sum < /home/pi/rclocal_startup.sh) + file2md5=$(md5sum < /home/pi/configsync/rclocal_startup.sh) + if [ "$file1md5" = "$file2md5" ] + then + : # do nothing + else + rm -f /home/pi/rclocal_startup.sh + cp /home/pi/configsync/rclocal_startup.sh /home/pi/rclocal_startup.sh + chmod +x /home/pi/rclocal_startup.sh + fi +fi + +if test -f "/home/pi/configsync/periodic_sync.sh" +then + file1md5=$(md5sum < /home/pi/periodic_sync.sh) + file2md5=$(md5sum < /home/pi/configsync/periodic_sync.sh) + if [ "$file1md5" = "$file2md5" ] + then + : # do nothing + else + rm -f /home/pi/periodic_sync.sh + cp /home/pi/configsync/periodic_sync.sh /home/pi/periodic_sync.sh + chmod +x /home/pi/periodic_sync.sh + fi +fi + +if test -f "/home/pi/configsync/cron_frequent.sh" +then + file1md5=$(md5sum < /home/pi/cron_frequent.sh) + file2md5=$(md5sum < /home/pi/configsync/cron_frequent.sh) + if [ "$file1md5" = "$file2md5" ] + then + : # do nothing + else + rm -f /home/pi/cron_frequent.sh + cp /home/pi/configsync/cron_frequent.sh /home/pi/cron_frequent.sh + chmod +x /home/pi/cron_frequent.sh + fi +fi + +if test -f "/home/pi/configsync/wpa_supplicant.conf" +then + file1md5=$(md5sum < /etc/wpa_supplicant/wpa_supplicant.conf) + file2md5=$(md5sum < /home/pi/configsync/wpa_supplicant.conf) + if [ "$file1md5" = "$file2md5" ] + then + : # do nothing + else + sudo cat /home/pi/configsync/wpa_supplicant.conf > /etc/wpa_supplicant/wpa_supplicant.conf + fi +fi + +rclone sync farside:/picturesync /home/pi/picturesync diff --git a/rclocal_startup.sh b/rclocal_startup.sh new file mode 100755 index 0000000..c906beb --- /dev/null +++ b/rclocal_startup.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sleep 30 +/home/pi/start_picture_frame.sh diff --git a/start_picture_frame.sh b/start_picture_frame.sh new file mode 100755 index 0000000..c87a2d1 --- /dev/null +++ b/start_picture_frame.sh @@ -0,0 +1,2 @@ +#!/bin/bash +DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -K . -z -Z -F -R 60 -Y -D 15.0 /home/pi/picturesync diff --git a/wpa_supplicant.conf b/wpa_supplicant.conf new file mode 100755 index 0000000..d1ee054 --- /dev/null +++ b/wpa_supplicant.conf @@ -0,0 +1,14 @@ +ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev +update_config=1 +country=US + +network={ + ssid="myssid1" + psk="somepassword" +} + +network={ + ssid="myssid2" + psk="anotherpassword" +} +