Skip to content

Commit

Permalink
Update document
Browse files Browse the repository at this point in the history
  • Loading branch information
Moe-hacker committed Jun 24, 2024
1 parent 802b03c commit cbfa9fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Usage: ./configure [OPTION]...

# Usage:
```
ruri 3.2
ruri 3.3
Lightweight, User-friendly Linux-container Implementation
Expand Down Expand Up @@ -81,17 +81,19 @@ ARGS:
-k, --keep [cap] ....................: Keep the specified cap
-d, --drop [cap] ....................: Drop the specified cap
-e, --env [env] [value] .............: Set environment variables to its value (**)
-m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint
-m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint (***)
-M, --ro-mount [dir/dev/img] [dir] ..: Mount dir/block-device/image as read-only
-S, --host-runtime ..................: Bind-mount /dev/, /sys/ and /proc/ from host
-R, --read-only .....................: Mount / as read-only
-l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(***)
-l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(****)
-w, --no-warnings ...................: Disable warnings
(*) : `-a` option also need `-q` is set
(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`
(***): Each `-l` option can only set one of the cpuset/memory limits
(***): for example: `ruri -l memory=1M -l cpuset=1 /test`
Note:
(*) : `-a` option also need `-q` is set
(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`
(***) : You can use `-m [source] /` to mount a block device as root
(****): Each `-l` option can only set one of the cpuset/memory limits
for example: `ruri -l memory=1M -l cpuset=1 /test`
```
# Quick start(with rootfstool):
## Download and unpack a rootfs:
Expand Down
14 changes: 8 additions & 6 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,19 @@ void show_helps(void)
cprintf("{base} -k, --keep [cap] ....................: Keep the specified cap\n");
cprintf("{base} -d, --drop [cap] ....................: Drop the specified cap\n");
cprintf("{base} -e, --env [env] [value] .............: Set environment variables to its value (**)\n");
cprintf("{base} -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint\n");
cprintf("{base} -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint (***)\n");
cprintf("{base} -M, --ro-mount [dir/dev/img] [dir] ..: Mount dir/block-device/image as read-only\n");
cprintf("{base} -S, --host-runtime ..................: Bind-mount /dev/, /sys/ and /proc/ from host\n");
cprintf("{base} -R, --read-only .....................: Mount / as read-only\n");
cprintf("{base} -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(***)\n");
cprintf("{base} -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(****)\n");
cprintf("{base} -w, --no-warnings ...................: Disable warnings\n");
cprintf("\n");
cprintf("{base}(*) : `-a` option also need `-q` is set\n");
cprintf("{base}(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`\n");
cprintf("{base}(***): Each `-l` option can only set one of the cpuset/memory limits\n");
cprintf("{base}(***): for example: `ruri -l memory=1M -l cpuset=1 /test`\n");
cprintf("{base}Note:\n");
cprintf("{base}(*) : `-a` option also need `-q` is set\n");
cprintf("{base}(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`\n");
cprintf("{base}(***) : You can use `-m [source] /` to mount a block device as root\n");
cprintf("{base}(****): Each `-l` option can only set one of the cpuset/memory limits\n");
cprintf("{base} for example: `ruri -l memory=1M -l cpuset=1 /test`\n");
cprintf("{base}{clear}\n");
}
// For `ruri -H`.
Expand Down
1 change: 1 addition & 0 deletions src/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static char *losetup(const char *img)
// Mount dev/dir/img to target.
int trymount(const char *source, const char *target, unsigned int mountflags)
{
// umount target before mount(2), to avoid `device or resource busy`.
umount2(target, MNT_DETACH | MNT_FORCE);
int ret = 0;
// Check if mountpoint exists.
Expand Down

0 comments on commit cbfa9fd

Please sign in to comment.