Skip to content
Snippets Groups Projects
Select Git revision
  • 163cfa9c3788585be8cb30e68978841b9d403e2c
  • experimental default protected
  • v2023.2.5-ffs
  • nrb/ex400-remove-wps
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • experimental-2025-09-15
  • experimental-2025-09-15-base
  • experimental-2025-09-12
  • experimental-2025-09-12-base
  • experimental-2025-09-11
  • experimental-2025-09-11-base
  • experimental-2025-09-08
  • experimental-2025-09-08-base
  • experimental-2025-09-07
  • experimental-2025-09-07-base
  • experimental-2025-09-05
  • experimental-2025-09-05-base
  • experimental-2025-09-03
  • experimental-2025-09-03-base
  • experimental-2025-08-29
  • experimental-2025-08-29-base
  • experimental-2025-08-26
  • experimental-2025-08-26-base
  • experimental-2025-08-25
  • experimental-2025-08-25-base
41 results

sign.sh

Blame
  • user avatar
    Jan-Niklas Burfeind authored
    to match the editorconfig
    
    awk code in contrib/sign.sh and contrib/sigtest.sh
    reformatted as gawk does
    2aa3527f
    History
    sign.sh 1022 B
    #!/bin/sh
    
    set -e
    
    if [ $# -ne 2 ] || [ "-h" = "$1" ] || [ "--help" = "$1" ] || [ ! -r "$1" ] || [ ! -r "$2" ]; then
    	cat <<EOHELP
    Usage: $0 <secret> <manifest>
    
    sign.sh adds lines to a manifest to indicate the approval
    of the integrity of the firmware as required for automated
    updates. The first argument <secret> references a file harboring
    the private key of a public-private key pair of a developer
    that referenced by its public key in the site configuration.
    The script may be performed multiple times to the same document
    to indicate an approval by multiple developers.
    
    See also
     * ecdsautils on https://github.com/freifunk-gluon/ecdsautils
    
    EOHELP
    	exit 1
    fi
    
    SECRET="$1"
    
    manifest="$2"
    upper="$(mktemp)"
    lower="$(mktemp)"
    
    trap 'rm -f "$upper" "$lower"' EXIT
    
    awk 'BEGIN    {
    	sep = 0
    }
    
    /^---$/ {
    	sep = 1;
    	next
    }
    
    {
    	if(sep == 0) {
    		print > "'"$upper"'"
    	} else {
    		print > "'"$lower"'"
    	}
    }' "$manifest"
    
    ecdsasign "$upper" < "$SECRET" >> "$lower"
    
    (
    	cat  "$upper"
    	echo ---
    	cat  "$lower"
    ) > "$manifest"