Debian Codegraph @

addons/iot_box_image/overwrite_after_init/etc/rc.local

raw
1 #!/bin/sh -e
2 #
3 # rc.local
4 #
5 # This script is executed at the end of each multiuser runlevel.
6 # Make sure that the script will "exit 0" on success or any other
7 # value on error.
8 #
9 # In order to enable or disable this script just change the execution
10 # bits.
11 #
12 # By default this script does nothing.
13
14 exec 1>/var/log/rc.local.log 2>&1 # send stdout and stderr from rc.local to a log file
15 set -x # display commands before execution
16
17 # Ensure Wi-Fi radio is enabled
18 nmcli radio wifi on
19
20 # Print the IP address
21 _IP=$(hostname -I) || true
22 if [ "$_IP" ]; then
23 printf "My IP address is %s\n" "$_IP"
24 fi
25
26 mkdir -p /var/run/odoo
27 chown odoo:odoo /var/run/odoo
28
29 # For compatibility between new IoT Box images and old Odoo code on it (it will not start Odoo on boot without this)
30 start_wifi=/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh
31 if [ -f $start_wifi ]; then
32 $start_wifi &
33 fi
34
35 # Update current branch
36 cd /home/pi/odoo
37 localbranch=$(sudo -u odoo git symbolic-ref -q --short HEAD)
38 localremote=$(sudo -u odoo git config branch.$localbranch.remote)
39
40 sudo -u odoo rm -f /home/pi/odoo/.git/shallow.lock
41 sudo -u odoo git remote set-url "${localremote}" "https://github.com/odoo/odoo.git"
42
43 sudo -u odoo GIT_SSL_NO_VERIFY=1 git fetch "${localremote}" "${localbranch}" --depth=1
44 sudo -u odoo git reset --hard FETCH_HEAD
45
46 exit 0