mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-27 14:08:18 +03:00
configure: Autodetect docker or podman
This commit is contained in:
parent
de7ac78030
commit
f28e37b95c
@ -81,7 +81,7 @@ documentation for setup instructions (e.g. Arch [Podman][arch-podman] /
|
||||
|
||||
```bash
|
||||
mkdir ../build && cd ../build
|
||||
../proton/configure.sh --container-engine=podman --enable-ccache --build-name=my_build
|
||||
../proton/configure.sh --enable-ccache --build-name=my_build
|
||||
```
|
||||
|
||||
Running `configure.sh` will create a `Makefile` allowing you to build Proton.
|
||||
@ -89,8 +89,9 @@ The scripts checks if containers are functional and prompt you if any
|
||||
host-side dependencies are missing. You should run the command from a
|
||||
directory created specifically for your build.
|
||||
|
||||
The build by default uses Docker, but you can switch to another, compatible
|
||||
engine with `--container-engine=<executable_name>`.
|
||||
The configuration script tries to discover a working Docker or Podman setup
|
||||
to use, but you can force a compatible engine with
|
||||
`--container-engine=<executable_name>`.
|
||||
|
||||
You can enable ccache with `--enable-cache` flag. This will mount your
|
||||
`$CCACHE_DIR` or `$HOME/.ccache` inside the container.
|
||||
|
32
configure.sh
32
configure.sh
@ -61,20 +61,21 @@ dependency_afdko() {
|
||||
CONTAINER_MOUNT_OPTS=""
|
||||
|
||||
check_container_engine() {
|
||||
info "Making sure that the container engine is working."
|
||||
if ! cmd $arg_container_engine run --rm $arg_protonsdk_image; then
|
||||
die "Broken container engine. Please fix your $arg_container_engine setup."
|
||||
stat "Trying $1."
|
||||
if ! cmd $1 run --rm $arg_protonsdk_image; then
|
||||
info "$1 is unable to run the container."
|
||||
return 1
|
||||
fi
|
||||
|
||||
touch permission_check
|
||||
local inner_uid="$($arg_container_engine run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
|
||||
local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
|
||||
--rm $arg_protonsdk_image \
|
||||
stat --format "%u" /test/permission_check 2>&1)"
|
||||
rm permission_check
|
||||
|
||||
if [[ $inner_uid == *"Permission denied"* ]]; then
|
||||
err "The container cannot access files. Are you using SELinux?"
|
||||
die "Please read README.md and check your $arg_container_engine setup works."
|
||||
die "Please read README.md and check your $1 setup works."
|
||||
elif [ "$inner_uid" -eq 0 ]; then
|
||||
# namespace maps the user as root or the build is performed as host's root
|
||||
ROOTLESS_CONTAINER=1
|
||||
@ -82,7 +83,7 @@ check_container_engine() {
|
||||
ROOTLESS_CONTAINER=0
|
||||
else
|
||||
err "File owner's UID doesn't map to 0 or $(id -u) in the container."
|
||||
die "Don't know how to map permissions. Please check your $arg_container_engine setup."
|
||||
die "Don't know how to map permissions. Please check your $1 setup."
|
||||
fi
|
||||
}
|
||||
|
||||
@ -141,9 +142,20 @@ function configure() {
|
||||
fi
|
||||
|
||||
if [[ -n "$arg_container_engine" ]]; then
|
||||
check_container_engine
|
||||
check_container_engine "$arg_container_engine" || die "Specified container engine \"$arg_container_engine\" doesn't work"
|
||||
else
|
||||
stat "Trying to find usable container engine."
|
||||
if check_container_engine docker; then
|
||||
arg_container_engine="docker"
|
||||
elif check_container_engine podman; then
|
||||
arg_container_engine="podman"
|
||||
else
|
||||
die "${arg_container_engine:-Container engine discovery} has failed. Please fix your setup."
|
||||
fi
|
||||
fi
|
||||
|
||||
stat "Using $arg_container_engine."
|
||||
|
||||
## Write out config
|
||||
# Don't die after this point or we'll have rather unhelpfully deleted the Makefile
|
||||
[[ ! -e "$MAKEFILE" ]] || rm "$MAKEFILE"
|
||||
@ -190,7 +202,7 @@ arg_steamrt="soldier"
|
||||
arg_protonsdk_image="registry.gitlab.steamos.cloud/proton/soldier/sdk:0.20211207.0-0"
|
||||
arg_no_protonsdk=""
|
||||
arg_build_name=""
|
||||
arg_container_engine="docker"
|
||||
arg_container_engine=""
|
||||
arg_docker_opts=""
|
||||
arg_relabel_volumes=""
|
||||
arg_enable_ccache=""
|
||||
@ -291,8 +303,8 @@ usage() {
|
||||
"$1" ""
|
||||
"$1" " --build-name=<name> Set the name of the build that displays when used in Steam"
|
||||
"$1" ""
|
||||
"$1" " --container-engine=<engine> Which container Docker-compatible container engine to use,"
|
||||
"$1" " e.g. podman. Defaults to docker."
|
||||
"$1" " --container-engine=<engine> Which Docker-compatible container engine to use,"
|
||||
"$1" " e.g. podman. Tries to do autodiscovery when not specified."
|
||||
"$1" ""
|
||||
"$1" " --docker-opts='<options>' Extra options to pass to Docker when invoking the runtime."
|
||||
"$1" ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user