diff --git a/Makefile b/Makefile index 6a73930..586dd92 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ SHELL := /bin/bash -null: +compile: + pacman -S openssl gzip tar openssh + make keys + +install: @echo You must specify client or server in a call to make. client: user aether.bash @@ -15,7 +19,7 @@ client: user aether.bash touch /var/log/aether.log chown aether:aether /var/log/aether.log -server: user aether-gen.bash aether.pub server-backup +server: scripts user ./aether-gen.bash ./aether.pub ./server-backup bash ./aether-gen.bash cp ./aether.pub /home/aether/.ssh/authorized_keys chmod 0600 /home/aether/.ssh/authorized_keys @@ -44,3 +48,13 @@ node-command: keys: ssh-keygen -t rsa -P "" -f aether + +scripts: ./server-backup ./remote-backup + cp ./server-backup /root/bin + chmod 0700 /root/bin/server-backup + cp ./remote-backup /root/bin + chmod 0700 /root/bin/remote-backup + +reverse: + cp /root/bin/server-backup . + cp /root/bin/remote-backup . diff --git a/README.bzr b/README similarity index 100% rename from README.bzr rename to README diff --git a/remote-backup b/remote-backup new file mode 100644 index 0000000..95f3a05 --- /dev/null +++ b/remote-backup @@ -0,0 +1,21 @@ +#!/bin/bash +if [ "$(whoami)" != "root" ]; then + echo Needs to be run as root. + exit 1; +fi + +if (ping -c 4 "$1" | grep -c ' 0% packet loss,'); then + printf "Are you sure you want to back everything up to %s?\nIs the root password set and all storage mounted?\nDo you have time for this backup to complete?\nEnter YES in all capitals to continue..." "$1" + read answer + if [ "$answer" != "YES" ]; then + echo User did not confirm. + exit 1; + else + rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / root@"$1":/mnt/ + echo rsync exited with status $? + exit $? + fi +else + echo "Host is not responding in a timely fashion." + exit 1; +fi