From eaa50da07457e859455c55c7132da83934b4d5f1 Mon Sep 17 00:00:00 2001 From: Royal Purple Gerbil Date: Sat, 5 Sep 2020 17:02:29 +0300 Subject: [PATCH] First commit --- Bit-Frigger-Tarballer | 23 +++++++++++++++++++++++ Vol-Sync | 18 ++++++++++++++++++ WindowsBoot | 4 ++++ 3 files changed, 45 insertions(+) create mode 100755 Bit-Frigger-Tarballer create mode 100755 Vol-Sync create mode 100755 WindowsBoot diff --git a/Bit-Frigger-Tarballer b/Bit-Frigger-Tarballer new file mode 100755 index 0000000..872a850 --- /dev/null +++ b/Bit-Frigger-Tarballer @@ -0,0 +1,23 @@ +#!/bin/bash +# Script to export the Bit Frigger's rootfs to a zstd tarball periodically +FINAL_DIR="/Red-Vol/Backups/Bit-Frigger/Tarball" +#Check for root permissions +if [[ $(whoami) != "root" ]]; then + echo "Please run this script as root or with sudo." + exit +fi +#Create directory if it does not exist +if [[ ! -d $FINAL_DIR ]]; then + mkdir $FINAL_DIR +fi +#Sync everything to it +echo "Gathering files for the tarball" +rsync -aHAXSv --progress --exclude=/dev --exclude=/Red-Vol --exclude=/proc --exclude=/rksmb "/" "$FINAL_DIR" +#And tar it with ZSTD +echo "Compressing tarball" +cd $FINAL_DIR +if [[ -f "$FINAL_DIR/Bit-Frigger.tar" ]]; then + tar rvfJ Bit-Frigger.tar.xz $FINAL_DIR +else + tar cvfJ Bit-Frigger.tar.xz $FINAL_DIR +fi diff --git a/Vol-Sync b/Vol-Sync new file mode 100755 index 0000000..950d10f --- /dev/null +++ b/Vol-Sync @@ -0,0 +1,18 @@ +#!/bin/bash +#Script to sync the Red-Vol when it comes up with the Tui64 share. +INIT_DIR='/Red-Vol' +FINAL_DIR='/rksmb/*' +HOST_IP='192.168.1.66' + +#Ping check +ping -c 4 $HOST_IP > /dev/null +#If there is ping, sync the Media and Backups subvolumes. +if [[ $(echo $?) == 0 ]]; then + sshpass -f /shmick/.ssh/sshpasskey rsync -aHAXv --progress --exclude="Torrents" shmick@$HOST_IP:$FINAL_DIR $INIT_DIR +#No DNS resolution +elif [[ $(echo $?) == 2 ]]; then + echo "Could not resolve host." +#No ping +elif [[ $(echo $?) == 1 ]]; then + echo "No communications with host." +fi diff --git a/WindowsBoot b/WindowsBoot new file mode 100755 index 0000000..83642bf --- /dev/null +++ b/WindowsBoot @@ -0,0 +1,4 @@ +#!/bin/bash +WindowsEntry=$(efibootmgr | grep "Windows Boot Manager" | awk '{print $1}' | sed -e 's/Boot//g') +efibootmgr -n $WindowsEntry +reboot