#!/usr/bin/env bash repo="Canop/broot" api=$(curl --silent "https://api.github.com/repos/$repo/releases/latest") new=$(echo $api | grep -Po '"tag_name": "v\K.*?(?=")') current=$(reprepro -b /var/www/repos/apt/debian list stable broot | head -n1 | awk '{print $3}') if [ "$current" == "$new" ]; then exit fi echo "New BROOT version $current -> $new" declare -A dist dist['amd64']='https://dystroy.org/broot/download/x86_64-linux/broot' dist['amd64 ']='https://dystroy.org/broot/download/x86_64-unknown-linux-gnu/broot' dist['armhf']='https://dystroy.org/broot/download/armv7-unknown-linux-gnueabihf/broot' for entry in "${!dist[@]}"; do STARTDIR="/tmp/broot" DESTDIR="$STARTDIR/pkg" OUTDIR="$STARTDIR/deb" rm -rf "$STARTDIR" mkdir "$STARTDIR" wget "${dist[$entry]}" -O /tmp/broot/broot install -Dm 755 "/tmp/broot/broot" "$DESTDIR/usr/bin/broot" mkdir -p "$DESTDIR/DEBIAN" if [[ "${dist[$entry]}" == *"x86_64-unknown-linux-gnu"* ]]; then new2="$new~bpo10" else new2="$new" fi cat >"$DESTDIR/DEBIAN/control"< Description: A new way to see and navigate directory trees Homepage: https://dystroy.org/broot/ Bugs: https://github.com/Canop/broot/issues EOL cat >"$STARTDIR/changelog"< $(date -R) EOL install -Dm 644 "$STARTDIR/changelog" "$DESTDIR/usr/share/doc/broot/changelog.Debian" gzip "$DESTDIR/usr/share/doc/broot/changelog.Debian" chmod 755 $DESTDIR/DEBIAN/* mkdir "$OUTDIR" dpkg-deb --build "$DESTDIR" "$OUTDIR" if [[ "${dist[$entry]}" == *"x86_64-unknown-linux-gnu"* ]]; then reprepro -b /var/www/repos/apt/debian includedeb oldstable "$OUTDIR"/*.deb elif [[ "${dist[$entry]}" == *"x86_64"* ]]; then reprepro -b /var/www/repos/apt/debian includedeb stable "$OUTDIR"/*.deb else reprepro -b /var/www/repos/apt/debian includedeb oldstable "$OUTDIR"/*.deb reprepro -b /var/www/repos/apt/debian includedeb stable "$OUTDIR"/*.deb fi rm -rf "$STARTDIR" done