<commit_before>#!/bin/bash -ex

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set +x
echo "Waiting for X server"
until [[ -e /var/run/appconfig/xserver_ready ]]; do sleep 1; done
echo "X server is ready"
set -x

# Forward js input control socket to shared pod volume.
if [[ -S /tmp/.uinput/js0ctl ]]; then
    echo "Forwarding socket /tmp/.uinput/js0ctl to /var/run/appconfig/js0ctl"
    sudo chown root:app /tmp/.uinput/js*ctl
    sudo chown root:app /dev/input/js* /dev/input/event* /dev/input/evdev/js*
    nohup sudo socat UNIX-RECV:/var/run/appconfig/js0ctl,reuseaddr UNIX-CLIENT:/tmp/.uinput/js0ctl &
fi

echo "Setting resolution"
RESOLUTION=${RESOLUTION:-1920x1080}
xrandr -s ${RESOLUTION}
xrandr --fb ${RESOLUTION}

# Workaround for vulkan initialization
# https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-390/+bug/1769857
[[ -c /dev/nvidiactl ]] && (cd /tmp && sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DISPLAY=${DISPLAY} vulkaninfo >/dev/null 2>&1 || true)

echo "Starting app: ${APP_PATH?env not set}"

while true; do
    eval ${ENABLE_WM:-true} && xfwm4 --daemon ${WM_ARGS}
    sleep 2
    cd $(dirname ${APP_PATH})
    wine64 ${APP_PATH} ${APP_ARGS}
    sleep 2<commit_msg>add ENTRYPOINT variable to proton entrypoint to invoke custom script, alternative to APP_PATH<commit_after>#!/bin/bash -ex

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set +x
echo "Waiting for X server"
until [[ -e /var/run/appconfig/xserver_ready ]]; do sleep 1; done
echo "X server is ready"
set -x

# Forward js input control socket to shared pod volume.
if [[ -S /tmp/.uinput/js0ctl ]]; then
    echo "Forwarding socket /tmp/.uinput/js0ctl to /var/run/appconfig/js0ctl"
    sudo chown root:app /tmp/.uinput/js*ctl
    sudo chown root:app /dev/input/js* /dev/input/event* /dev/input/evdev/js*
    nohup sudo socat UNIX-RECV:/var/run/appconfig/js0ctl,reuseaddr UNIX-CLIENT:/tmp/.uinput/js0ctl &
fi

echo "Setting resolution"
RESOLUTION=${RESOLUTION:-1920x1080}
xrandr -s ${RESOLUTION}
xrandr --fb ${RESOLUTION}

# Workaround for vulkan initialization
# https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-390/+bug/1769857
[[ -c /dev/nvidiactl ]] && (cd /tmp && sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DISPLAY=${DISPLAY} vulkaninfo >/dev/null 2>&1 || true)

while true; do
    eval ${ENABLE_WM:-true} && xfwm4 --daemon ${WM_ARGS}
    sleep 2
    if [[ -e "${APP_PATH}" ]]; then
        echo "Starting app: ${APP_PATH}"
        cd $(dirname ${APP_PATH})
        wine64 ${APP_PATH} ${APP_ARGS}
    elif [[ -e "${ENTRYPOINT}" ]]; then
        echo "Starting env provided entrypoint: ${ENTRYPOINT}"
        eval ${ENTRYPOINT}
    else
        echo "ERROR: No APP_PATH or ENTRYPOINT env var found, nothing to execute."
        exit 1
    fi
    sleep 2
{'fraction_non_alphanumeric': 0.1208475019618101, 'fraction_numerical': 0.020664399686110384, 'mean_word_length': 3.738537794299876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7644581', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1230, 'n_words': 421}