at 25.11-pre 797 B view raw
1#!/usr/bin/env bash 2 3# Download patches from debian project 4# Usage $0 debian-patches.txt debian-patches.nix 5# An example input and output files can be found in tools/graphics/plotutils 6 7DEB_URL=https://sources.debian.org/data/main 8declare -a deb_patches 9mapfile -t deb_patches < $1 10 11# First letter 12deb_prefix="${deb_patches[0]:0:1}" 13prefix="${DEB_URL}/${deb_prefix}/${deb_patches[0]}/debian/patches" 14 15if [[ -n "$2" ]]; then 16 exec 1> $2 17fi 18 19cat <<EOF 20# Generated by $(basename $0) from $(basename $1) 21let 22 prefix = "${prefix}"; 23in 24[ 25EOF 26for ((i=1;i < ${#deb_patches[@]}; ++i)); do 27 url="${prefix}/${deb_patches[$i]}" 28 sha256=$(nix-prefetch-url $url) 29 echo " {" 30 echo " url = \"\${prefix}/${deb_patches[$i]}\";" 31 echo " sha256 = \"$sha256\";" 32 echo " }" 33done 34echo "]"