From f69cb8689c7b945c3664a0384959e45c7dc42f72 Mon Sep 17 00:00:00 2001 From: giomba Date: Fri, 9 Dec 2022 20:14:02 +0100 Subject: [PATCH] Update docker-wine. --- docker-wine | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/docker-wine b/docker-wine index 0ff5607..e459dc2 100755 --- a/docker-wine +++ b/docker-wine @@ -17,6 +17,8 @@ print_help () { echo " --tag=VALUE Specify an image tag to use (default is latest)" echo " --name=VALUE Name of the docker container instantiated" echo " (default is 'wine')" + echo " --arm64 Start the containter using linux/arm64 platform for ARM" + echo " and Apple Silicon (M1) native image" echo " --as-root Start the container as root" echo " --as-me Start the container using your current username, UID and" echo " GID (default when alternate --home value specified)" @@ -67,6 +69,7 @@ print_help () { echo " container (default is /home/\$USER)" echo " --force-owner Allow the user to take ownership of a home volume that" echo " belongs to another user (NOTE: Use with caution!)" + echo " --nosudo Disable sudo for the user" echo " --password=VALUE Specify a password for the user in plain text (default" echo " is the user's username)" echo " --password-prompt Prompt to set a password for the user" @@ -76,6 +79,9 @@ print_help () { echo " --env=VALUE Specify additional environment variable(s) to be passed" echo " to the container. Uses standard docker syntax and" echo " multiple statements are allowed" + echo " --mount=VALUE Specify additional directory bindings. Uses" + echo " standard docker syntax and multiple statements are" + echo " allowed" echo " --network=VALUE Specify the network to connect the container to. Uses" echo " standard docker syntax" echo " --volume=VALUE Specify additional volume(s) to be mounted. Uses" @@ -180,20 +186,23 @@ configure_xquartz () { fi # Configure XQuartz - if [ "$(defaults read org.macosforge.xquartz.X11 app_to_run)" != "/usr/bin/true" ]; then - defaults write org.macosforge.xquartz.X11 app_to_run /usr/bin/true + if [ -e ~/Library/Preferences/org.xquartz.X11.plist ] ; then + xquartz_properties=org.xquartz.X11 + else xquartz_properties=org.macosforge.xquartz.X11; fi + if [ "$(defaults read $xquartz_properties app_to_run)" != "/usr/bin/true" ]; then + defaults write $xquartz_properties app_to_run /usr/bin/true changes_made=0 fi - if [ "$(defaults read org.macosforge.xquartz.X11 nolisten_tcp)" != "0" ]; then - defaults write org.macosforge.xquartz.X11 nolisten_tcp 0 + if [ "$(defaults read $xquartz_properties nolisten_tcp)" != "0" ]; then + defaults write $xquartz_properties nolisten_tcp 0 changes_made=0 fi - if [ "$(defaults read org.macosforge.xquartz.X11 enable_iglx)" != "1" ]; then + if [ "$(defaults read $xquartz_properties enable_iglx)" != "1" ]; then # Enable GLX (OpenGL) - defaults write org.macosforge.xquartz.X11 enable_iglx -bool true + defaults write $xquartz_properties enable_iglx -bool true changes_made=0 fi @@ -218,7 +227,7 @@ install_xquartz() { # Install XQuartz if ! [ -f /opt/X11/bin/xquartz ]; then - brew cask install xquartz + brew install --cask xquartz # Confirm installed [ -f /opt/X11/bin/xquartz ] && installed=0 @@ -417,6 +426,10 @@ while [ $# -gt 0 ]; do --name=*) CONTAINER_NAME="${1#*=}" ;; + --arm64) + add_run_arg --platform="linux/arm64" + IMAGE_TAG="arm64" + ;; --as-root) add_run_arg --env="RUN_AS_ROOT=yes" WORKDIR="/" @@ -465,6 +478,9 @@ while [ $# -gt 0 ]; do --force-owner) add_run_arg --env="FORCED_OWNERSHIP=yes" ;; + --nosudo) + add_run_arg --env="USER_SUDO=no" + ;; --password=*) encrypt_password "${1#*=}" ;; @@ -476,7 +492,7 @@ while [ $# -gt 0 ]; do --secure-password=*) add_run_arg --env="USER_PASSWD=${1#*=}" ;; - --device=*|--env=*|--network=*|--volume=*) + --device=*|--env=*|--mount=*|--network=*|--volume=*) add_run_arg "$1" ;; --workdir=*)