Updating to include systemd timers
Better Makefile layout Improving pytest
This commit is contained in:
77
Makefile
77
Makefile
@@ -1,76 +1,25 @@
|
||||
SHELL := /bin/bash
|
||||
BACKUPDIR := /usr/local/backup
|
||||
|
||||
client: user aether.bash
|
||||
cp aether.bash /home/aether/aether.bash
|
||||
/home/aether/aether.bash
|
||||
sudo -u aether crontab -l > /tmp/cronie
|
||||
grep aether.bash /tmp/cronie || echo '0 1 * * * /home/aether/aether.bash &>> /var/log/aether.log' >> /tmp/cronie
|
||||
sudo -u aether crontab /tmp/cronie
|
||||
rm /tmp/cronie
|
||||
touch /var/log/aether.log
|
||||
chown aether:aether /var/log/aether.log
|
||||
make checkperm
|
||||
|
||||
compile:
|
||||
@echo Nothing to do
|
||||
|
||||
install: compile
|
||||
@echo You must specify client or server in a call to make.
|
||||
|
||||
server: keys scripts user ./aether-gen.bash ./aether.pub ./server-backup
|
||||
bash ./aether-gen.bash
|
||||
cp ./aether.pub /home/aether/.ssh/authorized_keys
|
||||
cp ./aether-gen.bash /root/bin/aether-gen.bash
|
||||
mkdir -p /usr/local/etc/Aether/backup-entries
|
||||
touch /usr/local/etc/Aether/nodeslist
|
||||
mkdir -p ${BACKUPDIR};
|
||||
make checkperm
|
||||
@echo You have the files. Add aether-gen.bash and server-backup to root\'s crontab.
|
||||
@echo Mark services to be backed up by adding a file from examples/ to /usr/local/etc/Aether/backup-entries
|
||||
@echo Track client nodes in /usr/local/etc/Aether/nodeslist
|
||||
|
||||
user: aether make-user.bash
|
||||
/bin/bash ./make-user.bash
|
||||
|
||||
node-command:
|
||||
@echo USE THE FOLLOWING COMMANDS TO SET UP A NODE.
|
||||
@echo -ne 'git clone https://aninix.net/foundation/Aether;'
|
||||
@echo
|
||||
@echo -ne 'cd Aether; cat > aether # Paste the private key'
|
||||
@echo
|
||||
@echo -ne 'make client'
|
||||
@echo
|
||||
@echo MAKE SURE TO ADD THE NODE TO /usr/local/etc/Aether/nodes.list
|
||||
|
||||
keys:
|
||||
if [ ! -f ./aether ]; then ssh-keygen -t rsa -P "" -f aether; fi
|
||||
|
||||
scripts: ./server-backup ./remote-backup
|
||||
cp ./server-backup /root/bin
|
||||
cp ./remote-backup /root/bin
|
||||
make checkperm
|
||||
|
||||
reverse:
|
||||
if [ -f /root/bin/server-backup ]; then cp /root/bin/server-backup .; fi
|
||||
if [ -f /root/bin/remote-backup ]; then cp /root/bin/remote-backup .; fi
|
||||
if [ -f /root/bin/aether-gen.bash ]; then cp /root/bin/aether-gen.bash .; fi
|
||||
if [ -f /home/aether/aether.bash ]; then cp /home/aether/aether.bash .; fi
|
||||
|
||||
diff:
|
||||
if [ -f /root/bin/server-backup ]; then diff ./server-backup /root/bin/server-backup; fi
|
||||
if [ -f /root/bin/remote-backup ]; then diff ./remote-backup /root/bin/remote-backup; fi
|
||||
if [ -f /root/bin/aether-gen.bash ]; then diff ./aether-gen.bash /root/bin/aether-gen.bash; fi
|
||||
if [ -f /home/aether/aether.bash ]; then diff ./aether.bash /home/aether/aether.bash; fi
|
||||
mkdir -p ${pkgdir}/usr/local/sbin
|
||||
mkdir -p ${pkgdir}/usr/local/etc
|
||||
install -m 0750 -o aether aether.bash ${pkgdir}/usr/local/sbin
|
||||
install -m 0750 -o root -g root aether-gen.bash ${pkgdir}/usr/local/sbin
|
||||
install -m 0750 -o root -g root remote-backup ${pkgdir}/usr/local/sbin
|
||||
install -m 0750 -o aether -d ${pkgdir}/usr/local/etc/Aether
|
||||
install -m 0750 -o aether -d ${pkgdir}/usr/local/etc/Aether/backup-entries
|
||||
mkdir -p ${pkgdir}/usr/lib/systemd/system
|
||||
for i in *.service *.timer; do install -m 0640 -o root -g root "$$i" ${pkgdir}/usr/lib/systemd/system; done
|
||||
|
||||
checkperm:
|
||||
id aether;
|
||||
if [ -d /home/aether ]; then chmod 0600 /home/aether/.ssh/authorized_keys; chmod 0700 /home/aether/.ssh /home/aether; chown -R aether:aether /home/aether; fi
|
||||
if [ -f /root/bin/remote-backup ]; then chmod 0700 /root/bin/remote-backup; chown root:root /root/bin/remote-backup; fi
|
||||
if [ -f /root/bin/server-backup ]; then chmod 0700 /root/bin/server-backup; chown root:root /root/bin/server-backup; fi
|
||||
if [ -d /usr/local/etc/Aether ]; then chmod -R 0700 /usr/local/etc/Aether; chown -R aether:aether /usr/local/etc/Aether; fi
|
||||
if [ -d ${BACKUPDIR} ]; then chmod 0770 ${BACKUPDIR}; chown postgres:root ${BACKUPDIR}; fi
|
||||
if [ -f /var/log/aether.log ]; then chown aether:aether /var/log/aether.log; chmod 0750 /var/log/aether.log; fi
|
||||
for i in ${pkgdir}/usr/local/sbin/aether.bash ${pkgdir}/usr/local/sbin/aether-gen.bash ${pkgdir}/usr/local/sbin/remote-backup ${pkgdir}/usr/local/etc/Aether; do chmod 0750 "$$i"; done
|
||||
for i in ${pkgdir}/usr/local/sbin/aether.bash ${pkgdir}/usr/local/sbin/aether-gen.bash ${pkgdir}/usr/local/sbin/remote-backup ${pkgdir}/usr/local/etc/Aether; do chown root: "$$i"; done
|
||||
chown aether: ${pkgdir}/usr/local/sbin/aether.bash
|
||||
for i in *.service *.timer; do chown root: ${pkgdir}/usr/lib/systemd/system; chmod 0640 ${pkgdir}/usr/lib/systemd/system; done
|
||||
|
||||
clean:
|
||||
@bash -c 'printf "This will irreversibly destroy all backups. Confirm? [YES/no] " ; read answer; [ "$$answer" == "YES" ] && exit 0; exit 1'
|
||||
|
Reference in New Issue
Block a user