update for macos

This commit is contained in:
minhng92 2024-11-03 17:20:00 +07:00
parent 0b7438f2e0
commit ac5a3cce28

25
run.sh
View File

@ -14,17 +14,30 @@ mkdir -p $DESTINATION/postgresql
sudo chown -R $USER:$USER $DESTINATION sudo chown -R $USER:$USER $DESTINATION
sudo chmod -R 700 $DESTINATION # Only the user has access sudo chmod -R 700 $DESTINATION # Only the user has access
# System configuration # Check if running on macOS
if grep -qF "fs.inotify.max_user_watches" /etc/sysctl.conf; then if [[ "$OSTYPE" == "darwin"* ]]; then
echo $(grep -F "fs.inotify.max_user_watches" /etc/sysctl.conf) echo "Running on macOS. Skipping inotify configuration."
else else
# System configuration
if grep -qF "fs.inotify.max_user_watches" /etc/sysctl.conf; then
echo $(grep -F "fs.inotify.max_user_watches" /etc/sysctl.conf)
else
echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p
fi fi
sudo sysctl -p
# Set ports in docker-compose.yml # Set ports in docker-compose.yml
sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml # Update docker-compose configuration
sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS sed syntax
sed -i '' 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml
sed -i '' 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml
else
# Linux sed syntax
sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml
sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml
fi
# Set file and directory permissions after installation # Set file and directory permissions after installation
find $DESTINATION -type f -exec chmod 644 {} \; find $DESTINATION -type f -exec chmod 644 {} \;