Skip to content
Permalink
Browse files

config option for backup configuration (close #198)

  • Loading branch information...
hobbyquaker committed May 4, 2019
1 parent 650e9d3 commit ba7ae38422b5981c91fbacdc49b66631a64092be
Showing with 41 additions and 12 deletions.
  1. +21 −0 addon_files/redmatic/bin/redmatic
  2. +7 −1 addon_files/redmatic/www/js/script.js
  3. +13 −0 addon_files/redmatic/www/settings.html
  4. +0 −11 build.sh
@@ -47,12 +47,33 @@ Stop () {
}

Start () {
if [ `$ADDON_DIR/bin/jq -r '.ccuBackup' $ADDON_DIR/etc/settings.json` = "full" ]; then
rm $ADDON_DIR/bin/.nobackup 2>/dev/null
rm $ADDON_DIR/include/.nobackup 2>/dev/null
rm $ADDON_DIR/lib/.nobackup 2>/dev/null
rm $ADDON_DIR/libexec/.nobackup 2>/dev/null
rm $ADDON_DIR/share/.nobackup 2>/dev/null
rm $ADDON_DIR/tmp/.nobackup 2>/dev/null
#rm $ADDON_DIR/var/node_modules/.nobackup 2>/dev/null
rm $ADDON_DIR/www/.nobackup 2>/dev/null
else
touch $ADDON_DIR/bin/.nobackup
touch $ADDON_DIR/include/.nobackup
touch $ADDON_DIR/lib/.nobackup
touch $ADDON_DIR/libexec/.nobackup
touch $ADDON_DIR/share/.nobackup
touch $ADDON_DIR/tmp/.nobackup
#touch $ADDON_DIR/var/node_modules/.nobackup
touch $ADDON_DIR/www/.nobackup
fi

if [ -f $ADDON_DIR/var/do_pkg_upgrade ]; then
echo "Updating Packages"
date +"%b %d %H:%M:%S" >> $ADDON_DIR/var/pkg-upgrade.log
$ADDON_DIR/bin/redmatic-pkg upgrade 2>&1 | tee -a $ADDON_DIR/var/pkg-upgrade.log | logger -t redmatic-pkg -p daemon.info && rm $ADDON_DIR/var/do_pkg_upgrade
sleep 1
fi

if ! grep -Fq "/etc/config/lighttpd/" $LIGHTTPD_CONF
then
echo "patching $LIGHTTPD_CONF"
@@ -30,6 +30,7 @@ $(document).ready(() => {
const $staticauthSet = $('#staticauth-set');

const $projects = $('#projects');
const $backup = $('#backup');

const $alertSaved = $('#alert-saved');
const $alertError = $('#alert-error');
@@ -326,7 +327,7 @@ $(document).ready(() => {
$contextStorageFileInterval.val(config.contextStorage.file.config.flushInterval);

$('#autorestart').find('option[value="' + config.restartOnCrash + '"]').attr('selected', true);

$('#backup').find('option[value="' + config.ccuBackup + '"]').attr('selected', true);
});

$loglevel.change(() => {
@@ -670,6 +671,11 @@ $(document).ready(() => {
save();
});

$backup.on('change', () => {
config.ccuBackup = $backup.val();
save();
});

$('#discard-package-hint').on('click', () => {
localStorage.setItem('package-hint', 'discarded');
$('#package-hint').hide();
@@ -91,6 +91,19 @@
</div>
</div>
</div>

<div class="card mb-4 pr-4">
<div class="card-body">
<div class="form-group">
<label for="projects">Backup</label>
<select class="form-control" id="backup">
<option value="reduce">Reduce size - only include relevant data</option>
<option value="full">Include everything - Warning: this can lead to problems!</option>
</select>
</div>
</div>
</div>

<div class="card mb-4 pr-4">
<div class="card-body">
<div class="form-group">
@@ -65,17 +65,6 @@ echo "installing www node modules"
cd $ADDON_TMP/redmatic/www
npm install --silent --no-package-lock --production --no-optional

echo "create .nobackup files"
touch $ADDON_TMP/redmatic/bin/.nobackup
touch $ADDON_TMP/redmatic/include/.nobackup
touch $ADDON_TMP/redmatic/lib/.nobackup
touch $ADDON_TMP/redmatic/libexec/.nobackup
touch $ADDON_TMP/redmatic/share/.nobackup
touch $ADDON_TMP/redmatic/tmp/.nobackup
#touch $ADDON_TMP/redmatic/var/node_modules/.nobackup
touch $ADDON_TMP/redmatic/www/.nobackup


echo "adapt Node-RED..."
rm -r $ADDON_TMP/redmatic/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware

0 comments on commit ba7ae38

Please sign in to comment.
You can’t perform that action at this time.