filesystem: clean up maybe_create_winetc

Inline the call to cygpath into the loop to avoid it being
called in case all files already exist.

Remove call to chmod, it doesn't do anything in MSYS2.

Saves ~20ms here
This commit is contained in:
Christoph Reiter 2023-01-12 19:11:29 +01:00
parent 8812d66d09
commit 36d4fd7577
2 changed files with 10 additions and 11 deletions

View File

@ -1,27 +1,26 @@
maybe_create_winetc ()
{
local FILES="hosts protocols services networks"
local WINSYS32HOME="$(exec /usr/bin/cygpath -S -w)"
local WINETC="${WINSYS32HOME}\\drivers\\etc"
if [ ! -d "${WINETC}" ]; then
echo "Directory ${WINETC} does not exist; exiting" >&2
echo "If directory name is garbage you need to update your msys package" >&2
exit 1
fi
local mketc=
for mketc in ${FILES}
do
if [ ! -e "/etc/${mketc}" -a ! -L "/etc/${mketc}" ]
then
local WINSYS32HOME="$(exec /usr/bin/cygpath -S -w)"
local WINETC="${WINSYS32HOME}\\drivers\\etc"
if [ ! -d "${WINETC}" ]; then
echo "Directory ${WINETC} does not exist; exiting" >&2
echo "If directory name is garbage you need to update your msys package" >&2
exit 1
fi
# Windows only uses the first 8 characters
local WFILE="${WINETC}\\$(exec expr substr "${mketc}" 1 8)"
/usr/bin/cp -p -v "${WFILE}" "/etc/${mketc}"
fi
done
/usr/bin/chmod 1777 /tmp 2>/dev/null
}
maybe_create_winetc

View File

@ -80,7 +80,7 @@ sha256sums=('742a7d66b7a5ebd2b8461728c5b44a46b2305fd2116208eecae5f45828938ea0'
'3a4d629d72ab8ac58427097c3a8915c4e8186f819cd369c2da5eca955d08fceb'
'd7b7eb4cd9e1f9bc227b009cdcacf700f5523ccc109fbd3c1c0331726d314c9e'
'9c126262051a047450ed97397ee89a7148098c03ae00a1cd67c3f3425d8e4b12'
'fedaf4d9ae282f6c1698d04d280dd48c8d3247321a5cb5e309e61e2c655102c6'
'549859e17dc0b8d5c0374103c8a1afc6995bc61ce8f1423eeed51dc9e6cc74e0'
'574564607e5ea8d877f42d59c164801e3efa4393a0a74c0714d9b9a778dec43f'
'ad8533809ea2b1bce0a41b3a0a24dbc7a9f58b992ceb40cc9f862b1978032790'
'caf25e3390331c6a22cc91f1c1bc551a9f87c59171dd3ef7b3b6016859a10fb5'