#!/usr/bin/env bash set -x repo="azlux/log2ram" api=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq ".[0]") new=$(echo $api | grep -Po '"tag_name": "\K.*?(?=")') current=$(reprepro -b /var/www/repos/apt/debian list stable log2ram | head -n1| awk '{print $3}') current_beta=$(reprepro -b /var/www/repos/apt/debian list testing log2ram | head -n1| awk '{print $3}') [ "$current" == "$new" ] && exit 0 [ "$current_beta" == "$new" ] && exit 0 echo "MAJ depot LOG2RAM version $current -> $new" wget -q https://github.com/azlux/log2ram/archive/$new.tar.gz -O /tmp/log2ram.tar.gz tar xf /tmp/log2ram.tar.gz -C /tmp /tmp/log2ram-$new/build-packages.sh if [[ $new == *"b"* ]]; then reprepro -b /var/www/repos/apt/debian includedeb testing /tmp/log2ram-$new/deb/*.deb else reprepro -b /var/www/repos/apt/debian includedeb stable /tmp/log2ram-$new/deb/*.deb reprepro -b /var/www/repos/apt/debian includedeb oldstable /tmp/log2ram-$new/deb/*.deb reprepro -b /var/www/repos/apt/debian includedeb oldoldstable /tmp/log2ram-$new/deb/*.deb fi rm -r /tmp/log2ram-$new rm /tmp/log2ram.tar.gz