diff --git a/README.md b/README.md index 477e5c5..0e30a10 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ The exact steps depend on the backup mode. 1. Point the browser to *http://127.0.0.1:8000* (replace *127.0.0.1* with the actual IP address of the Raspberry Pi). 2. Start the desired action by pressing the appropriate button. +The access the contents of the storage device, plug it into the Raspberry Pi and press the **DLNA SERVER** button. You can then use a uPnP application on any device on the same network to browse and view the contents of the storage device. + ## Problems? diff --git a/img/rc.png b/img/rc.png index 75c90a9..15b0202 100644 Binary files a/img/rc.png and b/img/rc.png differ diff --git a/scripts/index.php b/scripts/index.php index 1535757..39bd36e 100644 --- a/scripts/index.php +++ b/scripts/index.php @@ -33,6 +33,12 @@

+

Activate the DLNA server

+

+

+ +
+

Shut down the Little Backup Box

@@ -53,6 +59,10 @@ if (isset($_POST['camerabackup'])) { shell_exec('sudo ./camera-backup.sh 2>&1 & echo $!'); } +if (isset($_POST['minidlna'])) +{ + shell_exec('sudo ./minidlna.sh 2>&1 & echo $!'); +} if (isset($_POST['shutdown'])) { shell_exec('sudo shutdown -h now 2>&1 & echo $!'); diff --git a/scripts/minidlna.sh b/scripts/minidlna.sh new file mode 100755 index 0000000..8dae5d7 --- /dev/null +++ b/scripts/minidlna.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# IMPORTANT: +# Run the install-little-backup-box.sh script first +# to install the required packages and configure the system. + +# Specify devices and their their mount points +# as well as other settings +STORAGE_DEV="sda1" # Name of the storage device +STORAGE_MOUNT_POINT="/media/storage" # Mount point of the storage device + +# Wait for a USB storage device (e.g., a USB flash drive) +STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3) +#STORAGE=$(lsblk -x SIZE | grep sd[a-z]1 | awk '{print $1}' | sort | head -n 1) +while [ -z "${STORAGE}" ] + do + sleep 1 + STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3) +done + +# When the USB storage device is detected, mount it +mount /dev/"$STORAGE_DEV" "$STORAGE_MOUNT_POINT" + +# Set the ACT LED to blink at 1000ms to indicate that the storage device has been mounted +sudo sh -c "echo timer > /sys/class/leds/led0/trigger" +sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" + +# Reload minidlna + +sudo minidlnad -R +sudo service minidlna restart