Changeset 1840

Show
Ignore:
Timestamp:
06/01/11 14:44:04 (2 years ago)
Author:
matthijs
Message:

luci: Make the settings backup complete.

Previously, the settings backup would include complete files in a
tarball that becomes the backup. This missed out on a lot of settings,
because they were contained in files that could not be backed up
completely (because parts of them could vary between firmware versions).

This commit puts the creation of the tarball into a new script,
/sbin/save-config.sh. Before creating the tarball, this script
cherry-picks some settings from various files and generates uci commands
to restore those settings. These commands are saved within the tarball,
so they will be run after a settings restore.

Note that this save-config.sh script is also intended to be used inside
released firmware tarballs, so all settings are also preserved on
upgrades.

This commit adds the following settings to the backup:

  • The password strength (used for enabling SSH on WAN).
  • The firewall->applications settings.
  • The downloadmanager settings, logins and download list. These were already backed up, but now only the necessary settings are backed up instead of the entire file. These were also not preserved on an upgrade yet.
  • QoS settings.
  • OpenVPN settings, keys and clients.
  • The WebGUI language.
  • Static DHCP assignments.
  • The Flickr/Picasa/Youtube/Facebook? uploader settings.

Closes: #633

Location:
trunk/luci/modules/admin-fon
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/luci/modules/admin-fon/luasrc/controller/fon_admin/fon_admin.lua

    r1819 r1840  
    167167        local http = require "luci.http" 
    168168        http.prepare_content("application/octet-stream") 
    169         os.execute("tar cvzf /tmp/sysupgrade.tgz /etc/passwd /etc/group /etc/dropbear /etc/samba/smbpasswd /etc/samba/secrets.tdb /etc/config/firewall /etc/config/upnpd /etc/config/umtsd /etc/config/registered /etc/config/gdata /etc/config/facebook /etc/config/flickr /etc/config/mountd /etc/config/fon /etc/config/ddns /etc/config/wizard /etc/pureftpd.passwd /etc/pureftpd.pdb /etc/config/pureftpd /etc/config/samba /etc/config/luci_dlmanager /etc/config/twitter") 
     169        -- Call a script to create a configuration backup 
     170        os.execute("/sbin/save-config.sh") 
    170171        local f = luci.fs.readfile("/tmp/sysupgrade.tgz") 
     172        -- Prepend a very crude marker, so we can recognize a settings 
     173        -- backup when restoring below. 
    171174        http.write("UI"..f) 
    172175end 
     
    248251        if fname and type then 
    249252                if type == "ui" then 
     253                        -- Put the settings file into /sysupgrade.tgz. 
     254                        -- The file will be unpacked by /etc/preinit 
     255                        -- after the reboot. 
    250256                        os.execute("dd if="..tmpfile.." of=/sysupgrade.tgz bs=1 skip=2; sync"); 
    251257                        luci.http.header("Set-Cookie", "sysauth=; path=/")