Hey,
I somewhat like the idea me too :)
I changed the signed package information to an information about _unsigned_ packages, as those should be more interesting. Its a totally informative message while installation is taking place. Output takes place in the callback.c function. I needed to add another int variable to the alpm_pkg_t, as I need to look for signatures in the package information AND for a signature file. If there is any chance that such functionality will be implemented in pacman, I could provide some command line option to enable this information ( enabling debug is NO alternative... ). Otherwise it was an exercise for me and I will stop mentally hurting you guys ;) -Rob ~~~~~~~~~~~~~~~~~~ The current output looks like this: ... Proceed with installation? [Y/n] checking package integrity... loading package files... checking for file conflicts... upgrading abcde... upgrading acpitool |Unsigned... ... Proceed with installation? [Y/n] (2/2) checking package integrity [###################################################] 100% (2/2) loading package files [###################################################] 100% (2/2) checking for file conflicts [###################################################] 100% (1/2) upgrading abcde [###################################################] 100% :: The following package is unsigned: (2/2) upgrading acpitool [###################################################] 100%
From fa2c83f3ed5def1bfc0ab99eb06a7f466387674c Mon Sep 17 00:00:00 2001 From: robert <r.evert_AT_tu-bs.de> Date: Thu, 3 Nov 2011 22:52:07 +0100 Subject: [PATCH] Added user feedback about unsigned packages for progressbar and --noprogressbar runs
--- lib/libalpm/alpm.h | 6 ++++++ lib/libalpm/be_package.c | 9 +++++++++ lib/libalpm/package.c | 7 +++++++ lib/libalpm/package.h | 1 + src/pacman/callback.c | 15 +++++++++++++-- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 9fda940..5e7e2ad 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -889,6 +889,12 @@ alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg); */ const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg); +/** Retuns 1 if package is signed via .sig file. + * @param pkg a pointer to package + * @return an int + */ +const int *alpm_pkg_get_has_sig(alpm_pkg_t *pkg); + /* End of alpm_pkg_t accessors */ /* @} */ diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 90a1972..2249108 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -508,6 +508,15 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, newpkg->infolevel |= INFRQ_FILES; } + /* Package signature checking again*/ + char *sigpath = _alpm_sigpath(handle, pkgfile); + if(sigpath && !_alpm_access(handle, NULL, sigpath, R_OK)) { + newpkg->signature_file = 1; + } else { + newpkg->signature_file = 0; + } + free(sigpath); + return newpkg; pkg_invalid: diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 0b0bf6e..fc1078a 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -242,6 +242,13 @@ const char SYMEXPORT *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg) return pkg->base64_sig; } +const int SYMEXPORT *alpm_pkg_get_has_sig(alpm_pkg_t *pkg) +{ + ASSERT(pkg != NULL, return NULL); + pkg->handle->pm_errno = 0; + return pkg->signature_file; +} + const char SYMEXPORT *alpm_pkg_get_arch(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 82a8326..1672f70 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -96,6 +96,7 @@ struct __alpm_pkg_t { off_t download_size; int scriptlet; + int signature_file; alpm_pkgreason_t reason; alpm_dbinfrq_t infolevel; diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 6f39013..accb851 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -171,8 +171,14 @@ void cb_event(alpm_event_t event, void *data1, void *data2) break; case ALPM_EVENT_ADD_START: if(config->noprogressbar) { - printf(_("installing %s...\n"), alpm_pkg_get_name(data1)); + if (alpm_pkg_get_base64_sig(data1) || alpm_pkg_get_has_sig(data1)) { + printf(_("installing %s...\n"), alpm_pkg_get_name(data1)); + } else + printf(_("installing %s |Unsigned...\n"), alpm_pkg_get_name(data1)); + } else if (alpm_pkg_get_base64_sig(data1) == 0 && alpm_pkg_get_has_sig(data1) == 0) { + printf(_(":: The following package is unsigned:\n")); } + break; case ALPM_EVENT_ADD_DONE: alpm_logaction(config->handle, "installed %s (%s)\n", @@ -192,7 +198,12 @@ void cb_event(alpm_event_t event, void *data1, void *data2) break; case ALPM_EVENT_UPGRADE_START: if(config->noprogressbar) { - printf(_("upgrading %s...\n"), alpm_pkg_get_name(data1)); + if (alpm_pkg_get_base64_sig(data1) || alpm_pkg_get_has_sig(data1)) { + printf(_("upgrading %s...\n"), alpm_pkg_get_name(data1)); + } else + printf(_("upgrading %s |Unsigned...\n"), alpm_pkg_get_name(data1)); + } else if (alpm_pkg_get_base64_sig(data1) == 0 && alpm_pkg_get_has_sig(data1) == 0) { + printf(_(":: The following package is unsigned:\n")); } break; case ALPM_EVENT_UPGRADE_DONE: