| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/bin/bash
- #
- # Copyright (c) 2020 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/>.
- #
- # This script is meant to be run from a USB stick, say, to deploy
- # this site specific files on a DIU.
- #
- # This includes
- #
- # * The private SSH key
- # * The `common_values.sh` file
- # * The `diu_ui_site_specific.js` admin interface file
- # * Any paddles that might need transfer
- #
- # This will look for a local `data` directory with all the appropriate files
- #
- BASEDIR="data"
- SSH_FILE=$BASEDIR/id_rsa
- COM_VAL=$BASEDIR/common_values.sh
- DIU_UI=$BASEDIR/diu_ui_site_specific.js
- if [[ -e "$SSH_FILE" ]] ; then
- echo "# deploying SSH file $SSH_FILE to /home/bus/.ssh"
- cp -L -f "$SSH_FILE" /home/bus/.ssh/id_rsa
- chmod a-rwx /home/bus/.ssh/id_rsa
- chmod u+r /home/bus/.ssh/id_rsa
- else
- echo "# FILE NOT FOUND (SSH id_rsa): $SSH_FILE"
- fi
- if [[ -e "$COM_VAL" ]] ; then
- echo "# deploying common_values.sh file $COM_VAL to /home/bus/config/common_values.sh"
- cp -L -f "$COM_VAL" /home/bus/config
- else
- echo "# FILE NOT FOUND (COMMON VALUES): $COM_VAL"
- fi
- if [[ -e "$DIU_UI" ]] ; then
- echo "# deploying diu_site_specific file: $DIU_UI -> /home/bus/config/html/js/diu_site_sepcific.js"
- cp -L -f "$DIU_UI" /home/bus/config/html/js/diu_site_specific.js
- else
- echo "# FILE NOT FOUND (DIU SITE SPECIFIC): $DIU_UI"
- fi
- for pfn in `find data -name '*.paddle' -type f` ; do
- bpfn=`basename $pfn`
- echo "# deploying paddle file: $pfn -> /home/bus/config/$bpfn"
- cp -L -f "$pfn" /home/bus/config/$bpfn
- done
- echo "# done"
|