diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6451793..7d383f8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -43,30 +43,30 @@
- {
+ "keyToString": {
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "git-widget-placeholder": "main",
+ "last_opened_file_path": "/store/Documents/Workspaces/Steffo99/docker-backup-duplicity",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.0",
+ "project.structure.side.proportion": "0.2",
+ "settings.editor.selected.configurable": "editor.preferences.folding",
+ "vue.rearranger.settings.migration": "true"
},
- "keyToStringList": {
- "GitStage.ChangesTree.GroupingKeys": [
- "directory",
- "module",
- "repository"
+ "keyToStringList": {
+ "GitStage.ChangesTree.GroupingKeys": [
+ "directory",
+ "module",
+ "repository"
]
}
-}]]>
+}
@@ -79,7 +79,7 @@
-
+
1684080793392
@@ -109,7 +109,21 @@
1684326475873
-
+
+ 1684326824058
+
+
+
+ 1684326824058
+
+
+ 1684326830505
+
+
+
+ 1684326830505
+
+
@@ -131,6 +145,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/backup.sh b/backup.sh
index 2eb6e2b..b00702e 100755
--- a/backup.sh
+++ b/backup.sh
@@ -7,24 +7,9 @@ set -e
# It's duplicity's fault!
export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
-case "$MODE" in
- backup)
- echo "Launched in backup mode, performing backup..." >> /dev/stderr
- duplicity \
- --allow-source-mismatch \
- --full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
- /mnt \
- "${DUPLICITY_TARGET_URL}"
- ;;
- restore)
- echo "Launched in restore mode, restoring backup..." >> /dev/stderr
- duplicity \
- --force \
- --allow-source-mismatch \
- "${DUPLICITY_TARGET_URL}" \
- /mnt
- ;;
- *)
- echo "No such mode." >> /dev/stderr
- ;;
-esac
+echo "Launched in backup mode, performing backup..." >> /dev/stderr
+duplicity \
+ --allow-source-mismatch \
+ --full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
+ /mnt \
+ "${DUPLICITY_TARGET_URL}"
diff --git a/entrypoint.sh b/entrypoint.sh
index 574a892..fbc2838 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,7 +1,17 @@
#!/bin/sh
-echo "Running first backup..."
-./backup.sh
-
-echo "Running cron for daily backups..."
-crond -f -d 5 -l info
+case "$MODE" in
+ backup)
+ echo "Running first backup..."
+ ./backup.sh
+ echo "Running cron for daily backups..."
+ crond -f -d 5 -l info
+ ;;
+ restore)
+ echo "Restoring from latest backup..."
+ ./restore.sh
+ ;;
+ *)
+ echo "No such mode." >> /dev/stderr
+ ;;
+esac
diff --git a/restore.sh b/restore.sh
new file mode 100755
index 0000000..4e2c24c
--- /dev/null
+++ b/restore.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+# Get secrets from files
+# Insecure, but there's not much I can do about it
+# It's duplicity's fault!
+export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
+
+echo "Launched in restore mode, restoring backup..." >> /dev/stderr
+duplicity \
+ --force \
+ --allow-source-mismatch \
+ "${DUPLICITY_TARGET_URL}" \
+ /mnt