#!/bin/bash # Get script name SCRIPT=$(basename "$0") # First param is docker container CONTAINER=$1 # Default configuration PACKAGE_PATH="/mnt/addons" # Custom configuration FILE_PATH="${PACKAGE_PATH}/web_timeline/static/src/js/timeline_view.js" FIND="orientation: \"both\"," REPLACE="orientation: attrs.orientation ? JSON.parse(attrs.orientation) : {item: \"top\"}," # Get filename FILE=`basename "$FILE_PATH"` # Copy from docker docker cp "$CONTAINER":"$FILE_PATH" . # Find and replace sed -i'' "s/$FIND/$REPLACE/g" $FILE # Copy back to docker docker cp $FILE "$CONTAINER":"$FILE_PATH" # Remove file rm -f $FILE # Register patch installation echo "Patch $SCRIPT applied." touch "/etc/odoo/${SCRIPT}_${CONTAINER}_installed"