proxmox-backup-file-restore: fix various postinst bugs/bad-behavior

1. The exit was never called as `test ... || echo "foo" || exit 1`
   can never come to the exit, as echo will not fail

2. The echo was meant to be redirected to stderr (FD #2) but it was
   actually redirected to a file named '2'

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-04-13 11:39:54 +02:00
parent 646fc7f086
commit 6fed819dc2

View File

@ -11,9 +11,10 @@ update_initramfs() {
# not want an unuseable image lying around
rm -f "$CACHE_PATH"
[ -f "$INST_PATH/initramfs.img" ] || \
echo "proxmox-backup-restore-image is not installed correctly" >2 || \
exit 1
if [ ! -f "$INST_PATH/initramfs.img" ]; then
echo "proxmox-backup-restore-image is not installed correctly, skipping update" >&2
exit 0
fi
echo "Updating file-restore initramfs..."