scripts: refactor for reliability

This is a small refactor/rewrite pass to scripts/create_container.sh and
scripts/bin/bazel.

First of all, it moves the IntelliJ aspect overriding logic from parsing
command line flags in scripts/bin/bazel to replace the path that the
aspect is loaded from to crafting the build container in a way that the
aspect is already located where it's expected.

This allows us to vastly simplify the scripts/bin/bazel wrapper, and
most notably fixes an issue where it wasn't able to handle Bazel flags
that contained spaces and were wrapped in ""/'' delimited strings.
Instead of adding more and more flag replacing logic in this script, we
got rid of that logic entirely, and now the only thing that the wrapper
script does is set the output root and run Bazel within the container.

At the same time, we also fix discovering newer IntelliJ versions. On my
machine, it was still discovering my 2019 installation and using an old
version of the aspect.

We also generally dust off the scripts/create_container.sh script by
ensuring all variables are always used within double quotes (the
previous implementation could've accidentally removed some directory from
the host if the user homedir contained spaces) and moving all of the
logic into a function that uses local variables.

Tested on my local workstation, IntelliJ sync works.

Change-Id: I63ae042ffe0fc7f384b98768ed66b7426b3f5df4
Reviewed-on: https://review.monogon.dev/c/monogon/+/63
Reviewed-by: Leopold Schabel <leo@nexantic.com>
diff --git a/scripts/bin/bazel b/scripts/bin/bazel
index 3d4bea7..09cca51 100755
--- a/scripts/bin/bazel
+++ b/scripts/bin/bazel
@@ -1,11 +1,4 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
-# Override the intellij_aspect repository to point to our own copy that create_container.sh has applied patches to.
-#
-# The IntelliJ plugin sets the repository using a command line argument, which we need to replace:
-#   --override_repository=intellij_aspect=<...>/plugins/ijwb/aspect
-#
-ARGS=$(echo $@ | sed "s%--override_repository=intellij_aspect=[^ ]*%--override_repository=intellij_aspect=${HOME}/.cache/bazel-monogon/ijwb_aspect%")
-
-exec podman exec -it monogon-dev bazel --output_user_root ${HOME}/.cache/bazel-monogon $ARGS
+exec podman exec -it monogon-dev bazel --output_user_root ${HOME}/.cache/bazel-monogon "$@"