image_signing: set_lsb_release: simplify file rewriting

Collapse the 4 sudo calls & temporary file into a single call.
This is a bit easier to read and is faster as a result.

We can also hoist the selinux restore to do it only once at the
end if we modified the file.

BUG=None
TEST=set_lsb_release.sh on an image still works
BRANCH=None

Change-Id: I300cf47d017d159d762a62fe2aab789ce391f89a
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2923826
Reviewed-by: George Engelbrecht <engeg@google.com>
1 file changed