-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·33 lines (26 loc) · 1 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
#
# Copyright (c) 2022 QuickVM, LLC <[email protected]> All Rights Reserved.
set -e
[[ $UID == 0 ]] || { echo "Please run this as root!"; exit 1; }
: ${UNIT_FILES:=./units}
: ${UNIT_DIR:=/etc/systemd/system}
[[ -d ${UNIT_FILES} ]] || { echo "The ${UNIT_FILES} directory cannot be found! Please run this from the repo root directory!"; exit 1; }
for FILE in ${UNIT_FILES}/*; do
install -m 0644 ${FILE} ${UNIT_DIR}
DEST="$(basename -- $FILE)"
echo "Copied ${FILE} to ${UNIT_DIR}/${DEST}"
done
systemctl daemon-reload
echo ""
echo "Great job! The restic systemd units are now installed!"
echo ""
echo "If you want to uninstall these Restic systemd units please manually run these commands as the root user:"
echo "systemctl disable [email protected] (do this for every backup repository)"
for FILE in ${UNIT_FILES}/*; do
install -m 0644 ${FILE} ${UNIT_DIR}
DEST="$(basename -- $FILE)"
echo "rm -f ${UNIT_DIR}/${DEST}"
done
echo "systemctl daemon-reload"