mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 15:11:19 +02:00
Currently, enter_chroot.sh uses a hack to ensure that "--" is preserved in commands. This is only necessary if you want to run commands that start with hyphens. E.g. if you wanted to run a command called "--foo", enter_chroot would break. But we don't have any existing commands that start with hyphens, so this logic seems unnecessary. This also makes enter_chroot more flexible, i.e. we now support case #6 below, which was not supported previously. Here are use cases: 1. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2 -- cmd arg1 arg2 Set env vars and run cmd w/ args 2. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2 Set env vars and run shell 3. ./enter_chroot [chroot_flags] -- cmd arg1 arg2 Run cmd w/ args 4. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2 cmd arg1 arg2 Like #1 _if_ args aren't flags (if they are, enter_chroot will claim them) 5. ./enter_chroot [chroot_flags] cmd arg1 arg2 Like #3 _if_ args aren't flags (if they are, enter_chroot will claim them) 6. ./enter_chroot [chroot_flags] -- VAR1=val1 VAR2=val2 cmd arg1 arg2 Set env vars and run cmd w/ args 7. ./enter_chroot Just enter the chroot. BUG=chromium-os:17468 TEST=Test above cases Change-Id: I1801ac3927aacddd6d556c5939d3a42b31252675 Reviewed-on: http://gerrit.chromium.org/gerrit/3910 Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: David James <davidjames@chromium.org>
Description
Languages
Shell
93.1%
Python
6.9%