anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

amalgamate-sql.sh (1658B)


      1 #!/bin/sh
      2 
      3 # This file is part of Anastasis
      4 # Copyright (C) 2026 Anastasis SARL
      5 #
      6 # ANASTASIS is free software; you can redistribute it and/or modify it under the
      7 # terms of the GNU General Public License as published by the Free Software
      8 # Foundation; either version 3, or (at your option) any later version.
      9 #
     10 # ANASTASIS is distributed in the hope that it will be useful, but WITHOUT ANY
     11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License along with
     15 # ANASTASIS; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     16 
     17 set -eu
     18 
     19 if [ $# -lt 1 ]; then
     20   echo "Usage: $0 SQLFILES..." >&2
     21   exit 1
     22 fi
     23 
     24 cat <<'EOF'
     25 --
     26 -- This file is part of Anastasis
     27 -- Copyright (C) 2020--2026 Anastasis SARL
     28 --
     29 -- ANASTASIS is free software; you can redistribute it and/or modify it under the
     30 -- terms of the GNU General Public License as published by the Free Software
     31 -- Foundation; either version 3, or (at your option) any later version.
     32 --
     33 -- ANASTASIS is distributed in the hope that it will be useful, but WITHOUT ANY
     34 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     35 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     36 --
     37 -- You should have received a copy of the GNU General Public License along with
     38 -- ANASTASIS; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     39 --
     40 EOF
     41 
     42 for x in $@; do
     43   echo -- generated from $x
     44   # Remove SQL comments and empty lines
     45   cat $x | sed -e "s/--.*//" | awk 'NF'
     46 done