Message ID | 20240304071558.28825-1-zajec5@gmail.com |
---|---|
State | Handled Elsewhere |
Delegated to: | Rafał Miłecki |
Headers | show |
Series | base-files: sysupgrade: fix generating backup to stdout | expand |
On 4.03.2024 08:15, Rafał Miłecki wrote: > From: Rafał Miłecki <rafal@milecki.pl> > > Before recent change "tar" command was called with an "-f" argument > which accepts "-" for stdout output. Bring back support for that feature > with new code. > > Fixes: e36cc530927c ("base-files: sysupgrade: use tar helper to include installed_packages.txt") > Fixes: https://github.com/openwrt/openwrt/issues/14773 > Cc: Jo-Philipp Wich <jo@mein.io> > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Obsoleted by the commit 6f6406a1321b ("base-files: sysupgrade: fix streaming backup archives to stdout") https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6f6406a1321b4ead1d61abdea450d7c76bd5a927
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 78ec455067..b1a7335bc0 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -236,12 +236,15 @@ include /lib/upgrade create_backup_archive() { local conf_tar="$1" + local output_file="" local disabled + [ "$conf_tar" != "-" ] && output_file="$conf_tar" + [ "$(rootfs_type)" = "tmpfs" ] && { echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit - rm -f "$conf_tar" + [ -n "$output_file" ] && rm -f "$output_file" return 0 } run_hooks "$CONFFILES" $sysupgrade_init_conffiles @@ -272,12 +275,12 @@ create_backup_archive() { # Rest of archive with config files and ending padding tar c${TAR_V} -C / -T "$CONFFILES" - } | gzip > "$conf_tar" + } | gzip > "${output_file:-/dev/stdout}" local err=$? if [ "$err" -ne 0 ]; then echo "Failed to create the configuration backup." - rm -f "$conf_tar" + [ -n "$output_file" ] && rm -f "$output_file" fi rm -f "$CONFFILES"