Changeset 2167


Ignore:
Timestamp:
Sep 19, 2012, 3:22:31 PM (7 years ago)
Author:
matthijs
Message:

luci: Move config migration to a separate script.

Before, any config migration (currently only ddns config upgrade) was
handled by save-config.sh. This caused it to run during every upgrade,
so upgrades were seamless.

However, if a user would restore a settings backup after the upgrade
(which shouldn't be needed, but it gives users a safe feeling), the
migration would not be run again, causing the old config to overwrite
the migrated config.

This commit puts the migration code into a separate script, which is run
after upgrades and after a settings restore.

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/modules/admin-fon/root/sbin/save-config.sh

    r2093 r2167  
    1818sh << 'END_OF_SUBSCRIPT' > /etc/uci-defaults/zzz-upgrade
    1919. /etc/functions.sh
    20 
    21 # If the ddns config does not contain a new-style config section, for
    22 # use with ddns-scripts, have one created. This is mostly useful for
    23 # upgrades, but no harm in runing this on config backups as well.
    24 config_load 'ddns'
    25 if [ -z "$(config_get ddns_scripts TYPE)" ]; then
    26         echo "uci set ddns.ddns_scripts=service"
    27         srv="$(config_get ddns srv)"
    28         if [ -n "$srv" -a "$srv" != "none" ]; then
    29                 echo "uci set 'ddns.ddns_scripts.enabled=1'"
    30                 echo "uci set 'ddns.ddns_scripts.service_name=dyndns.org'"
    31                 echo "uci set 'ddns.ddns_scripts.username=$(config_get ddns user)'"
    32                 echo "uci set 'ddns.ddns_scripts.password=$(config_get ddns pass)'"
    33                 echo "uci set 'ddns.ddns_scripts.domain=$(config_get ddns dns)'"
    34                 echo "uci set 'ddns.ddns_scripts.ip_source=none'"
    35         fi
    36         echo "uci delete ddns.ddns"
    37 fi
    3820
    3921# Preserve the pass_good variable, which seems to be the only
  • trunk/openwrt/package/base-files/files/etc/preinit

    r1615 r2167  
    8080                tar xzf /tmp/sysupgrade.tgz
    8181                rm -f /tmp/sysupgrade.tgz
     82                # After running the zzz-upgrade script from the settings
     83                # backup, run the config migration as well for any
     84                # outdated config
     85                ln -s /sbin/migrate-config.sh /etc/uci-defaults/zzz-upgrade-migrate
    8286                sync
    8387        }
Note: See TracChangeset for help on using the changeset viewer.