package_install.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. tarball="package.tgz"
  22. BINDIR="/home/bus/bin"
  23. CONFIGDIR="/home/bus/config"
  24. BINLIST="avls billdb client_supervisor debug_client diu_minder gps_minder ipc_server paddlemgr passdb piu_minder send_billing_record send_magstrip"
  25. 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"
  26. if [[ ! -e /home/bus/config/popufare.witness ]] ; then
  27. echo "# Popufare system is not detected! Assuming legacy system and aborting install but populating checksum and version files"
  28. exit 0
  29. fi
  30. killall client_supervisor ; sleep 5 ;
  31. tmpdir=`mktemp -d`
  32. tar -C $tmpdir -zxf $tarball
  33. pushd $tmpdir > /dev/null
  34. if [[ ! -e ./popufare.witness ]] ; then
  35. echo "# Could not find local 'popufare.witness'. Are you sure you're installing this from a package?"
  36. echo ""
  37. popd > /dev/null
  38. rm -rf $tmpdir
  39. exit 1
  40. fi
  41. ./build_all.sh native
  42. # These represent the most common files that are going to need to be
  43. # updated.
  44. # Other system files, like rc.local, the PPP config files, etc.
  45. # can also be updated as needed, but for now the focus is on
  46. # the binaries and scripts located in /home/bus/.
  47. #
  48. for binfn in $BINDLIST ; do
  49. rm -f $BINDIR/$binfn
  50. cp -L bin/native/$binfn $BINDIR/$binfn
  51. done
  52. for scriptfn in $SCRIPTLIST ; do
  53. rm -f $BINDIR/$scriptfn
  54. cp -L scripts/$scriptfn $BINDIR/$scriptfn
  55. done
  56. rm -rf $CONFIGDIR/html
  57. cp -L -R DIUv2/html $CONFIGDIR/
  58. # Misc. scripts/programs missed by the above
  59. #
  60. rm -f $BINDIR/diu_kiosk
  61. cp -L DIUv2/diu_kiosk $BINDIR/
  62. rm -f $BINDIR/reset-gps
  63. cp -L scripts/reset-gps.py $BINDIR/reset-gps
  64. # Indicate we have a Popufare installation
  65. #
  66. touch $CONFIGDIR/popufare.witness
  67. popd > /dev/null
  68. sleep 1
  69. touch /tmp/reboot_flag
  70. echo "Done."
  71. exit 0