diff options
Diffstat (limited to 'src/abslibre-tools/libredbdiff')
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index bb6e068..8aa6ce1 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -19,28 +19,30 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +set -euE -o pipefail . "$(librelib messages)" . "$(librelib conf)" -load_files libredbdiff || exit 1 +load_files libredbdiff || exit +setup_traps -conffile_prbl="$statedir/pacman.conf.parabola" -conffile_arch="$statedir/pacman.conf.archlinux" +declare -r name="Libredbdiff" +declare -r cmd="${0##*/}" -dbpath_prbl="$statedir/pacman.parabola" -dbpath_arch="$statedir/pacman.archlinux" +declare -r conffile_prbl="$statedir/pacman.conf.parabola" +declare -r conffile_arch="$statedir/pacman.conf.archlinux" -mirrorlist_prbl="$statedir/mirrorlist.parabola" -mirrorlist_arch="$statedir/mirrorlist.archlinux" +declare -r dbpath_prbl="$statedir/pacman.parabola" +declare -r dbpath_arch="$statedir/pacman.archlinux" -name="Libredbdiff" -cmd="${0##*/}" +declare -r mirrorlist_prbl="$statedir/mirrorlist.parabola" +declare -r mirrorlist_arch="$statedir/mirrorlist.archlinux" -field_pkgname_prbl=30 -field_pkgname_arch=30 -field_pkgname_total="$((field_pkgname_prbl + field_pkgname_arch))" +declare -r field_pkgname_prbl=30 +declare -r field_pkgname_arch=30 +declare -r field_pkgname_total="$((field_pkgname_prbl + field_pkgname_arch))" -printf_format="%s %-${field_pkgname_prbl}s%-${field_pkgname_arch}s %s | %s\n" -printf_format_noarch="%s %-${field_pkgname_total}s %s\n" +declare -r printf_format="%s %-${field_pkgname_prbl}s%-${field_pkgname_arch}s %s | %s\n" +declare -r printf_format_noarch="%s %-${field_pkgname_total}s %s\n" enablerepo() { local repo="$1" @@ -79,7 +81,7 @@ createdir() { # - ver_arch : a map of pkgname->prbl_pkgver # - provides : a map of pkgname->provides compare_pkgs() { - if [[ -n "${ver_arch[$pkgname]}" ]] ; then + if [[ -n "${ver_arch[$pkgname]:-}" ]]; then if {{ "${ver_prbl[$pkgname]}" -lt "${ver_arch[$pkgname]}" }}; then printf "$printf_format" \ '=' \ @@ -88,11 +90,11 @@ compare_pkgs() { "${ver_prbl[$pkgname]}" \ "${ver_arch[$pkgname]}" fi - elif [[ -n "${provides[$pkgname]}" ]]; then + elif [[ -n "${provides[$pkgname]:-}" ]]; then local _provides provide read -r -a _provides <<<"${provides[$pkgname]}" for provide in "${_provides[@]}"; do - if [[ -n "${ver_arch[$provide]}" ]]; then + if [[ -n "${ver_arch[$provide]:-}" ]]; then if {{ "${ver_prbl[$pkgname]}" -lt "${ver_arch[$provide]}" }}; then printf "$printf_format" \ 'p' \ |