package_install.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2019 Clementine Computing LLC.
  4. #
  5. # This file is part of PopuFare.
  6. #
  7. # PopuFare is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # PopuFare is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with PopuFare. If not, see <https://www.gnu.org/licenses/>.
  19. #
  20. echo "# Popufare DIU package installer script"
  21. BINDIR="/home/bus/bin"
  22. CONFIGDIR="/home/bus/config"
  23. BINLIST="avls billdb client_supervisor debug_client diu_minder gps_minder ipc_server paddlemgr passdb piu_minder send_billing_record send_magstrip"
  24. SCRIPTLIST="apply_update.sh apply_update_legacy.sh apply_update_popufare.sh common_values.sh connection_tether.sh fix_pkg_perm.sh get_net_ids.sh init_bus.sh update_loop.sh showmessage setup-serial.py"
  25. if [[ ! -e /home/bus/config/popufare.witness ]] ; then
  26. echo "# Popufare system is not detected! Assuming legacy system and aborting install but populating checksum and version files"
  27. exit 0
  28. fi
  29. if [[ ! -e ./popufare.witness ]] ; then
  30. echo "# Could not find local 'popufare.witness'. Are you sure you're installing this from a package?"
  31. echo ""
  32. exit 1
  33. fi
  34. ./build_all.sh native
  35. killall client_supervisor ; sleep 5 ;
  36. # These represent the most common files that are going to need to be
  37. # updated.
  38. # Other system files, like rc.local, the PPP config files, etc.
  39. # can also be updated as needed, but for now the focus is on
  40. # the binaries and scripts located in /home/bus/.
  41. #
  42. for binfn in $BINDLIST ; do
  43. rm -f $BINDIR/$binfn
  44. cp -L bin/native/$binfn $BINDIR/$binfn
  45. done
  46. for scriptfn in $SCRIPTLIST ; do
  47. rm -f $BINDIR/$scriptfn
  48. cp -L scripts/$scriptfn $BINDIR/$scriptfn
  49. done
  50. rm -rf $CONFIGDIR/html
  51. cp -L -R DIUv2/html $CONFIGDIR/
  52. # Misc. scripts/programs missed by the above
  53. #
  54. rm -f $BINDIR/diu_kiosk
  55. cp -L DIUv2/diu_kiosk $BINDIR/
  56. rm -f $BINDIR/reset-gps
  57. cp -L scripts/reset-gps.py $BINDIR/reset-gps
  58. # Indicate we have a Popufare installation
  59. #
  60. touch $CONFIGDIR/popufare.witness
  61. sleep 1
  62. touch /tmp/reboot_flag
  63. echo "Done."
  64. exit 0