[FIX] point_of_sale: Fix the wifi connection for the new iot image

With the latest iot 23_07 image update the wifi connection was unusable.
We correct the activation of the wifi hardware of the raspberry with rfkill unblock all

closes odoo/odoo#133668

X-original-commit: c85497da60fbbc4b663d7de90c91de9068f25479
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit is contained in:
lejeune quentin
2023-08-31 09:05:00 +00:00
parent c7b86c58ff
commit 9aeb998a99
7 changed files with 28 additions and 163 deletions
@@ -1,97 +0,0 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
server {
listen 80 default_server;
location / {
# Every OS request specific address and .txt file to test if hotspot are connected to internet however login splash page don't display
# this line respond true for every request and send a login splash page to client
# it work for every OS
return 301 $scheme://10.11.12.1:8069;
}
}
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
@@ -1,10 +1,24 @@
#!/usr/bin/env bash
FORCE_HOST_AP="${1}"
WIRED_IP=$(python3 -c "import netifaces as ni; print(ni.ifaddresses('eth0').get(ni.AF_INET) and ni.ifaddresses('eth0')[ni.AF_INET][0]['addr'] or '')")
WIFI_NETWORK_FILE="/home/pi/wifi_network.txt"
COUNTER=0
# we need to wait to receive an ip address from the dhcp before enable the access point.
# only if only if no configuration file for the wifi networks is recorded
if ! [ -f "${WIFI_NETWORK_FILE}" ] && [ -z "${FORCE_HOST_AP}" ] ; then
while [ "$(hostname -I)" = '' ] && [ "$COUNTER" -le 10 ]; do sleep 2;((COUNTER++)); done
fi
WIRED_IP=$(hostname -I)
if [ "$WIRED_IP" ]; then
printf "My IP address is %s\n" "$WIRED_IP"
fi
# by default wlan0 is soft blocked.
# we need unblock all radio devices
rfkill unblock all
ifconfig wlan0 down
ifconfig wlan0 up
@@ -37,11 +51,6 @@ if [ -z "${WIRED_IP}" ] ; then
service dnsmasq restart
service nginx stop
# We start nginx in another configuration than the default one with https
# as it needs to do redirect instead in case the IoT Box acts as an ap
nginx -c /home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/nginx_ap.conf
service odoo restart
fi
# wired
@@ -79,14 +79,12 @@ server {
#
server {
listen 80;
# listen [::]:80;
#
# server_name example.com;
#
listen [::]:80;
root /var/www/;
index index.html;
#
location /hw_drivers/ {
location / {
proxy_pass http://127.0.0.1:8069;
}
}
@@ -1,41 +0,0 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: timesyncd
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start systemd-timesyncd daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
start()
{
echo "start timesyncd"
service systemd-timesyncd start
}
stop()
{
echo "stop timesyncd"
service systemd-timesyncd stop
}
restart()
{
stop;
sleep 1;
start;
}
case $1 in
start)
start;;
stop)
stop;;
restart)
restart;;
*)
start;;
esac
exit 0
@@ -27,7 +27,7 @@ apt-get update && apt-get -y upgrade
# At the first start it is necessary to configure a password
# This will be modified by a unique password on the first start of Odoo
password="$(openssl rand -base64 32)"
password="$(openssl rand -base64 12)"
echo "pi:${password}" | chpasswd
PKGS_TO_INSTALL="
@@ -142,7 +142,6 @@ echo "* * * * * rm /var/run/odoo/sessions/*" | crontab -
update-rc.d -f hostapd remove
update-rc.d -f nginx remove
update-rc.d -f dnsmasq remove
update-rc.d timesyncd defaults
systemctl enable ramdisks.service
systemctl enable led-status.service
@@ -150,7 +149,7 @@ systemctl disable dphys-swapfile.service
systemctl enable ssh
systemctl set-default graphical.target
systemctl disable getty@tty1.service
systemctl disable systemd-timesyncd.service
systemctl enable systemd-timesyncd.service
systemctl unmask hostapd.service
systemctl disable hostapd.service
systemctl disable cups-browsed.service
@@ -177,3 +176,6 @@ create_ramdisk_dir "/var"
create_ramdisk_dir "/etc"
create_ramdisk_dir "/tmp"
mkdir -v /root_bypass_ramdisks
echo "password"
echo ${password}
@@ -11,12 +11,6 @@
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
/etc/init_posbox_image.sh 2>&1 | tee /home/pi/init_posbox_image.log
exit 0
@@ -29,7 +29,7 @@ MOUNT_POINT="${__dir}/root_mount"
OVERWRITE_FILES_BEFORE_INIT_DIR="${__dir}/overwrite_before_init"
OVERWRITE_FILES_AFTER_INIT_DIR="${__dir}/overwrite_after_init"
VERSION=16.0
VERSION_IOTBOX=23.07
VERSION_IOTBOX=23.09
REPO=https://github.com/odoo/odoo.git
if ! file_exists *raspios*.img ; then
@@ -136,10 +136,10 @@ mkdir -pv "${MOUNT_POINT}"/var/odoo
echo "${VERSION_IOTBOX}" | tee "${MOUNT_POINT}"/var/odoo/iotbox_version "${MOUNT_POINT}"/home/pi/iotbox_version
# get rid of the git clone
rm -rfv "${CLONE_DIR}"
rm -rf "${CLONE_DIR}"
# and the ngrok usr/bin
rm -rfv "${OVERWRITE_FILES_BEFORE_INIT_DIR}/usr"
cp -av "${OVERWRITE_FILES_AFTER_INIT_DIR}"/* "${MOUNT_POINT}"
rm -rf "${OVERWRITE_FILES_BEFORE_INIT_DIR}/usr"
cp -a "${OVERWRITE_FILES_AFTER_INIT_DIR}"/* "${MOUNT_POINT}"
find "${MOUNT_POINT}"/ -type f -name "*.iotpatch"|while read iotpatch; do
DIR=$(dirname "${iotpatch}")