-
Notifications
You must be signed in to change notification settings - Fork 1
/
appdata.backup.beta.plg
174 lines (146 loc) · 6.53 KB
/
appdata.backup.beta.plg
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "appdata.backup.beta">
<!ENTITY author "Robin Kluth">
<!ENTITY version "2024.08.16b1">
<!ENTITY sha256 "7d74a5b70bab719c07b8f6b84ea26960bd0ba0be69b8edd5e3ee13a67cfa106d">
<!ENTITY launch "Settings/AB.Beta.Main">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Commifreak/unraid-appdata.backup">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/master/&name;.plg">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="shield"
min="6.12" support="https://forums.unraid.net/topic/136995-pluginbeta-appdatabackup/">
<CHANGES>
<![CDATA[
➕New 🩹Fix 🔧Change
###2024.08.16b1
- ➕ Added `pre-container` and `post-container` scripts which runs right before/after tar creation
###2024.02.08b1
- 🔧 Created backups are now owned by `nobody:users` with permissions `rwxrw-rw-`
- 🔧 `Skip stopping container?` (formerly known as `Don't stop container?`) is now a global option which can be adjusted in every container
###2024.02.07b1
- ➕ If the plugin detects same mapping within multiple containers, it shows a warning
- ➕ If multicore compression is enabled, you can now fine tune the cpu cores to use
###2023.12.07b1
- ➕ Container grouping
###2023.11.03b1
- ➕ Global exclusion list
- ➕ You can enable a notification for updated containers (disable by default)
- 🩹 `postBackup` script will now be executed after backup, before starting the container
- 🔧 Raise a warning (instead of info) if container has NO volumes to backup
- 🔧 Container updates are now handled directly after backing them up
###2023.04.11
- 🩹 Saving the settings with no docker containers yet, results in a blank page
###2023.04.10
- 🚀 First stable version!
###2023.04.03b1
- 🩹 Fixed file selector for dark themes _(Unraids global config variable handling needs a revamp...)_
### 2023.03.31b2
- 🩹 ca.backup2 migration: Migrate old source path as well
### 2023.03.31b1
- 🔨 The restore default source path defaults now to the current set destination path
- 🔧 You can choose a custom restore path now. This could be useful for advanced restoring. **This only applies to extracted archives, not for the config/xmls!**
- 🔧 Changed the internal/external volume mapping detection again: You can choose ALL of your valid appdata sources now. **Open help for `Appdata source(s)` for further explanation**
### 2023.03.30b1
- 🔨 If a `ca.backup2` config file is detected, the plugin now offers a config migration
- 🔧 Changed the way "internal" volumes are detected: `/mnt/{user,cache}/appdata` and optionally the docker set folder are treated as such. Any other volume mapping (`/mnt/user/downloads/myDownloads` as example) is "external". You can optionally backup those too (disabled by default)
### 2023.03.29b2
- 🩹 "External" volumes (volumes not within your appdata) path are now being ignored. A future update will bring options to save them as well
- 🩹 Container exclude list was not working as expected
- 🩹 Fixed settings page issues for Safari users
- 🩹 Fixed an issue during applying default settings to containers
- 🔧 Faild backups are now kept (with -failed suffix)
- 🔧 `Abort` now instantly stops any running command instead of waiting for its completion
### 2023.03.28b3
- 🩹 Some file selectors are opening some others - fixed
- 🔧 Display container volumes one per line
### 2023.03.28b2
- 🩹 Fixed per container (only new ones) settings being hard-set to the global defaults instead of keeping 'Use default'
- 🔨 Added back update notice banner
### 2023.03.28b1
- 🔨 Added back VM meta backup
- 🔨 Added back update notice banner
### 2023.03.27b1
- 🔨 1st beta
]]>
</CHANGES>
<FILE Run="/bin/bash">
<INLINE>
OLDVERS=$(ls /boot/config/plugins/&name;/*.tgz 2>/dev/null | grep -v '&version;')
if [ ! -z "$OLDVERS" ]
then
echo "Cleaning old archives..."
rm $OLDVERS
else
echo "No cleanup of old plugin archive needed!"
fi
if [ -d "&plugdir;" ]
then
echo "Removing plugin files..."
rm -rf &plugdir;
else
echo "Plugin files were not present. Fresh install"
fi
echo "Creating plugin files directory..."
mkdir &plugdir;
</INLINE>
</FILE>
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.tgz">
<URL>https://github.com/&github;/releases/download/&version;/&name;-&version;.tgz</URL>
<SHA256>&sha256;</SHA256>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
echo "Extracting plugin files..."
tar -C &plugdir; -xzf /boot/config/plugins/&name;/&name;-&version;.tgz 2>&1
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
# Because we used the wrong way for reloading cron, we should remove the old remnants...
if [ -f "/etc/cron.d/appdata_backup_beta" ]; then
rm /etc/cron.d/appdata_backup_beta
echo "Found old cron file, refreshing it..."
fi
php &plugdir;/scripts/checkCron.php
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
echo Adapting some things, because this is beta
rm &plugdir;/*.page
cp &plugdir;/pages/*.page &plugdir;/pages/README.md &plugdir;
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
echo -n "&version;" > &plugdir;/version
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
echo ""
echo "----------------------------------------------------"
echo " &name; has been installed."
echo " (previously known as ca.backup2)"
echo ""
echo " 2022-2023, Robin Kluth"
echo " Version: &version;"
echo "----------------------------------------------------"
echo ""
</INLINE>
</FILE>
<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "Uninstalling... 😭 Maybe I see you again soon. Bye!"
rm -rf &plugdir; 2>/dev/null
rm -rf /boot/config/plugins/&name;
update_cron # Let cron know, we removed the target files :P
echo "Uninstall done."
</INLINE>
</FILE>
</PLUGIN>