Exit on failure
Signed-off-by: Andrei Boyanov <andrei.boyanov@gmail.com>
This commit is contained in:
parent
feb3c5011e
commit
79198dc009
26
run.sh
26
run.sh
@ -5,17 +5,18 @@ CHAT=$3
|
||||
|
||||
# Clone Odoo directory
|
||||
echo "Clonning the repository"
|
||||
git clone --depth=1 https://github.com/andreiboyanov/emf-1995-docker-compose $DESTINATION
|
||||
rm -rf $DESTINATION/.git
|
||||
git clone --depth=1 https://github.com/andreiboyanov/emf-1995-docker-compose $DESTINATION || exit -1
|
||||
rm -rf $DESTINATION/.git || exit -1
|
||||
|
||||
# Create PostgreSQL directory
|
||||
echo "Creating the poostgresql folder $DESTINATION/postgresql"
|
||||
mkdir -p $DESTINATION/postgresql
|
||||
mkdir -p $DESTINATION/postgresql || exit -1
|
||||
|
||||
# Change ownership to current user and set restrictive permissions for security
|
||||
echo "Configuring permissions"
|
||||
sudo chown -R $USER:$USER $DESTINATION
|
||||
sudo chmod -R 700 $DESTINATION # Only the user has access
|
||||
sudo chown -R $USER:$USER $DESTINATION || exit -1
|
||||
sudo chmod -R 700 $DESTINATION || exit -1 # Only the user has access
|
||||
|
||||
|
||||
# Check if running on macOS
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
@ -30,27 +31,28 @@ else
|
||||
fi
|
||||
sudo sysctl -p
|
||||
fi
|
||||
if [ $? -ne 0 ]; then exit -1; fi
|
||||
|
||||
# Set ports in docker-compose.yml
|
||||
# Update docker-compose configuration
|
||||
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
|
||||
sed -i '' 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml || exit -1
|
||||
sed -i '' 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml || exit -1
|
||||
else
|
||||
# Linux sed syntax
|
||||
echo "Configuring the Odoo ports"
|
||||
sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml
|
||||
sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml
|
||||
sed -i 's/10018/'$PORT'/g' $DESTINATION/docker-compose.yml || exit -1
|
||||
sed -i 's/20018/'$CHAT'/g' $DESTINATION/docker-compose.yml || exit -1
|
||||
fi
|
||||
|
||||
# Set file and directory permissions after installation
|
||||
echo "Configuring $DESTINATION permissions"
|
||||
find $DESTINATION -type f -exec chmod 644 {} \;
|
||||
find $DESTINATION -type d -exec chmod 755 {} \;
|
||||
find $DESTINATION -type f -exec chmod 644 {} \; || exit -1
|
||||
find $DESTINATION -type d -exec chmod 755 {} \; || exit -1
|
||||
|
||||
echo "Making the entrypoint executable"
|
||||
chmod +x $DESTINATION/entrypoint.sh
|
||||
chmod +x $DESTINATION/entrypoint.sh || exit -1
|
||||
|
||||
# Run Odoo
|
||||
"Running the EMF-1995 social app"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user