Skip to content

Commit 1f984e4

Browse files
committed
feat: add devtool cargo command
Add command to run any cargo command from inside container without needing to enter it. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent e7df1b1 commit 1f984e4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tools/devtool

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,28 @@ cmd_build() {
526526
return $ret
527527
}
528528

529+
cmd_cargo() {
530+
# Check prerequisites
531+
ensure_devctr
532+
ensure_build_dir
533+
534+
workdir="$CTR_FC_ROOT_DIR"
535+
536+
# Run the cargo build process inside the container.
537+
# We don't need any special privileges for the build phase, so we run the
538+
# container as the current user/group.
539+
run_devctr \
540+
--privileged \
541+
--workdir "$workdir" \
542+
-- \
543+
cargo $@
544+
ret=$?
545+
546+
# Running as root would have created some root-owned files under the build
547+
# dir. Let's fix that.
548+
cmd_fix_perms
549+
}
550+
529551
function cmd_make_release {
530552
ensure_build_dir
531553
run_devctr \

0 commit comments

Comments
 (0)