Headers & Usage

This commit is contained in:
DarkFeather 2023-12-07 12:37:40 -06:00
parent e01ad632b2
commit d0302f8694
Signed by: DarkFeather
GPG Key ID: 1CC1E3F4ED06F296
2 changed files with 43 additions and 4 deletions

View File

@ -8,6 +8,15 @@
# Copyright: WTFPL
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
#
# Helptext
if [ "$1" == "-h" ]; then
cat <<EOM
Usage: $0 # Generate teh backup from /usr/local/etc/Aether/backup-entries
EOM
exit 0
fi
export BACKUPDIR="/usr/local/backup"
export BACKUPCMD="rsync -avzl --delete-after";

View File

@ -1,17 +1,47 @@
#!/bin/bash
#
# File: aether.bash
#
# Description: Copy the aether.enc to local
#
# Package: AniNIX/Aether
# Copyright: WTFPL
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
### DO NOT EDIT THIS FILE ###
# Usage
if [ "$1" == "-h" ]; then
cat <<EOM
Usage: $0 # Will get the aether.enc from the remote to the aether user's home.
EOM
exit 0
fi
# Seed remote
aetherremote="$1"
if [ -z "$aetherremote" ]; then
aetherremote=aether@aninix.net
fi
aethercount="$2"
if [ -z "$aethercount" ]; then
aethercount=7
fi
# Sanity check
if [ ! -f /home/aether/.ssh/aether ]; then
echo "Need to have the aether key to run."
exit
fi
cd /home/aether
if [ $(ls ./aether-*.enc | wc -l) -gt 7 ]; then
# Logrotate off oldest aether include
if [ $(ls ./aether-*.enc | wc -l) -gt "$aethercount" ]; then
rm $(ls -tr ./aether-*.enc | head -n 1);
fi
export TARGET="aether-"$(date +%F)".enc"
printf "get /aether/aether.enc %s\nbye\n" $TARGET | sftp -o IdentityFile=./.ssh/aether aether@aninix.net
printf "get /aether/aether.enc %s\nbye\n" $TARGET | sftp -o IdentityFile=./.ssh/aether "$aetherremote"
echo "Aether copy populated. Today\'s was saved to "$TARGET
echo "Aether copy populated from $aetherremote. Today\'s was saved to $TARGET"
exit