summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-05-24 02:10:48 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-05-24 02:10:48 (EDT)
commitc5dc1d55493b567ff1d962f2bb7a7ac81da94108 (patch)
tree996814f336bb8aed390b001164acac827a00f3dc
parentee3f67f2b0e053b29a142dd6ee8e8cc8f020022d (diff)
cmd/opkg: Accept block device as root
-rw-r--r--lib/cmd/opkg.sh12
-rw-r--r--man/prokit-opkg.8in5
2 files changed, 16 insertions, 1 deletions
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
# <http://www.gnu.org/licenses/>.
+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