<commit_before>#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"

# Since we are emulating, the real /boot is not mounted, 
# leading to mismatch between kernel image and modules.
mount /dev/sda1 /boot

# Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
export DEBIAN_FRONTEND=noninteractive
echo "nameserver 8.8.8.8" >> /etc/resolv.conf


apt-get update && apt-get -y upgrade
# Do not be too fast to upgrade to more recent firmware and kernel than 4.38
# Firmware 4.44 seems to prevent the LED mechanism from working

PKGS_TO_INSTALL="
    fswebcam \
    nginx-full \
    dnsmasq \
    cups \
    printer-driver-all \
    cups-ipp-utils \
    libcups2-dev \
    pcscd \
    localepurge \
    vim \
    mc \
    mg \
    screen \
    iw \
    hostapd \
    git \
    rsync \
    swig \
    console-data \
    lightdm \
    xserver-xorg-video-fbdev \
    xserver-xorg-input-evdev \
    iceweasel \
    xdotool \
    unclutter \
    x11-utils \
    openbox \
    rpi-update \
    adduser \
    postgresql \
    python-cups \
    python3 \
    python3-pyscard \
    python3-urllib3 \
    python3-dateutil \
    python3-decorator \
    python3-docutils \
    python3-feedparser \
    python3-pil \
    python3-jinja2 \
    python3-ldap3 \
    python3-lxml \
    python3-mako \
    python3-mock \
    python3-openid \
    python3-psutil \
    python3-psycopg2 \
    python3-babel \
    python3-pydot \
    python3-pyparsing \
    python3-pypdf2 \
    python3-reportlab \
    python3-requests \
    python3-simplejson \
    python3-tz \
    python3-vatnumber \
    python3-werkzeug \
    python3-serial \
    python3-pip \
    python3-dev \
    python3-netifaces \
    python3-passlib \
    python3-libsass \
    python3-qrcode \
    python3-html2text \
    python3-unittest2 \
    python3-simplejson"

echo "Acquire::Retries "16";" > /etc/apt/apt.conf.d/99acquire-retries
# KEEP OWN CONFIG FILES DURING PACKAGE CONFIGURATION
# http://serverfault.com/questions/259226/automatically-keep-current-version-of-config-files-when-apt-get-install
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install ${PKGS_TO_INSTALL}
pg_lsclusters
systemctl start postgresql@9.6-main
systemctl status postgresql@9.6-main

sudo -u postgres createuser -s pi

apt-get clean
localepurge
rm -rf /usr/share/doc

# python-usb in wheezy is too old
# the latest pyusb from pip does not work either, usb.core.find() never returns
# this may be fixed with libusb>2:1.0.11-1, but that's the most recent one in raspbian
# so we install the latest pyusb that works with this libusb.
# Even in stretch, we had an error with langid (but worked otherwise)
PIP_TO_INSTALL="
    pyusb==1.0.0b1 \
    evdev \
    gatt \
    v4l2 \
    pycups"

pip3 install ${PIP_TO_INSTALL}


groupadd usbusers
usermod -a -G usbusers pi
usermod -a -G lp pi
usermod -a -G input lightdm
mkdir /var/log/odoo
chown pi:pi /var/log/odoo
chown pi:pi -R /home/pi/odoo/

# logrotate is very picky when it comes to file permissions
chown -R root:root /etc/logrotate.d/<commit_msg>[FIX] point_of_sale: New IoT Box build dependency<commit_after>#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"

# Since we are emulating, the real /boot is not mounted, 
# leading to mismatch between kernel image and modules.
mount /dev/sda1 /boot

# Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
export DEBIAN_FRONTEND=noninteractive
echo "nameserver 8.8.8.8" >> /etc/resolv.conf


apt-get update && apt-get -y upgrade
# Do not be too fast to upgrade to more recent firmware and kernel than 4.38
# Firmware 4.44 seems to prevent the LED mechanism from working

PKGS_TO_INSTALL="
    fswebcam \
    nginx-full \
    dnsmasq \
    cups \
    printer-driver-all \
    cups-ipp-utils \
    libcups2-dev \
    pcscd \
    localepurge \
    vim \
    mc \
    mg \
    screen \
    iw \
    hostapd \
    git \
    rsync \
    swig \
    console-data \
    lightdm \
    xserver-xorg-video-fbdev \
    xserver-xorg-input-evdev \
    iceweasel \
    xdotool \
    unclutter \
    x11-utils \
    openbox \
    rpi-update \
    adduser \
    postgresql \
    python-cups \
    python3 \
    python3-pyscard \
    python3-urllib3 \
    python3-dateutil \
    python3-decorator \
    python3-docutils \
    python3-feedparser \
    python3-pil \
    python3-jinja2 \
    python3-ldap3 \
    python3-lxml \
    python3-mako \
    python3-mock \
    python3-openid \
    python3-psutil \
    python3-psycopg2 \
    python3-babel \
    python3-pydot \
    python3-pyparsing \
    python3-pypdf2 \
    python3-reportlab \
    python3-requests \
    python3-simplejson \
    python3-tz \
    python3-vatnumber \
    python3-werkzeug \
    python3-serial \
    python3-pip \
    python3-dev \
    python3-netifaces \
    python3-passlib \
    python3-libsass \
    python3-qrcode \
    python3-html2text \
    python3-unittest2 \
    python3-simplejson"

echo "Acquire::Retries "16";" > /etc/apt/apt.conf.d/99acquire-retries
# KEEP OWN CONFIG FILES DURING PACKAGE CONFIGURATION
# http://serverfault.com/questions/259226/automatically-keep-current-version-of-config-files-when-apt-get-install
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install ${PKGS_TO_INSTALL}
pg_lsclusters
systemctl start postgresql@9.6-main
systemctl status postgresql@9.6-main

sudo -u postgres createuser -s pi

apt-get clean
localepurge
rm -rf /usr/share/doc

# python-usb in wheezy is too old
# the latest pyusb from pip does not work either, usb.core.find() never returns
# this may be fixed with libusb>2:1.0.11-1, but that's the most recent one in raspbian
# so we install the latest pyusb that works with this libusb.
# Even in stretch, we had an error with langid (but worked otherwise)
PIP_TO_INSTALL="
    pyusb==1.0.0b1 \
    evdev \
    gatt \
    v4l2 \
    polib \
    pycups"

pip3 install ${PIP_TO_INSTALL}


groupadd usbusers
usermod -a -G usbusers pi
usermod -a -G lp pi
usermod -a -G input lightdm
mkdir /var/log/odoo
chown pi:pi /var/log/odoo
chown pi:pi -R /home/pi/odoo/

# logrotate is very picky when it comes to file permissions
chown -R root:root /etc/logrotate.d/
{'fraction_non_alphanumeric': 0.10856968587984142, 'fraction_numerical': 0.026227508386703263, 'mean_word_length': 2.5724400871459694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '20329', 'n_tokens_mistral': 2515, 'n_tokens_neox': 2433, 'n_words': 602}