1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

LibWeb: Only update /etc/hosts for WPT if required lines are not present

This commit is contained in:
Andrew Kaster 2023-08-19 15:55:41 -06:00 committed by Andrew Kaster
parent 99499a6fae
commit 326e8a0a33

View file

@ -31,9 +31,11 @@ if [ ! -d "${SCRIPT_DIR}/wpt" ]; then
# Apply WPT patch with Ladybird runner
(cd wpt; git apply ../ladybird_runner.patch)
# Update hosts file
# FIXME: Only do this if required. Otherwise your /etc/hosts gets crowded quickly
python3 "./wpt/wpt" make-hosts-file | sudo tee -a /etc/hosts
# Update hosts file if needed
if [ "$(comm -13 <(sort -u /etc/hosts) <(python3 ./wpt/wpt make-hosts-file | sort -u) | wc -l)" -gt 0 ]; then
echo "Enter superuser password to append wpt hosts to /etc/hosts"
python3 "./wpt/wpt" make-hosts-file | sudo tee -a /etc/hosts
fi
fi
# Extract metadata.txt into directory with expectation files expected by WPT runner