#!/bin/bash blacklist-normalize() { sed -e 's/^[^:]*$/&::/' -e 's/^[^:]*:[^:]*$/&:/' } blacklist-cat() { blacklist-normalize < "$XDG_CACHE_HOME/libretools/blacklist.txt" } blacklist-update() ( set -euE . /usr/share/libretools/conf.sh . libremessages load_files libretools check_vars BLACKLIST local remote_blacklist="$BLACKLIST" local local_blacklist="$XDG_CACHE_HOME/libretools/blacklist.txt" stat_busy "Downloading blacklist of proprietary software packages" mkdir -p "${local_blacklist%/*}" if wget -N -q -O "${local_blacklist}.part" "$remote_blacklist" 2>/dev/null; then stat_done mv "${local_blacklist}.part" "$local_blacklist" else stat_done rm "${local_blacklist}.part" if [[ -e "$local_blacklist" ]]; then warning "Using local copy of blacklist" else error "Download failed, exiting" return 1 fi fi ) blacklist-lookup() { local pkg=$1 blacklist-cat | sed 's/^/^/' | grep -F "^$pkg:" | sed 's/^^//' } blacklist-get-pkg() { cut -d: -f1 } blacklist-get-rep() { cut -d: -f2 } blacklist-get-reason() { cut -d: -f3- }