3737 chmod +x /usr/local/bin/winetricks
3838 chmod +x /usr/local/bin/wineserver
3939 chmod +x /usr/local/bin/wine
40- mkdir -p " ${user_home} /.local/share/applications/"
41- cat << EOF > "${user_home} /.local/share/applications/wine-config.desktop"
40+ sudo -u " $( logname ) " mkdir -p " ${user_home} /.local/share/applications/"
41+ cat << EOF | sudo -u " $( logname ) " tee "${user_home} /.local/share/applications/wine-config.desktop"
4242[Desktop Entry]
4343Version=1.0
4444Type=Application
@@ -49,7 +49,7 @@ box86 Exec=/usr/local/bin/wine winecfg
4949Categories=Game;
5050Terminal=false
5151EOF
52- cat << EOF > "${user_home} /.local/share/applications/wine-desktop.desktop"
52+ cat << EOF | sudo -u " $( logname ) " tee "${user_home} /.local/share/applications/wine-desktop.desktop"
5353[Desktop Entry]
5454Version=1.0
5555Type=Application
@@ -61,24 +61,21 @@ Categories=Game;
6161Terminal=false
6262EOF
6363
64- mkdir " ${user_home} /wine/"
65- mkdir " ${user_home} /wine/lib/"
64+ sudo -u " $( logname) " mkdir -p " ${user_home} /wine/lib/"
6665 # cp libwine.so ${user_home}/wine/lib/
6766 # cp libwine.so.1 ${user_home}/wine/lib/
68- pushd " ${user_home} /wine/" || return 1
67+ local wine_pkg
68+ wine_pkg=" $( sudo -u " $( logname) " mktemp -d) "
69+ pushd " $wine_pkg " || return 1
6970 latest_version=" $( basename " $( curl -ILs -o /dev/null -w " %{url_effective}" https://github.com/Kron4ek/Wine-Builds/releases/latest) " ) "
70- curl -Ls " https://github.com/Kron4ek/Wine-Builds/releases/download/$latest_version /wine-$latest_version -x86.tar.xz" > " wine-latest-x86.tar.xz"
71- xz -d wine-latest-x86.tar.xz
72- tar -xf wine-latest-x86.tar
71+ curl -Lso " wine-$latest_version -x86.tar.xz" " https://github.com/Kron4ek/Wine-Builds/releases/download/$latest_version /wine-$latest_version -x86.tar.xz"
72+ sudo -u " $( logname) " tar xf " wine-$latest_version -x86.tar.xz"
7373 popd || return 1
74- pushd " ${user_home} /wine/wine-$latest_version -x86/" || return 1
75- cp -R ./* " ${user_home} /wine"
74+ sudo -u " $( logname) " cp -R " $wine_pkg /wine-$latest_version -x86" /* " ${user_home} /wine"
7675 # ln -s "${user_home}/wine/bin/wine" /usr/local/bin/wine
7776 # ln -s "${user_home}/wine/bin/winecfg" /usr/local/bin/winecfg
7877 # ln -s "${user_home}/wine/bin/wineserver" /usr/local/bin/wineserver
79- # #try to chown using either sudo_user or pkexec_uid
80- chown -R " ${SUDO_USER:- ${PKEXEC_UID} } " " ${user_home} /wine"
81- popd || return 1
78+ rm -rf " $wine_pkg "
8279 echo " Run wine winecfg to let wine configure itself"
8380}
8481
0 commit comments