#!/bin/bash # Copyright (c) 2017 sakaki # License: GPL 3.0+ # NO WARRANTY # # Check the master hash for the gentoo repo, if rsync'd from # the isshoni.org server. # # If the hashes do NOT match, kill the parent process to ensure that # emerge --sync etc. does not proceed any further (simply returning # a non-zero exit code is insufficient to do that, and we don't want # e.g. genup building updates on the basis of an invalid repo). repository_name="${1}" # The URI to which the repository was synced. sync_uri="${2}" # The path to the repository. repository_path="${3}" ret=0 if [[ "${repository_name}" == "gentoo" && \ "${sync_uri}" == "rsync://isshoni.org/gentoo-portage-pi64" ]]; then echo "Checking master signature on gentoo repo..." porthash --repo="${repository_path}" ret=$? if ((ret!=0)); then echo "Killing parent process..." 1>&2 # need to do this or e.g. genup will blithely continue kill -SIGQUIT $(ps --pid $$ -oppid=) fi fi # Return explicit status. exit "${ret}"