base-files: sysupgrade: fix streaming backup archives to stdout
authorJo-Philipp Wich <jo@mein.io>
Mon, 4 Mar 2024 13:50:46 +0000 (14:50 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 4 Mar 2024 13:58:10 +0000 (14:58 +0100)
commit6f6406a1321b4ead1d61abdea450d7c76bd5a927
tree7ee1463c93b0630362ca256280bf2915c7a69ac2
parentfbb924abff8af9e69ec90d7bf099046c24145b74
base-files: sysupgrade: fix streaming backup archives to stdout

Due to previous refactoring in sysupgrade, writing backup archives to
stdout became impossible since the hardcoded gzip output redirection
did not account for the `-` special case filename.

Fix this issue by substituting `-` with `/proc/self/fd/1` in the tar
archive output path variable.

Also remove a redundant `rm -f` of the target file path that occurs
before the file could've possibly been written.

Fixes: #14773
Fixes: https://github.com/openwrt/luci/issues/6961
Fixes: e36cc53092 ("base-files: sysupgrade: use tar helper to include installed_packages.txt")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/base-files/files/sbin/sysupgrade