Skip to content
Snippets Groups Projects
Select Git revision
  • 17a6e1d8d7e4ce0ab349690625e05adb759374b8
  • 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-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
  • experimental-2025-08-20
  • experimental-2025-08-20-base
  • experimental-2025-08-13
  • experimental-2025-08-13-base
  • experimental-2025-08-04
  • experimental-2025-08-04-base
  • experimental-2025-07-31
  • experimental-2025-07-31-base
  • experimental-2025-07-29
  • experimental-2025-07-29-base
  • experimental-2025-07-28
  • experimental-2025-07-28-base
  • experimental-2025-07-26
  • experimental-2025-07-26-base
41 results

modules

Blame
  • 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"