From 2c93bb4f41d85c0581430dd8e9dde4828fd1ca84 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Tue, 19 Nov 2019 10:06:18 +0000 Subject: [PATCH] [FIX] iot: Apply iotpatch after IoT Box upgrade We didn't apply the iotpatch files after upgrading the IoT Box, resulting in the crash of the Box and the user needed to re-flash his Box. closes odoo/odoo#41885 X-original-commit: 8dceea9383ed94b9fed7e76bbbe33794526af417 Signed-off-by: Quentin Lejeune (qle) --- .../tools/posbox/configuration/posbox_update.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh b/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh index 6384181f4fa..93f1a003f18 100755 --- a/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh +++ b/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh @@ -5,7 +5,24 @@ sudo mount -o remount,rw / cd /home/pi/odoo localbranch=$(git symbolic-ref -q --short HEAD) localremote=$(git config branch.$localbranch.remote) + +echo "addons/point_of_sale/tools/posbox/overwrite_after_init/home/pi/odoo" >> .git/info/sparse-checkout + git fetch "${localremote}" "${localbranch}" --depth=1 git reset "${localremote}"/"${localbranch}" --hard + +git clean -df +cp -a /home/pi/odoo/addons/point_of_sale/tools/posbox/overwrite_after_init/home/pi/odoo/* /home/pi/odoo/ +rm -r /home/pi/odoo/addons/point_of_sale/tools/posbox/overwrite_after_init + +sudo find / -type f -name "*.iotpatch" 2> /dev/null | while read iotpatch; do + DIR=$(dirname "${iotpatch}") + BASE=$(basename "${iotpatch%.iotpatch}") + sudo find "${DIR}" -type f -name "${BASE}" ! -name "*.iotpatch" | while read file; do + sudo patch -f "${file}" < "${iotpatch}" + done +done + sudo mount -o remount,ro / +sudo mount -o remount,rw /root_bypass_ramdisks/etc/cups (sleep 5 && sudo service odoo restart) &