Skip to content

Commit

Permalink
2023.04.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Apr 10, 2023
1 parent f188213 commit 12500b6
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 176 deletions.
278 changes: 106 additions & 172 deletions appdata.backup.plg
Original file line number Diff line number Diff line change
@@ -1,191 +1,125 @@

To operate on an alternate directory, such as /mnt:
ROOT=/mnt upgradepkg package.txz


<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "ca.backup2">
<!ENTITY name "appdata.backup">
<!ENTITY author "Robin Kluth">
<!ENTITY version "2023.01.28">
<!ENTITY md5 "4855fa5cba9d12754b42d55f56d9ee38">
<!ENTITY launch "Settings/BackupMainV2">
<!ENTITY version "2023.04.10">
<!ENTITY sha256 "8c6196ea6692db05ce4486fa01221775c45dc260374d31ae5b7037a17a4de035">
<!ENTITY launch "Settings/AB.Main">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Commifreak/ca.backup2">
<!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">

<CHANGES>
<![CDATA[
###2023.01.28
- Fixed Array state detection - now works the Unraid way

###2023.01.11
- 🚀 Happy new year!
- Added an option, to disable backup error detection.

###2022.12.27
- Fixed restore

###2022.12.22
- Added some debug infos for the "Already started" docker issue
- Fixes "Abort" function

###2022.12.08
- Fix scanned source files with spaces in it
- Output a bit more debug info for not stopped containers.

###2022.12.05
- Fix `Allowed memory size of xxx exhausted` error, which was caused by a too big logfile from previous plugin
version.
- Also copy the log in case of an error
- Fixed the exclusion of subfolders

###2022.12.04
- Fixed a permission issue, which prevented the backup to run

###2022.12.02
- Fixed tar verification check
- Changed schedule hour format in settings page
- Added option to disable the warning message when accessing the settings page
- Added option to create multiple archives - one for each appdata folder
- Fixed some styling inside settings page
- The logging tab now shows the whole log as well as date/time
- Fixed an error, which caused a reset of the log while backing up
- Made docker container stops/starts more robust: the plugin now tries 3 times to start a container
- The backup log is now copied to the destination to keep it with its run

###2022.07.23
- Set permissions on backups to be 0777

###2021.12.05
- Don't exclude the docker image file since it's now extremely rare for it to be placed within appdata

###2021.11.03
- Fixed: File picker for start / stop scripts wasn't working

###2021.03.13
- Deprecate usb backup (still works though) when running Unraid 6.9

###2021.03.10
- Permission Fix

###2020.12.27
- Fix some permission issues

###2020.10.21
- Compatibility Fixes

###2020.09.27
- When running 6.9-beta 27+, clicking on the notification will take you to the plugin's settings

###2020.07.09
- Execute all custom scripts from RAM

###2020.05.31
- Add pre-start script (Thanks jburnham)

###2019.10.27
- Adjust permissions on backup version of flash drive

###2019.09.25
- Remove purple text

###2019.03.23
- Utilize CA API for update checks

###2019.03.09
- Only rewrite the disk assignments file if it's changed

###2019.01.13
- update Icon

###2018.11.17
- unRaid 6.6+: Honor autostart rules when restarting containers
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="shield"
min="6.12" support="https://forums.unraid.net/topic/137710-plugin-appdatabackup/">

###2018.11.11
- Add in autov routines
<CHANGES>
<![CDATA[
🔧New 🩹Fix 🔧Change
###2018.11.01
- Fix dropdown color for 6.6
###2023.04.03b1
- 🩹 Fixed file selector for dark themes _(Unraids global config variable handling needs a revamp...)_
###2018.10.19
- Fix Broken Pipe
### 2023.03.31b2
- 🩹 ca.backup2 migration: Migrate old source path as well
###2018.07.15
- Fixed: Don't run a scheduled backup if array isn't started
### 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**
###2018.03.15
- Fixed: Don't delete old backup sets if the source doesn't exist
### 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)
###2018.03.02
- Fixed: PHP Warnings (hidden) in 6.5.0+
### 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
###2017.12.22
- Fixed: Apply not being activated when using customized excluded folder
### 2023.03.28b3
- 🩹 Some file selectors are opening some others - fixed
- 🔧 Display container volumes one per line
###2017.11.26
- Fixed: Backup schedule wouldn't run following a reboot of server
### 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
###2017.11.23
- Reorganization as part of updates to CA proper
### 2023.03.28b1
- 🔨 Added back VM meta backup
- 🔨 Added back update notice banner
###2017.11.05
- Initial Release
### 2023.03.27b1
- 🔨 1st beta
]]>
</CHANGES>

<!-- The 'pre-install' script. -->

<FILE Run="/bin/bash">
<INLINE>
# Remove old 'source' files
rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null &#124; grep -v '&version;')
</INLINE>
</FILE>

<!--
The 'source' file.
-->
<FILE Name="/boot/config/plugins/&name;/&name;-&version;-x86_64-1.txz" Run="upgradepkg --install-new">
<URL>https://github.com/&github;/releases/download/v&version;/&name;-&version;-x86_64-1.txz</URL>
<MD5>&md5;</MD5>
</FILE>

<!--
The 'post-install' script
-->
<FILE Run="/bin/bash">
<INLINE>
mkdir -p /tmp/ca.backup2/tempFiles
mkdir -p /var/lib/docker/unraid/ca.backup2.datastore
mkdir -p /boot/config/plugins/ca.backup2/
rm -rf /usr/local/emhttp/plugins/ca.backup2/CA.page
rm -rf /usr/local/emhttp/plugins/ca.backup2/caHelp.page
/usr/local/emhttp/plugins/ca.backup2/scripts/removeCron.php
/usr/local/emhttp/plugins/ca.backup2/scripts/addCron.php
echo ""
echo "----------------------------------------------------"
echo " &name; has been installed."
echo " 2022-2023, Robin Kluth"
echo " 2015-2022, Andrew Zawadzki"
echo " Version: &version;"
echo "----------------------------------------------------"
echo ""
</INLINE>
</FILE>

<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
/usr/local/emhttp/plugins/ca.backup2/scripts/removeCron.php
removepkg &name;-&version;-x86_64-1
rm -rf &plugdir;
rm -rf /boot/config/plugins/&name;
</INLINE>
</FILE>
</CHANGES>


<FILE Run="/bin/bash">
<INLINE>
echo "Checking some pre-install things..."
rm $(ls /boot/config/plugins/&name;/*.tgz 2>/dev/null | grep -v '&version;')
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>&amp;1
</INLINE>
</FILE>

<FILE Run="/bin/bash">
<INLINE>
php &plugdir;/scripts/checkCron.php
echo Adapting some things, because this is beta
rm &plugdir;/*.page
cp &plugdir;/pages/*.page &plugdir;
echo " BETA" >> &plugdir;/README.md
</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!"
php &plugdir;/scripts/checkCron.php --remove
rm -rf &plugdir; 2>/dev/null
rm -rf /boot/config/plugins/&name;
echo "Uninstall done."
</INLINE>
</FILE>
</PLUGIN>
2 changes: 1 addition & 1 deletion src/include/ABSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ABSettings {
public static $pluginDir = '/boot/config/plugins/appdata.backup';
public static $settingsFile = 'config.json';
public static $cronFile = '/etc/cron.d/appdata_backup';
public static $supportUrl = '';
public static $supportUrl = 'https://forums.unraid.net/topic/137710-plugin-appdatabackup/';

public static $tempFolder = '/tmp/appdata.backup';

Expand Down
7 changes: 4 additions & 3 deletions src/pages/content/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,10 @@ class="fa fa-info"></i> Those must return exit code 0 for success detection</sma
href="https://forums.unraid.net/profile/10290-squid/" target="_blank">Andrew Zawadzki</a></dd>

<dt>Want to say "Thank You"?</dt>
<dd>Thanks! 😊 Thanks for using! You must know, <abbr title="All community developers">we</abbr> make those plugins
with ❤️ (and a lot of ☕). If you like, you can donate via <a href="https://paypal.me/robinkluth/"
target="_blank"><i class="fa fa-paypal"></i> PayPal</a>.
<dd>You're welcome! 😊 Thanks for using! <abbr title="All community developers">We</abbr> make those plugins
with ❤️ (and a lot of ☕). If you like the work, you can donate via <a href="https://paypal.me/robinkluth/"
target="_blank"><i
class="fa fa-paypal"></i> PayPal</a>.
</dd>

<dt>GitHub repository</dt>
Expand Down

0 comments on commit 12500b6

Please sign in to comment.