From 5b1aa1c960f26bd8955e07e82a4bcae43e7eee81 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Fri, 10 Jul 2020 14:24:02 +0000 Subject: [PATCH] [FIX] point_of_sale: Stop led_status.sh on update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fact that led_status.sh was still running when performing the `git reset --hard` made it impossible to remount the filesystem in RO mode, due to a `mount point is busy` error. Instead of starting the led_status_sh script from rc.local, we make it a service so it can be easily restarted when an update is performed. closes odoo/odoo#54353 X-original-commit: 2ad99d3b9381a61e112207c79ac89cdf4ebc6c3c Signed-off-by: Quentin Lejeune (qle) Signed-off-by: Antoine Prieƫls --- .../tools/posbox/configuration/posbox_update.sh | 5 +++++ .../tools/posbox/overwrite_after_init/etc/rc.local | 1 - .../overwrite_before_init/etc/init_posbox_image.sh | 1 + .../etc/systemd/system/led-status.service | 10 ++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/led-status.service 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 93f1a003f18..2bfb9f3aec2 100755 --- a/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh +++ b/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh @@ -2,6 +2,8 @@ sudo mount -o remount,rw / +sudo service led-status stop + cd /home/pi/odoo localbranch=$(git symbolic-ref -q --short HEAD) localremote=$(git config branch.$localbranch.remote) @@ -25,4 +27,7 @@ done sudo mount -o remount,ro / sudo mount -o remount,rw /root_bypass_ramdisks/etc/cups + +sudo service led-status start + (sleep 5 && sudo service odoo restart) & diff --git a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/rc.local b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/rc.local index 4c4739b4aeb..ea965b192d6 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/rc.local +++ b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/rc.local @@ -20,7 +20,6 @@ fi mkdir -p /var/run/odoo chown pi:pi /var/run/odoo -/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/led_status.sh & /home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh & exit 0 diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh index 0d0f932da97..5a961b032e5 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh @@ -150,6 +150,7 @@ update-rc.d -f dnsmasq remove update-rc.d timesyncd defaults systemctl enable ramdisks.service +systemctl enable led-status.service systemctl disable dphys-swapfile.service systemctl enable ssh systemctl set-default graphical.target diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/led-status.service b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/led-status.service new file mode 100644 index 00000000000..24e5637d5d9 --- /dev/null +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/led-status.service @@ -0,0 +1,10 @@ +[Unit] +Description=Led Status +After=sysinit.target local-fs.target + +[Service] +Type=simple +ExecStart=/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/led_status.sh + +[Install] +WantedBy=basic.target