From eddb79507aa2ce4dbf8960bd31cb96c8310d414c Mon Sep 17 00:00:00 2001
From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Date: Sat, 4 May 2013 20:51:59 +1200
Subject: [PATCH] Build: Add option to use sudo when creating a disk image.
When creating a custom build profile to write to a physical
partition such as /dev/sda57, on some systems sudo needs to
be invoked.
This patch lets you set HAIKU_REQUIRES_SUDO = 1 in a user
build config so that when writing to the partition, it is
invoked using sudo, rather than running the entire build
with sudo.
---
build/jam/ImageRules | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/build/jam/ImageRules b/build/jam/ImageRules
index 7e27bc5..8829c6e 100644
a
|
b
|
rule BuildHaikuImage haikuImage : scripts : isImage : isVMwareImage
|
1026 | 1026 | SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; |
1027 | 1027 | |
1028 | 1028 | Depends $(haikuImage) : $(mainScript) $(scripts) ; |
1029 | | BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ; |
| 1029 | |
| 1030 | if $(HAIKU_REQUIRES_SUDO) = 1 { |
| 1031 | BuildHaikuImageWithSudo1 $(haikuImage) : $(mainScript) $(scripts) ; |
| 1032 | } else { |
| 1033 | BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ; |
| 1034 | } |
1030 | 1035 | } |
1031 | 1036 | |
1032 | 1037 | actions BuildHaikuImage1 |
… |
… |
actions BuildHaikuImage1
|
1037 | 1042 | $(2[1]) $(2[2-]) |
1038 | 1043 | } |
1039 | 1044 | |
| 1045 | actions BuildHaikuImageWithSudo1 |
| 1046 | { |
| 1047 | export imagePath="$(1)" |
| 1048 | export isImage="$(IS_IMAGE)" |
| 1049 | export isVMwareImage="$(IS_VMWARE_IMAGE)" |
| 1050 | sudo $(2[1]) $(2[2-]) |
| 1051 | } |
| 1052 | |
1040 | 1053 | rule BuildVMWareImage vmwareImage : plainImage : imageSize |
1041 | 1054 | { |
1042 | 1055 | # BuildVMWareImage <vmware image> : <plain image> : <image size in MB> |