Skip to content

Commit

Permalink
create, enter: use eval to execute the generated command, remove shel…
Browse files Browse the repository at this point in the history
…lcheck exception SC2091
  • Loading branch information
89luca89 committed Dec 6, 2021
1 parent 7b2585d commit 8084b58
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# uses: luizm/action-sh-checker@7f44869033b40ee4ffe7dc76c87a1bc66e3d025a
uses: luizm/[email protected]
env:
SHELLCHECK_OPTS: -o all -Cnever -Sstyle -a -f gcc -x -e SC2091
SHELLCHECK_OPTS: -o all -Cnever -Sstyle -a -f gcc -x
SHFMT_OPTS: -s # arguments to shfmt.
with:
sh_checker_comment: false
Expand Down
7 changes: 4 additions & 3 deletions distrobox-create
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ generate_command() {
echo "--log-level debug"
fi
echo "--dns none
--env XDG_RUNTIME_DIR=/run/user/${container_user_uid}
--env=\"XDG_RUNTIME_DIR=/run/user/${container_user_uid}\"
--hostname ${container_name}
--ipc host"
# if [ -f /dev/pts ]; then
Expand All @@ -126,7 +126,7 @@ generate_command() {
#
# also mount the distrobox-init utility as the container entrypoint
echo "--name ${container_name}
--env=SHELL=${SHELL}
--env=\"SHELL=${SHELL}\"
--network host
--no-hosts
--pid host
Expand Down Expand Up @@ -189,4 +189,5 @@ if ! podman image exists "${container_image}"; then
fi

# Generate the command and execute
$(generate_command)
# shellcheck disable=SC2046
eval $(generate_command)
5 changes: 3 additions & 2 deletions distrobox-enter
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ generate_command() {
echo "--env=DISTROBOX_ENTER_PATH=$(command -v distrobox-enter)"
# exporting current environment to container
for i in $(printenv); do
echo "--env=${i}"
echo "--env=\"${i}\""
done
# run selected pod with command+args
echo "${container_name} ${container_command}"
}

# Generate the command and execute
$(generate_command)
# shellcheck disable=SC2046
eval $(generate_command)

0 comments on commit 8084b58

Please sign in to comment.