etcd2-backup-install 891 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash -e
  2. if [ ! -f /etc/os-release ];then
  3. echo "Could not find /etc/os-release. This is not CoreOS Linux"
  4. exit 1
  5. fi
  6. . /etc/os-release
  7. if [ ! "$ID" == "coreos" ];then
  8. echo "os-release error: Detected ID=$ID: this is not CoreOS Linux"
  9. exit 1
  10. fi
  11. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  12. cd "${SCRIPT_DIR}"
  13. sudo cp ./rclone.conf /etc/
  14. sudo mkdir -p /opt/bin
  15. sudo mv etcd2-join bin/etcd2-restore /opt/bin
  16. sudo mv *.{service,timer} /etc/systemd/system
  17. sudo systemctl daemon-reload
  18. for jobtype in restore backup join;do
  19. sudo mkdir -p /var/run/systemd/system/etcd2-${jobtype}.service.d
  20. sudo cp 30-etcd2-backup-restore.conf /var/run/systemd/system/etcd2-${jobtype}.service.d/
  21. sudo ln -sf /var/run/systemd/system/etcd2{,-${jobtype}}.service.d/20-cloudinit.conf
  22. done
  23. sudo systemctl daemon-reload
  24. echo "etcd2-backup install complete!"