From c5dc1d55493b567ff1d962f2bb7a7ac81da94108 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 24 May 2015 02:10:48 -0400 Subject: cmd/opkg: Accept block device as root --- diff --git a/lib/cmd/opkg.sh b/lib/cmd/opkg.sh index 9f0c0de..51b90dc 100644 --- a/lib/cmd/opkg.sh +++ b/lib/cmd/opkg.sh @@ -18,6 +18,7 @@ # along with the ProteanOS Development Kit. If not, see # . +use block use profile use session use rand @@ -27,6 +28,7 @@ cmd_opkg_opks= cmd_opkg_main() { local root= + local dev= local first_arg= local install_cmd= local arg= @@ -40,6 +42,12 @@ cmd_opkg_main() root="${1}" shift 1 + dev='' + if is_block "${root}"; then + dev="${root}" + root="$(block_mount "${dev}")" + fi + first_arg=true install_cmd=false cmd_opkg_opks='' @@ -84,6 +92,10 @@ cmd_opkg_main() cmd_opkg_fini session_end + + if [ "x${dev}" != 'x' ]; then + block_umount "${root}" + fi } cmd_opkg_fini() diff --git a/man/prokit-opkg.8in b/man/prokit-opkg.8in index cfe8e9f..50b845a 100644 --- a/man/prokit-opkg.8in +++ b/man/prokit-opkg.8in @@ -5,12 +5,15 @@ prokit-opkg \- Manage packages with opkg .SH SYNOPSIS -\fBprokit opkg\fP \fIroot-dir\fP [\fIoption\fP ...] \fIsub-command\fP +\fBprokit opkg\fP \fIroot\fP [\fIoption\fP ...] \fIsub-command\fP [\fIargument\fP ...] .SH DESCRIPTION \fBprokit opkg\fP runs \fBopkg\fP in an isolated file system environment. .P +If \fIroot\fP is a block device node, the block device is mounted and \fBopkg\fP +is run in its file system. +.P \fIoption\fPs are \fBopkg\fP options and \fIsub-command\fP is an \fBopkg\fP sub-command. See the usage information for \fBopkg\fP for more information. .P -- cgit v0.9.1