Просмотр исходного кода

package installer

* also showmessage binary
Abram Connelly 6 лет назад
Родитель
Сommit
376979edd6

+ 0 - 1
.gitignore

@@ -7,7 +7,6 @@ diu_minder
 client_supervisor
 
 piu_minder
-showmessage
 
 billdb
 !*billdb/

+ 79 - 0
busunit/scripts/package_install.sh

@@ -0,0 +1,79 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+echo "# Popufare DIU package installer script"
+
+BINDIR="/home/bus/bin"
+CONFIGDIR="/home/bus/config"
+BINLIST="avls billdb client_supervisor debug_client diu_minder gps_minder ipc_server paddlemgr passdb piu_minder send_billing_record send_magstrip"
+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"
+
+if [[ ! -e /home/bus/config/popufare.witness ]] ; then
+  echo "# Popufare system is not detected! Assuming legacy system and aborting install but populating checksum and version files"
+  exit 0
+fi
+
+if [[ ! -e ./popufare.witness ]] ; then
+  echo "# Could not find local 'popufare.witness'. Are you sure you're installing this from a package?"
+  echo ""
+  exit 1
+fi
+
+./build_all.sh native
+
+killall client_supervisor ; sleep 5 ;
+
+# These represent the most common files that are going to need to be
+# updated.
+# Other system files, like rc.local, the PPP config files, etc.
+# can also be updated as needed, but for now the focus is on
+# the binaries and scripts located in /home/bus/.
+#
+for binfn in $BINDLIST ; do
+  rm -f $BINDIR/$binfn
+  cp -L bin/native/$binfn $BINDIR/$binfn
+done
+
+for scriptfn in $SCRIPTLIST ; do
+  rm -f $BINDIR/$scriptfn
+  cp -L scripts/$scriptfn $BINDIR/$scriptfn
+done
+
+rm -rf $CONFIGDIR/html
+cp -L -R DIUv2/html $CONFIGDIR/
+
+# Misc. scripts/programs missed by the above
+#
+rm -f $BINDIR/diu_kiosk
+cp -L DIUv2/diu_kiosk $BINDIR/
+
+rm -f $BINDIR/reset-gps
+cp -L scripts/reset-gps.py $BINDIR/reset-gps
+
+# Indicate we have a Popufare installation
+#
+touch $CONFIGDIR/popufare.witness
+
+sleep 1
+touch /tmp/reboot_flag
+
+echo "Done."
+
+exit 0

+ 24 - 0
busunit/scripts/showmessage

@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+msg="$@"
+dt=`date '+%Y-%m-%d_%H:%M:%S'`
+
+echo -e "$dt\t$msg" > /tmp/showmessage.txt

+ 24 - 0
server/diu_packager/README.md

@@ -0,0 +1,24 @@
+DIU Packager
+===
+
+These are a set of script that will get a Popufare
+package ready for DIU deployment.
+
+There is a legacy system in place so the install script
+needs to be careful about how it interacts with the
+system so as not to interfere with a legacy system
+if one is detected but also do normal installation
+if we're on a newer Popufare system.
+
+This packager is meant mostly for reference.
+Site specific files will need to be added to the packager
+for use in the install script deployed to the DIU.
+
+Notes
+---
+
+* The installer script puts packages in the `package` directory.
+* The install script creates a `witness` file to indicate it's a Popufare installation
+
+
+

+ 59 - 0
server/diu_packager/create_popufare_package.sh

@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+VERBOSE=0
+
+mkdir -p stage
+mkdir -p package
+
+pkgver=`date '+%Y%m%d-%H-%M-%S'`
+
+DIUDIR=`realpath ../../busunit`
+
+pkgfile="package-$pkgver.tgz"
+pkgdir="package-$pkgver"
+
+mkdir -p stage/$pkgdir
+
+pushd stage/$pkgdir > /dev/null
+
+  if [[ "$VERBOSE" == 1 ]] ; then
+    echo  "# Creating $pkgfile in './stage/'"
+  fi
+  cp -R $DIUDIR/. .
+
+  cp $DIUDIR/scripts/package_install.sh install.sh
+  touch popufare.witness
+
+  tar -czf ../$pkgfile *
+
+popd > /dev/null
+
+rm -rf stage/$pkgdir
+
+if [[ "$VERBOSE" == 1 ]] ; then
+  echo "# done"
+fi
+
+if [[ "$VERBOSE" == 1 ]] ; then
+  echo "# putting package '$pkgfile' in ./package"
+fi
+
+mv stage/$pkgfile package