package_install.sh 2.8 KB

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