[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) <qle@odoo.com>
This commit is contained in:
Antoine Prieels
2019-11-26 12:31:37 +00:00
parent 6e07e0b4b0
commit 2c93bb4f41
@@ -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) &