PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh

https://gitlab.com/thanhchatvn/cloud-odoo
Shell | 72 lines | 43 code | 18 blank | 11 comment | 1 complexity | abe83071ea85e79ab12fb9e609c101e4 MD5 | raw file
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. set -o nounset
  4. set -o pipefail
  5. # set -o xtrace
  6. __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  7. __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
  8. __base="$(basename ${__file} .sh)"
  9. # Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
  10. export DEBIAN_FRONTEND=noninteractive
  11. mount /dev/sda1 /boot
  12. apt-get update
  13. apt-get -y dist-upgrade
  14. PKGS_TO_INSTALL="adduser postgresql-client python python-dateutil python-decorator python-docutils python-feedparser python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-tz python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml postgresql python-gevent python-serial python-pip python-dev localepurge vim mc mg screen iw hostapd isc-dhcp-server git rsync console-data"
  15. apt-get -y install ${PKGS_TO_INSTALL}
  16. apt-get clean
  17. localepurge
  18. rm -rf /usr/share/doc
  19. # python-usb in wheezy is too old
  20. # the latest pyusb from pip does not work either, usb.core.find() never returns
  21. # this may be fixed with libusb>2:1.0.11-1, but that's the most recent one in raspbian
  22. # so we install the latest pyusb that works with this libusb
  23. pip install pyusb==1.0.0b1
  24. pip install qrcode
  25. pip install evdev
  26. groupadd usbusers
  27. usermod -a -G usbusers pi
  28. usermod -a -G lp pi
  29. sudo -u postgres createuser -s pi
  30. mkdir /var/log/odoo
  31. chown pi:pi /var/log/odoo
  32. # logrotate is very picky when it comes to file permissions
  33. chown -R root:root /etc/logrotate.d/
  34. chmod -R 644 /etc/logrotate.d/
  35. chown root:root /etc/logrotate.conf
  36. chmod 644 /etc/logrotate.conf
  37. echo "* * * * * rm /var/run/odoo/sessions/*" | crontab -
  38. update-rc.d -f hostapd remove
  39. update-rc.d -f isc-dhcp-server remove
  40. systemctl daemon-reload
  41. systemctl enable ramdisks.service
  42. systemctl disable dphys-swapfile.service
  43. # https://www.raspberrypi.org/forums/viewtopic.php?p=79249
  44. # to not have "setting up console font and keymap" during boot take ages
  45. setupcon
  46. # create dirs for ramdisks
  47. create_ramdisk_dir () {
  48. mkdir "${1}_ram"
  49. }
  50. create_ramdisk_dir "/var"
  51. create_ramdisk_dir "/etc"
  52. create_ramdisk_dir "/tmp"
  53. mkdir /root_bypass_ramdisks
  54. reboot