MSYS2-packages/filesystem/06-windows-files.post
Christoph Reiter 36d4fd7577 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
2023-02-06 18:14:20 +01:00

27 lines
707 B
Plaintext

maybe_create_winetc ()
{
local FILES="hosts protocols services networks"
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
}
maybe_create_winetc