Skip to content

Instantly share code, notes, and snippets.

@nbyouri
Last active August 29, 2015 14:27
Show Gist options
  • Save nbyouri/ec39a9d51204d9aa2391 to your computer and use it in GitHub Desktop.
Save nbyouri/ec39a9d51204d9aa2391 to your computer and use it in GitHub Desktop.
Don't ask for install confirmation when only downloading. (pkgin -d in <pkg>)
diff --git a/actions.c b/actions.c
index ea80c3d..766486b 100644
--- a/actions.c
+++ b/actions.c
@@ -465,7 +465,7 @@ pkgin_install(char **opkgargs, uint8_t do_inst)
printf("\n");
- if (upgradenum > 0) {
+ if (do_inst && upgradenum > 0) {
/* record ordered remove list before upgrade */
removehead = order_upgrade_remove(impacthead);
@@ -504,7 +504,7 @@ pkgin_install(char **opkgargs, uint8_t do_inst)
}
}
- } else
+ } else if (do_inst)
printf(MSG_NOTHING_TO_UPGRADE);
if (installnum > 0) {
@@ -519,14 +519,18 @@ pkgin_install(char **opkgargs, uint8_t do_inst)
#endif
}
- printf(MSG_PKGS_TO_INSTALL, installnum, h_fsize, h_psize,
- toinstall);
+ if (do_inst)
+ printf(MSG_PKGS_TO_INSTALL, installnum, h_fsize, h_psize,
+ toinstall);
+ else
+ printf(MSG_PKGS_TO_DOWNLOAD, installnum, h_fsize, toinstall);
+
printf("\n");
if (unmet_reqs != NULL)/* there were unmet requirements */
printf(MSG_REQT_MISSING, unmet_reqs);
- if (check_yesno(DEFAULT_YES) == ANSW_NO)
+ if (do_inst && check_yesno(DEFAULT_YES) == ANSW_NO)
exit(rc);
/*
diff --git a/messages.h b/messages.h
index a64ee1e..1389858 100644
--- a/messages.h
+++ b/messages.h
@@ -77,6 +77,7 @@
#define MSG_PKGS_TO_UPGRADE "%d packages to be upgraded:\n%s\n"
#define MSG_PKGS_TO_REMOVE "%d packages to be removed: \n%s\n"
#define MSG_NOTHING_TO_UPGRADE "nothing to upgrade.\n"
+#define MSG_PKGS_TO_DOWNLOAD "%d packages to be downloaded (%s to download):\n%s\n"
#define MSG_PKGS_TO_INSTALL \
"%d packages to be installed (%s to download, %s to install):\n%s\n"
#define MSG_RM_UPGRADE_PKGS "removing packages to be upgraded...\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment