2019-11-29 10:20:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# If this is not run on some machines react-native builds fail.
|
|
|
|
|
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
2020-02-19 13:15:28 +00:00
|
|
|
source "${GIT_ROOT}/scripts/colors.sh"
|
2019-11-29 10:20:08 +00:00
|
|
|
|
2020-02-19 13:15:28 +00:00
|
|
|
if [[ "$(uname -s)" != Linux ]]; then
|
2019-11-29 10:20:08 +00:00
|
|
|
echo "inotify fix not applicable on non-linux OS"
|
2020-02-19 13:15:28 +00:00
|
|
|
exit
|
2019-11-29 10:20:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
|
|
|
|
required_watches=524288
|
|
|
|
|
|
|
|
if [ $watches -lt $required_watches ]; then
|
2020-02-19 13:15:28 +00:00
|
|
|
echo -e "${YLW}fs.inotify.max_user_watches limit is too low ($watches). Increasing it.${RST}"
|
|
|
|
echo "fs.inotify.max_user_watches = $required_watches" | sudo tee -a /etc/sysctl.conf
|
2019-11-29 10:20:08 +00:00
|
|
|
sudo sysctl -p
|
2020-02-19 13:15:28 +00:00
|
|
|
else
|
|
|
|
echo -e "${GRN}fs.inotify.max_user_watches limit is high enough.${RST}"
|
2019-11-29 10:20:08 +00:00
|
|
|
fi
|