diff --git a/install.sh b/install.sh index 328b862..1d5b07e 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash ENDPOINT="https://git.sassysalamander.net/wytch/recalbox-savesync/archive/main.tar.gz" -cd /recalbox/share/system +cd ~ || { printf "Could not cd to ~. Exiting\n"; exit 1; } printf "Curling tarball..." curl -L -o savesync.tar.gz "$ENDPOINT" 2>/dev/null printf "done\n" @@ -10,12 +10,14 @@ tar -xvf savesync.tar.gz >/dev/null printf "done\n" rm savesync.tar.gz -cd recalbox-savesync +cd recalbox-savesync || { printf "Could not cd into extracted directory. Exiting\n"; exit 1; } -ans="" -while [ ! "$ans" =~ ^[yY][eE]?[sS]?$ ]; do - read -p "\nWhat's your rclone prefix? : " prefix +re="'^[yY][eE]?[sS]?$'" +result="0" +while [ "$result" -ne 1 ]; do + read -rp "\nWhat's your rclone prefix? : " prefix read -rp "Is $prefix okay? [y/N]: " ans + result="$(grep -E -c "$re" "$ans")" done printf "s//%s/g" "$prefix" > "/tmp/savesync.sed" @@ -27,7 +29,7 @@ mkdir -p /recalbox/share/userscripts/manual cp "locksync.ash" /recalbox/share/userscripts/manual/ printf "done\n" printf "Cleaning up..." -cd .. +cd .. || { printf "failed\nExiting\n"; exit 1; } rm -rf recalbox-savesync printf "done\n" diff --git a/rclone-install.sh b/rclone-install.sh new file mode 100644 index 0000000..490e841 --- /dev/null +++ b/rclone-install.sh @@ -0,0 +1,75 @@ +#!/bin/bash +ver="1.6" +echo "$0 ver $ver written by Claude Pageau" + +cd ~ +if [ ! -f /usr/bin/rclone -o ! -z "$1" ]; then + echo "-------------------------------------------------------------------------------" + wget -O rclone.zip https://downloads.rclone.org/rclone-current-linux-arm.zip + echo "unzip rclone.zip to folder rclone-tmp" + unzip -o -j -d rclone-tmp rclone.zip + echo "Install files and man pages" + cd rclone-tmp + cp rclone /usr/bin/ + chown root:root /usr/bin/rclone + chmod 755 /usr/bin/rclone + mkdir -p /usr/local/share/man/man1 + cp rclone.1 /usr/local/share/man/man1/ + mandb + cd .. + echo "Deleting rclone.zip and Folder rclone-tmp" + rm rclone.zip + rm -r rclone-tmp +fi + +if [ -f /usr/bin/rclone ]; then + echo "rclone is installed at /usr/bin/rclone" + rclone -V + mkdir -p rpi-sync + cd rpi-sync + wget -O rclone-sync.sh https://raw.github.com/pageauc/rclone4pi/master/rclone-sync.sh + wget -O Readme.md https://raw.github.com/pageauc/rclone4pi/master/Readme.md + wget -O rclone-install.sh https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh + chmod +x *sh +else + echo "ERROR - Problem Installing rclone. Please Investigate" +fi + +echo "rclone installed at /usr/bin/rclone" +echo "-------------------------------------------------------------------------------" +echo " INSTRUCTIONS Google Drive Example + +1 You will be required to have a login account on the remote storage service + Open putty SSH login session to RPI and execute command below + + rclone config + + Follow rclone prompts. For more Details See + https://github.com/pageauc/rclone4pi/wiki/Home +2 At name> prompt specify a reference name eg gdmedia +3 At storage> prompt Enter a remote storage number from List +4 Select Auto Config, At Link: prompt, left click + and highlight rclone url link (do not hit enter) +5 on computer web browser url bar right click paste and go. +6 On computer web browser security page, Confirm access. +7 Copy web browser access security token and paste + into RPI SSH session rclone prompt. Enter to accept +8 To test remote service access. Execute the following where + gdmedia is the name you gave your remote service + + rclone ls gdmedia:/ + +Example sync command make source identical to destination + +rclone sync -v /home/pi/rpi-sync gdmedia:/rpi-sync + +To upgrade + + cd rpi-sync + ./rclone-install.sh upgrade + +For more Details See https://github.com/pageauc/rclone4pi/wiki/Home +Bye +" + +