Public
Snippet $331 authored by Guillaume Hervier

rdiff-backup-patch-script

Edited
patch.sh
URLS=(
  'https://lab.nexedi.com/nexedi/rdiff-backup/merge_requests/1.patch'
  'https://lab.nexedi.com/nexedi/rdiff-backup/merge_requests/2.patch'
  # 'https://lab.nexedi.com/nexedi/rdiff-backup/merge_requests/3.patch'
)

if [ $# -lt 1 ]; then
    echo "Usage: patch.sh <patch|revert>"
    exit 1
fi

ACTION=$1
echo "Running $ACTION"

case $ACTION in
    "patch")
        for url in ${URLS[@]}; do
            curl $url | patch -p1
        done
        ;;

    "revert")
        for (( idx=${#URLS[@]}-1 ; idx>=0 ; idx-- )) ; do
            url="${URLS[idx]}"
            curl $url | patch -p1 -R
        done
esac