summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-05-24 03:30:41 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-05-24 03:31:37 (EDT)
commit32aa2827d8de16879bb4e92c1235ef5b10f23e2c (patch)
treeaa35416933a383ceac81b8267bda5f79af50b19c
parentfb23c0bd36f8ffae7ab14b23ce0a2e7985b8c858 (diff)
cmd/build: Accept block device as root
-rw-r--r--lib/cmd/build.sh15
-rw-r--r--man/prokit-build.8in5
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/cmd/build.sh b/lib/cmd/build.sh
index 32dca26..d22fa1e 100644
--- a/lib/cmd/build.sh
+++ b/lib/cmd/build.sh
@@ -18,6 +18,7 @@
# along with the ProteanOS Development Kit. If not, see
# <http://www.gnu.org/licenses/>.
+use block
use profile
use session
use rand
@@ -31,6 +32,7 @@ cmd_build_build_deps=
cmd_build_main()
{
local root=
+ local dev=
local opkbuild_optstring=
local arch=
local plat=
@@ -43,9 +45,16 @@ cmd_build_main()
fi
root="${1}"
- cmd_build_root="${root}"
shift 1
+ dev=''
+ if is_block "${root}"; then
+ dev="${root}"
+ root="$(block_mount "${dev}")"
+ fi
+
+ cmd_build_root="${root}"
+
opkbuild_optstring="$(cat "${root}/usr/share/opkbuild/optstring")"
arch="$(cat "${root}/etc/proteanos_arch")"
plat="$(cat "${root}/etc/proteanos_plat")"
@@ -91,6 +100,10 @@ cmd_build_main()
cmd_build_fini
session_end
+
+ if [ "x${dev}" != 'x' ]; then
+ block_umount "${root}"
+ fi
}
cmd_build_make_deps_pkg()
diff --git a/man/prokit-build.8in b/man/prokit-build.8in
index 77ed078..5dc25de 100644
--- a/man/prokit-build.8in
+++ b/man/prokit-build.8in
@@ -5,12 +5,15 @@
prokit-build \- Build a package
.SH SYNOPSIS
-\fBprokit build\fP \fIroot-dir\fP [\fIoption\fP ...] \fIpkg-dir\fP
+\fBprokit build\fP \fIroot\fP [\fIoption\fP ...] \fIpkg-dir\fP
.SH DESCRIPTION
\fBprokit build\fP runs \fBopkbuild\fP to build a package in an isolated file
system environment, temporarily installing any missing build dependencies.
.P
+If \fIroot\fP is a block device node, the block device is mounted and
+\fBopkbuild\fP is run in its file system.
+.P
\fIoption\fPs are \fBopkbuild\fP options. Run \fIprokit build -h .\fP for more
information.
.P