[LEDE-DEV] [PATCH] base-files: do not backup unchanged files
Matthias Schiffer
mschiffer at universe-factory.net
Fri Nov 17 02:35:03 PST 2017
On 11/17/2017 10:14 AM, Jonas Gorski wrote:
> On 17 November 2017 at 01:41, <luizluca at gmail.com> wrote:
>> From: Luiz Angelo Daros de Luca <luizluca at gmail.com>
>>
>> Only backup /aaa/bbb/ccc if /rom/aaa/bbb/ccc does not exist
>> or /aaa/bbb/ccc is different from /rom/aaa/bbb/ccc.
>>
>> Signed-off-by: Luiz Angelo Daros de Luca <luizluca at gmail.com>
>> ---
>> package/base-files/files/sbin/sysupgrade | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
>> index 359f21f51c..0085dbe07e 100755
>> --- a/package/base-files/files/sbin/sysupgrade
>> +++ b/package/base-files/files/sbin/sysupgrade
>> @@ -101,8 +101,10 @@ add_uci_conffiles() {
>> local file="$1"
>> ( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
>> /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
>> - -type f -o -type l 2>/dev/null;
>> - opkg list-changed-conffiles ) | sort -u > "$file"
>> + $(opkg list-changed-conffiles) \
>> + \( -type f -o -type l \) \
>> + \( \( -exec test -e /rom{} \; -exec cmp -s {} /rom{} \; \) -o -print \) 2>/dev/null;
>> + ) | sort -u > "$file"
>
> "opkg list-changed-conffiles" should have already filtered by that
> (but obviously didn't), so the issue should be fixed at the source
> instead of being worked around.
`opkg list-changed-conffiles` does filter for changed files - but the files
listed in /etc/sysupgrade.conf or /lib/upgrade/keep.d are backed up
unconditionally. I'm not sure which behaviour the average admin would
expect - but I'm not happy about the different handling of config files
managed by opkg and the other file lists.
I don't like adding overlay-specific logic here, sysupgrade should work
"the same" on all targets, with or without overlay. Maybe we can rather
filter out unchanged files *after* the sysupgrade (after a major config
backup rework I guess - but I heard people are thinking about a generic
tar-based backup approach for sysupgrades).
Another issue with this patch: it breaks for filenames with spaces in the
opkg list-changed-conffiles output (might or might not be an actual issue,
but something to keep in mind).
Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20171117/aae8fdce/attachment.sig>
More information about the Lede-dev
mailing list