Updating to include systemd timers
Better Makefile layout Improving pytest
This commit is contained in:
@@ -1,17 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# File: HelloWorld.bash
|
||||
#
|
||||
# Description: This file exemplifies printing 'Hello world!' in bash.
|
||||
#
|
||||
# Package: AniNIX/HelloWorld
|
||||
# Copyright: WTFPL
|
||||
#
|
||||
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
|
||||
|
||||
# Should only be done as root.
|
||||
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"
|
||||
# Default the host to the Aether host in whatever domain this host lives in.
|
||||
host="$1"
|
||||
if [ -z "$host" ]; then
|
||||
host=Aether
|
||||
fi
|
||||
|
||||
# Default the path to /
|
||||
path="$2"
|
||||
if [ -z "$path" ]; then
|
||||
path='/'
|
||||
fi
|
||||
|
||||
# Try to contract the host
|
||||
if (nmap --open -p 22 "$host" | grep -E '22/tcp\s+open' &>/dev/null); then
|
||||
|
||||
# Confirm with the user
|
||||
printf "Are you sure you want to back everything up to %s?\n* Is the root password set and backup volume mounted on '/mnt'?\n* Do you have time for this backup to complete?\n* Does \`ssh-keyscan -D localhost\` on the server match this? `ssh-keyscan -D "$host" 2>/dev/null | grep 4\ 2`\nEnter YES in all capitals to continue..." "$host"
|
||||
|
||||
read answer
|
||||
if [ "$answer" != "YES" ]; then
|
||||
echo User did not confirm.
|
||||
exit 1;
|
||||
else
|
||||
rsync -aAXv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / root@"$1":/mnt/
|
||||
rsync -aAXv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} "$path" root@"$host":/mnt"$path"
|
||||
status="$?"
|
||||
echo rsync exited with status $status
|
||||
exit $status
|
||||
|
Reference in New Issue
Block a user