#!/bin/bash

pacman -sSq | LANG=C pacman -Si | LANG=C grep "Download Size" | awk '
{
    size = $4;
    unit = $5;
    
    if (unit == "MiB") {
        sum += size * 1024;
    } else if (unit == "GiB") {
        sum += size * 1024 * 1024;
    } else {
        sum += size;
    }
}
END { 
    gib = sum / (1024 * 1024); 
    print sum " KiB (" gib " GiB)" 
}
'

