关于这件事,我一直把头撞在墙上。
我希望在Ubuntu20.04上向红酒下的路径添加一个可执行文件。试图从dockerfile中配置它,但是有一个奇怪的问题。具体来说,我正试图将python安装在葡萄酒下面,这样您就可以调用wine python。我选择使用嵌入式python并通过get_pip.py手动安装pip (这里没有显示)。
在Dockerfile中,我有:
FROM ubuntu:20.04
RUN useradd --no-log-init -r --uid 1003 -G dialout -g 100 -s /bin/bash jenkins
# PULL /wine/winecfg from private server pre-configured
RUN dpkg --add-architecture i386 \
&& apt get update
&& apt get install -y \
libc6:i386 \
&& apt get install -y \
wine=5.0-3
RUN mkdir -p /wine/winecfg && chown -R jenkins:users /wine
# Add Embedded Python
ARG Python_Embedded_Archive=python-3.9.7-embed-win32.zip
RUN apt-get install -y unzip
COPY ${Python_Embedded_Archive} /temp/${Python_Embedded_Archive}
RUN unzip /temp/${Python_Embedded_Archive} -d /wine/python
RUN chmod +x /wine/python/python.exe
RUN chown jenkins:users /wine/python
# Switch to jenkins, which owns wine
USER jenkins:true
# Add Embedded Python to PATH in wine
COPY add_to_wine_path.sh /wine
RUN bash /wine/add_to_wine_path.sh /wine/python \
&& wine python --version
RUN wine python --version注意:这不是完整的dockerfile,只是相关的部分。
/电平/cfg文件夹为f
使用add_to_wine_path.sh:
path_to_add=$1
echo "Adding '$path_to_add' to Wine's PATH variable"
# Get clean the current path values (generally empty, but script could be called a second time)
existing_path=$(wine reg QUERY 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -v PATH | grep -Po '(?<=\^%).*(?=\^%)')
# If the existing path value is empty
if [ -z $existing_path" ]
then
# Set the default path values (Windows paths)
existing_path="C:\windows\system32;C:\windows"
fi
wine reg add 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -v PATH /t REG_EXPAND_SZ /d ^%\;&path_to_add\;$existing_path^% /fWhat实际上会发生:当我构建码头映像时,第一个对wine python --version的调用工作正常,这表明路径已被更新。耶!但是,当第二个wine python --version在不同的RUN块中运行时,它就失败了。
在我看来,注册中心需要强制更新所有用户的葡萄酒,有效地重新启动。
因此,我尝试了各种选择的wineboot,但这仍然没有帮助。
Any窗口注册表或葡萄酒权威知道这里发生了什么?
发布于 2022-01-19 13:20:56
我也一直试图在Docker中保留一个葡萄酒注册表更改,通过实验我发现,在我的环境中,在调用wine reg add之后修改注册表文件(D1)需要花费1到2秒的时间。
有一个相关的查询这里。希望有一种方法可以同步地将注册表刷新到磁盘;否则,最简单的方法可能是循环,直到文件被修改。
以下是我在一种情况下如何做到这一点(此注册表更改启用了“显示点文件”选项):
RUN before=$(stat -c '%Y' /home/xclient/.wine/user.reg) \
&& wine reg add 'HKEY_CURRENT_USER\Software\Wine' /v ShowDotFiles /d Y \
&& while [ $(stat -c '%Y' /home/xclient/.wine/user.reg) = $before ]; do sleep 1; done这可能是安全的,因为这是对默认注册表的单个更改(它不是很大:显然只有16 in ),但是在更复杂的情况下,所有的事情都可能出错:
https://serverfault.com/questions/1082578
复制相似问题