From 710ff5b186d67353bb1787093dc048126f812363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=B6hmke?= Date: Sun, 15 Dec 2019 16:55:18 +0100 Subject: [PATCH] fixed remount of uboot partition --- update.go | 9 +++++---- update_test.go | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/update.go b/update.go index 630c98c..4d3fee9 100644 --- a/update.go +++ b/update.go @@ -13,9 +13,10 @@ import ( "os/exec" ) +var mountCommand = "mount" var ubootFile = "/uboot/uboot.dat" -var ubootRemountRW = "mount -o remount,rw /uboot" -var ubootRemountRO = "mount -o remount,ro /uboot" +var ubootRemountRW = []string{"-o", "remount,rw", "/uboot"} +var ubootRemountRO = []string{"-o", "remount,ro", "/uboot"} var rootPartitionA = "/dev/mmcblk0p2" var rootPartitionB = "/dev/mmcblk0p3" @@ -53,7 +54,7 @@ func saveUbootDat(data []byte) error { crc32.ChecksumIEEE(data[:1020])) // remount boot partition - writable - cmd := exec.Command(ubootRemountRW) + cmd := exec.Command(mountCommand, ubootRemountRW...) err := cmd.Run() if err != nil { return fmt.Errorf("failed to remount RW: %w", err) @@ -66,7 +67,7 @@ func saveUbootDat(data []byte) error { } // remount boot partition - readonly - cmd = exec.Command(ubootRemountRO) + cmd = exec.Command(mountCommand, ubootRemountRO...) err = cmd.Run() if err != nil { return fmt.Errorf("failed to remount RO: %w", err) diff --git a/update_test.go b/update_test.go index d506b74..290e040 100644 --- a/update_test.go +++ b/update_test.go @@ -15,8 +15,7 @@ import ( func init() { ubootFile = "test_uboot" - ubootRemountRW = "true" - ubootRemountRO = "true" + mountCommand = "true" rootPartitionA = "test_rootA" rootPartitionB = "test_rootB" }