backport changes from manjaro-tools