TringaliLuca

Install iotPOS on RaspberryPi

Aug 9th, 2017
148
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #gmailusername="iltuoutente"
  4. #gmailpassword="password"
  5. echo "Inserisci il tuo username gmail.com"
  6. read gmailusername
  7. echo "Inserisci la tua password di gmail.com"
  8. read gmailpassword
  9.  
  10.  
  11. sudo apt-get update
  12. sudo apt-get install kdebase-runtime libqt4-dev build-essential g++ cmake gettext libqt4-sql-mysql kdelibs5-dev
  13. sudo apt-get install kde-l10n-es
  14. sudo apt-get install mysql-client mysql-server
  15. cd ~
  16. git clone https://github.com/hiramvillarreal/iotpos
  17. cd iotpos
  18. mkdir build
  19. cd build
  20.  
  21. cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`
  22. cmake -DCMAKE_INSTALL_PREFIX=kde4-config --prefix -DQT_QMAKE_EXECUTABLE=which qmake-qt4 -DQT_INCLUDE_DIR=/usr/include/qt4 -DCMAKE_BUILD_TYPE=Release ..
  23. make
  24. sudo make install
  25. cp iotpos/src/iotposrc ~/.kde/share/config/
  26.  
  27. cd ~/iotpos/database_resources
  28. cat iotpos_mysql.sql | mysql -u root -p
  29.  
  30. mysql -u root -p iotposdb < iotposdb.sql
  31.  
  32.  
  33. sudo apt-get install python-serial python-imaging python-unidecode
  34. cd ~/py-thermal-printer-master
  35. sudo python printer.py
  36.  
  37. sudo echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt
  38.  
  39. sed -i 's/console=ttyAMA0,115200/ /' "/boot/cmdline.txt"
  40. sed -i 's/console=serial0,115200/ /' "/boot/cmdline.txt"
  41.  
  42.  
  43. sudo apt-get install ssmtp
  44. sudo apt-get install mailutils
  45.  
  46. cat << EOF > /etc/ssmtp/ssmtp.conf
  47. root=postmaster
  48. mailhub=smtp.gmail.com:587
  49. hostname=raspberrypi
  50. AuthUser=YourGMailUserName@gmail.com
  51. AuthPass=YourGMailPassword
  52. UseSTARTTLS=YES
  53. EOF
  54.  
  55. myhost=$(hostname)
  56. sed -i 's/raspberrypi/${myhost}/' "/etc/ssmtp/ssmtp.conf"
  57. sed -i 's/YourGMailUserName/${gmailusername}/' "/etc/ssmtp/ssmtp.conf"
  58. sed -i 's/YourGMailPassword/${gmailpassword}/' "/etc/ssmtp/ssmtp.conf"
  59.  
  60. sudo chmod 774 /etc/ssmtp/ssmtp.conf
  61.  
  62. sed -i 's/your_mail/${gmailusername}/' "~/iotpos/scripts/corteMail.sh"
  63.  
  64. #sudo raspi-config
  65. #  Advanced options
  66. #  Serial /  Enable/Disable shell and kernel messages on the serial connection
  67. #   Would you like a login shell to be accessible over       │
  68. #          │ serial?  NO
  69.  
  70. sudo systemctl disable serial-getty@ttyAMA0.service
  71.  
  72. sudo reboot
  73.  
  74. #The default and only user and password is (without quotation marks):
  75. #username: "admin"
  76. #password: "linux"
  77. #run command iotpos
  78.  
  79.  
  80. #WARNING!!!: Make sure a serial TTL printer is used, NEVER CONNECT A SERIAL RS232 TO PI'S GPIO!!! even using a TTL conection, never conect the side #printer Tx pin to Rx GPIO on the pi, the Tx wire is only used for rare cases where the printer returns data to the computer. It’s left unconnected #because the printer works at 5 Volts and the Raspberry Pi at 3.3 Volts… connecting directly to the Rx pin could permanently damage the Raspberry #Pi! (The other direction is safe as-is.).
  81.  
  82. #  Serial Data Cable Rx TO    Physical pin 8 It's also commonly known as "Serial TX" ttyAMA0.
  83. #  Serial Data Cable Tx  DO NOT CONNECT IT TO THE GPIO RX AS SOME ARE 5 V TTL WILL DAMAGE THE RASPBERRY PI!!!
  84. #  Serial GND from serial printer to any gpio GND could use Physical pin 6,9, 14.
  85.  
  86. #-----Push buttom and LED.
  87.  
  88. #Push bottom N.O. to Physical pin 16 switch to GND.
  89. #LED+ Physical pin 12 LED- TO any GND available.
RAW Paste Data