summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-04-24 13:01:04 +0000
committerjkh <jkh@FreeBSD.org>1995-04-24 13:01:04 +0000
commitd46c3a542a9ebd1643836c2a9f74b2b28e12ec9e (patch)
tree6b5f50ffdb1cf20519f1bff2a19aed10bd7b3654
parent3ea8818b8fad560c4e00fef4249a7a55f33b7997 (diff)
downloadFreeBSD-src-d46c3a542a9ebd1643836c2a9f74b2b28e12ec9e.zip
FreeBSD-src-d46c3a542a9ebd1643836c2a9f74b2b28e12ec9e.tar.gz
Commit the latest version of this. This version appears to handle package
failure much more gracefully, as well as implement a few new needed features. Check it out! Submitted by: Marc van Kempen <wmbfmk@urc.tue.nl>
-rw-r--r--usr.sbin/pkg_manage/Makefile7
-rw-r--r--usr.sbin/pkg_manage/TODO3
-rw-r--r--usr.sbin/pkg_manage/pkg_del_inst.hlp14
-rw-r--r--usr.sbin/pkg_manage/pkg_ds_install.hlp9
-rw-r--r--usr.sbin/pkg_manage/pkg_install.hlp30
-rw-r--r--usr.sbin/pkg_manage/pkg_main.hlp7
-rw-r--r--usr.sbin/pkg_manage/pkg_manage.1190
-rw-r--r--usr.sbin/pkg_manage/pkg_manage.c30
-rw-r--r--usr.sbin/pkg_manage/pkg_manage.h4
-rw-r--r--usr.sbin/pkg_manage/pkg_preview.hlp11
-rw-r--r--usr.sbin/pkg_manage/pkg_preview_fs.hlp10
-rw-r--r--usr.sbin/pkg_manage/pkg_ui.c85
-rw-r--r--usr.sbin/pkg_manage/pkg_view_inst.hlp8
13 files changed, 260 insertions, 148 deletions
diff --git a/usr.sbin/pkg_manage/Makefile b/usr.sbin/pkg_manage/Makefile
index 21017da..be38a2b 100644
--- a/usr.sbin/pkg_manage/Makefile
+++ b/usr.sbin/pkg_manage/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 1995/04/21 10:05:36 jkh Exp $
+# $Id: Makefile,v 1.3 1995/04/21 10:23:23 jkh Exp $
PROG= pkg_manage
SRCS= pkg_main.c pkg_manage.c pkg_ui.c version.c
@@ -10,8 +10,9 @@ CFLAGS+= -Wall -Wstrict-prototypes -DHELP_PATH=\"${HELPDIR}/\" \
HELPDIR = /usr/share/misc/pkg_manage
-HELPS= pkg_view-inst.hlp pkg_del-inst.hlp pkg_preview.hlp \
- pkg_install.hlp pkg_main.hlp
+HELPS= pkg_del-inst.hlp pkg_install.hlp pkg_preview_fs.hlp \
+ pkg_del_inst.hlp pkg_main.hlp pkg_view-inst.hlp \
+ pkg_ds_install.hlp pkg_preview.hlp pkg_view_inst.hlp
afterinstall:
@if [ ! -d ${HELPDIR} ]; then rm -f ${HELPDIR}; mkdir -p ${HELPDIR}; fi
diff --git a/usr.sbin/pkg_manage/TODO b/usr.sbin/pkg_manage/TODO
index 77552b0..8526151 100644
--- a/usr.sbin/pkg_manage/TODO
+++ b/usr.sbin/pkg_manage/TODO
@@ -75,6 +75,7 @@ done 6Apr95
Low priority, because something fishy is going on then anyway
- use $TMPDIR to create tmp directory into
+done 18Apr95
- make sure that when calling help, the helplines are disabled.
done 11Apr95, also implemented a different mechanism to save and
@@ -84,4 +85,4 @@ restore helplines
done 11Apr95
- (next version?) implement exec_catch_errors with popen(), I think
- this will speed up things quite a bit.
+ this will speed up things quite a bit. (not sure about it)
diff --git a/usr.sbin/pkg_manage/pkg_del_inst.hlp b/usr.sbin/pkg_manage/pkg_del_inst.hlp
new file mode 100644
index 0000000..f33813d
--- /dev/null
+++ b/usr.sbin/pkg_manage/pkg_del_inst.hlp
@@ -0,0 +1,14 @@
+
+ Choose a package from the list of installed packages to delete.
+ Move the cursor to the package to be deleted and press enter.
+
+ You may now select to either:
+
+ 1. Simulate delete Only display the commands that will
+ be executed to delete the package,
+ without actually executing them.
+ 2. Delete This will actually delete the
+ package.
+ 3. Cancel Return to the package selection menu.
+
+ (use arrow-keys or digit to choose option and press enter)
diff --git a/usr.sbin/pkg_manage/pkg_ds_install.hlp b/usr.sbin/pkg_manage/pkg_ds_install.hlp
new file mode 100644
index 0000000..474ed9c
--- /dev/null
+++ b/usr.sbin/pkg_manage/pkg_ds_install.hlp
@@ -0,0 +1,9 @@
+
+ Select the directory where your packages are stored.
+
+ Use TAB, SHIFT-TAB to move from one field to another.
+ When in the directory list, pressing enter over a
+ directory will move you into that directory.
+
+ Select the <OK> button and press enter to continue,
+ Select the <Cancel> button to return.
diff --git a/usr.sbin/pkg_manage/pkg_install.hlp b/usr.sbin/pkg_manage/pkg_install.hlp
index 6cb1afe..af03084 100644
--- a/usr.sbin/pkg_manage/pkg_install.hlp
+++ b/usr.sbin/pkg_manage/pkg_install.hlp
@@ -1,19 +1,21 @@
- ***********************************
- * Help for '4. Install pkg files' *
- ***********************************
+ There are several fields in the current window, you can move from
+ one to the other by pressing 'TAB' and 'SHIFT-TAB'.
-Use the 'File Select' dialog to pick a filename. Use the TAB key to
-move from field to field and press enter to commit changes or select
-items. In the "Directories:"-list and the "Files:"-list use the
-arrow-keys and PgUp and PgDn to move through the list.
+ In the left selection list, mark the packages you wish to install.
+ Pressing space will mark the current package, '*' will mark all
+ packages, '-' will unmark all packages.
+ To view information about a package press either 'ENTER' for
+ a one line description, or 'F2' for a longer description.
-After having chosen a package, you can choose to either:
+ The right selection list lists the already installed packages.
+ Here you can also view information about these by using the same
+ keys as described above.
-1. Simulate install Display the commands, necessary to install
- the package, without actually executing them.
-2. Install Install a package.
-3. Cancel Don't install the package and return to the
- previous menu.
+ After having marked the packages of your choice, move to the
+ <Install marked> button with 'TAB' or 'SHIFT-TAB' and press
+ 'ENTER' to actually install them. Before installation a check
+ will be made if a selected package is already installed. If so,
+ you will be given the choice to delete that package, or skip
+ the selected package.
-(use arrow-keys or digit to choose option and press enter)
diff --git a/usr.sbin/pkg_manage/pkg_main.hlp b/usr.sbin/pkg_manage/pkg_main.hlp
index b0ac7db..db671a9 100644
--- a/usr.sbin/pkg_manage/pkg_main.hlp
+++ b/usr.sbin/pkg_manage/pkg_main.hlp
@@ -1,8 +1,7 @@
- **********************
- * Help for Main menu *
- **********************
+ This is the main menu for pkg_manage:
-Use the arrow-keys or a digit to select an option and press enter.
+ Select one of the options using the arrow-keys or press the
+ corresponding digit, and press enter
diff --git a/usr.sbin/pkg_manage/pkg_manage.1 b/usr.sbin/pkg_manage/pkg_manage.1
index 3cd8614..8a14845 100644
--- a/usr.sbin/pkg_manage/pkg_manage.1
+++ b/usr.sbin/pkg_manage/pkg_manage.1
@@ -6,47 +6,45 @@
.TP
.B pkg_manage
.SH DESCRIPTION
-Pkg_manage is an interactive tool with which you can install,
-delete and view packages. It is essentially a
-front-end to the pkg_add(1), pkg_info(1) and pkg_delete(1) programs
-which uses the new libdialog extensions for the GUI.
+Pkg_manage is an interactive tool with wich you can install,
+delete and view packages. It is a
+front-end to the pkg_add(1), pkg_info(1) and pkg_delete(1) programs.
-Pressing F1 (or '?') at any time during the program will bring up
-on-line help. (Pressing '?' will not invoke help when in character
-input fields).
+Pressing F1 (or '?') at anytime during the program will bring up
+online-help. (Pressing '?' will not invoke help when in character
+input fields)
.SH NAVIGATING THE MENU
-At start time, pkg_manage will present a menu with the following choices:
+When starting pkg_manage you will be put in a menu with the following
+choices:
.TP
.B 1. View installed.
You will be offered an overview of the installed
-packages. Moving the cursor to a package name and pressing the
-.B Enter
-key will show additional information for the package. Use the
+packages. Moving the cursor to a packagename and pressing 'enter'
+will show additional information for the package. Use the
.B PgUp
and
.B PgDn
-keys to page through the information. Press the
+keys to page through the information. Press
.B Enter
-key (this selects the
+(this selects the
.B <EXIT>
-button) to return to the `View installed Packages' menu.
+button) to return to the 'View installed Packages' menu.
-When done viewing packages, move the cursor to the
+When done viewing packages move the cursor to the
.B <Cancel>
button with the right-arrow key (or left-arrow key)
-and press Enter. This will return you to the main menu.
+and press enter. This will return you to the main-menu.
.TP
.B 2. Delete installed
-You can select a package from the list of installed packages for deletion.
-Move the cursor to the package you wish to delete and press Enter. This will
+You can choose a package from the installed ones to delete. Move the
+cursor to the package you wish to delete and press enter. This will
bring up another menu from which you can choose to either:
.B 1. Simulate delete:
-Have a look at the commands that are going to be executed rather than
-executing them (recommended).
+Have a look at the commands that are going to be executed (recommended).
.B 2. Delete:
Execute the commands to delete the package.
.B 3. Cancel:
@@ -58,90 +56,106 @@ previous menu.
Choose the
.B <Cancel>
button if you don't want to delete any packages
-and return to the main menu.
+and return to the main-menu.
.TP
-.B 3. View pkg files
-Take a look at the descriptions of not-yet-installed packages and see if you
-want any of them or not.
-For this option, you'll be asked to chose a package file name using the new
-file selector object. See below for a description of the usage of the
-file selector.
+.B 3. Preview package
+Take a look at the commands that will be executed upon installation
+of a package.
+Choose a package with the fileselector. See below for a description of
+the usage of the fileselector.
.TP
-.B 4. Install pkg files
-Install packages of your choice. Use the file selector to select a
-package.
+.B 4. Install packages
+Install packages of your choice. Use the directoryselector to select a
+directory containing your packages. Move the cursor to
+.B <OK>
+to continue,
+.B <Cancel>
+to back out.
+Once a directory has been chosen, it will be scanned for packages files,
+tpically files ending in '.tgz'. These will be listed in
+a listbox (the one on the left) as well as the already installed
+packages, that will be listed in a similar box (on the right side).
+Use TAB or SHIFT-TAB to move from field to field.
+Packages can be selected in the left listbox, using either the
+space bar, to mark/unmark a single package at a time, or by using
+\'*', '-' to mark/unmark all packages at once.
+Once the packages have been selected move to the
+.B <Install marked>
+button and press enter. If you want to back out, press either ESC
+or move to the
+.B <Cancel>
+button and press enter.
+Under the left listbox, the number of kilobytes that the packages will
+consume once installed, are indicated.
.TP
.B 5. Quit
-Well, just try this one if you get fed up fiddling with your packages.
-
-.SH USING THE FILE SELECTOR
-
-Using the file selector is really quite simple, with a typical file selector
-dialog looking something like this:
-
-.nf
-+----------------------------------------------------------+
-| Filemask: Directory: |
-| +-----------------+ +----------------------------------+ |
-| |*.tgz | |/seperate/home/marc/src/pkg_manage| |
-| +-----------------+ +----------------------------------+ |
-| | Directories: Files: |
-| +--------------------------+ +-------------------------+ |
-| |.. | |mlist-1.2_bin.tgz | |
-| |libdialog | | | |
-| | | | | |
-| | | | | |
-| | | | | |
-| | | | | |
-| | | | | |
-| +-------------------(100%)-+ +------------------(100%)-+ |
-| Selection: |
-| +------------------------------------------------------+ |
-| | | |
-| +------------------------------------------------------+ |
-| +------+ +----------+ |
-| | <Ok> | | <Cancel> | |
-| +------+ +----------+ |
-+----------------------------------------------------------+
-
-.fi
-You may use the
+Well just try this one if you get fed up fiddling with your packages.
+
+.SH USING THE FILESELECTOR
+
+Using the fileselector is really very simple.
+
+.\"
+.\" Does anyone know how I can enter this into the manpage?
+.\"
+.\"+----------------------------------------------------------+
+.\"| Filemask: Directory: |
+.\"| +-----------------+ +----------------------------------+ |
+.\"| |*.tgz | |/seperate/home/marc/src/pkg_manage| |
+.\"| +-----------------+ +----------------------------------+ |
+.\"| | Directories: Files: |
+.\"| +--------------------------+ +-------------------------+ |
+.\"| |.. | |mlist-1.2_bin.tgz | |
+.\"| |libdialog | | | |
+.\"| | | | | |
+.\"| | | | | |
+.\"| | | | | |
+.\"| | | | | |
+.\"| | | | | |
+.\"| +-------------------(100%)-+ +------------------(100%)-+ |
+.\"| Selection: |
+.\"| +------------------------------------------------------+ |
+.\"| | | |
+.\"| +------------------------------------------------------+ |
+.\"| +------+ +----------+ |
+.\"| | <Ok> | | <Cancel> | |
+.\"| +------+ +----------+ |
+.\"+----------------------------------------------------------+
+.\"
+Use the
.B TAB
-key to move forward from one input or display field to
-the next. If enabled in the termcap file,
+key to move forwards from one input/display field to
+the next. If enabled in the termcap,
.B Shift-TAB
-will also move backwards.
-Pressing the
-.B Enter
-key in a field will commit any changes you may have made and
-move to the next field. Pressing the
+will move backwards.
+Pressing enter in a field will perform the changes you may have made and
+move to the next field. Pressing
.B TAB
-key will discard any changes and move to the next field.
+will discard the changes and move to the next field.
The
.B "Filemask:"
-field controls what kind of files will be displayed in the
+controls what kind of files will be displayed in the
.B "Files:"
-list. The expression follows the same globbing rules that your shell
-does, e.g. \'*.tgz' will only show files having names ending with '.tgz'.
+list. The expression follows the same rules as your shell does, i.e.
+\'*.tgz' will only show files having names ending with '.tgz'.
-The
.B "Directory:"
-field displays the current directory. You can also type another directory
-name into this field.
+displays the current directory. You can also type in another directory
+in this field.
The
.B "Directories:"
list enables you to browse the filesystem. Select
.B '..'
-and press Enter to
-go up the directory tree, select any other directory listed to descend
+and press enter to
+go up the directory tree, select any other directory listed to descent
into that directory.
-Finally, there three more fields: The
+Finally there three more fields: The
.B Selection:
, the
.B <Ok>
@@ -149,22 +163,28 @@ button and the
.B <Cancel>
button. The file chosen in the
.B Files:
-field, assuming you pressed Enter, will be displayed in the
+field, assuming you pressed enter, will be displayed in the
.B Selection:
field. You can also change this value directly by editing the field.
When you are satisfied with the current selection you can move the cursor
to the
.B <Ok>
-button and press Enter. If you want to back out, move the cursor to the
+button and press enter. If you want to back out, move the cursor to the
.B <Cancel>
-button and press Enter.
+button and press enter.
+
+.SH USING THE DIRECTORYSELECTOR
+
+This is basically the same as using the fileselector. There are just no
+files to select. Once the directory has been chosen, choose
+.B <OK>
.SH SEE ALSO
pkg_add(1), pkg_info(1), pkg_delete(1), pkg_create(1).
.SH BUGS
-Haven't met them yet.
+Sure.
.SH AUTHORS
Marc van Kempen (wmbfmk@urc.tue.nl)
diff --git a/usr.sbin/pkg_manage/pkg_manage.c b/usr.sbin/pkg_manage/pkg_manage.c
index 58cbed8..3a1a0b4 100644
--- a/usr.sbin/pkg_manage/pkg_manage.c
+++ b/usr.sbin/pkg_manage/pkg_manage.c
@@ -1,6 +1,6 @@
/***************************************************************
*
- * Program: pkg_manage
+ * Program: pkg_manage.c
* Author: Marc van Kempen
* Desc: Add, delete packages with the pkg_* binaries
* Get info about installed packages
@@ -8,7 +8,8 @@
*
* 1. View installed packages
* 2. Delete installed packages
- * 3. Install packages
+ * 3. Preview package install
+ * 4. Install packages
*
* Copyright (c) 1995, Marc van Kempen
*
@@ -51,32 +52,21 @@ FreeInfo(void)
* Desc: free the space allocated to p_inf
*/
{
+ int i;
+
free(p_inf.buf);
free(p_inf.name);
free(p_inf.comment);
free(p_inf.description);
p_inf.Nitems = 0;
- FreeMnu(p_inf.mnu, 2*p_inf.Nitems);
+ for (i=0; i<2*p_inf.Nitems; i++) {
+ free(p_inf.mnu[i]);
+ }
+ free(p_inf.mnu);
return;
} /* FreeInfo() */
-void
-FreeMnu(unsigned char **mnu, int n)
-/*
- * Desc: free mnu array
- */
-{
- int i;
-
- for (i=0; i<n; i++) {
- free(mnu[i]);
- }
- free(mnu);
-
- return;
-} /* FreeMnu() */
-
int
file_exists(char *fname)
/*
@@ -349,8 +339,6 @@ install_package(char *fname)
fprintf(stderr, "install_package(): Error malloc'ing tmp_file\n");
exit(-1);
}
- if (!getenv("PKG_PATH"))
- putenv("/usr/ports/packages:/usr/ports/packages/all:.");
exec_catch_errors(PKG_ADD, fname, tmp_file);
unlink(tmp_file);
diff --git a/usr.sbin/pkg_manage/pkg_manage.h b/usr.sbin/pkg_manage/pkg_manage.h
index f17059b..d25e55f 100644
--- a/usr.sbin/pkg_manage/pkg_manage.h
+++ b/usr.sbin/pkg_manage/pkg_manage.h
@@ -60,7 +60,8 @@ typedef struct {
#define INSTALL_HLP HELP_PATH##"pkg_install.hlp"
#define MAIN_HLP HELP_PATH##"pkg_main.hlp"
#define DS_INSTALL_HLP HELP_PATH##"pkg_ds_install.hlp"
-
+#define PREVIEW_HLP HELP_PATH##"pkg_preview.hlp"
+#define PREVIEW_FS_HLP HELP_PATH##"pkg_preview_fs.hlp"
/*
* prototypes
@@ -68,7 +69,6 @@ typedef struct {
void run_menu(void);
void get_pkginfo(void);
-void FreeMnu(unsigned char **mnu, int n);
void FreeInfo(void);
void install_package(char *fname);
int get_pkg_index(char *selection);
diff --git a/usr.sbin/pkg_manage/pkg_preview.hlp b/usr.sbin/pkg_manage/pkg_preview.hlp
index 42a6711..b3f6a00 100644
--- a/usr.sbin/pkg_manage/pkg_preview.hlp
+++ b/usr.sbin/pkg_manage/pkg_preview.hlp
@@ -1,12 +1,5 @@
- ********************************
- * Help for '3. View pkg files' *
- ********************************
-Use the 'File Select' dialog to pick a filename. Use the TAB key to
-move from field to field and press enter to commit changes or select
-items. In the "Directories:"-list and the "Files:"-list use the
-arrow-keys and PgUp and PgDn to move through the list.
+ Shown are the commands that will be executed when the package
+ is installed.
-After having chosen a package use the arrow-keys and PgUp and PgDn
-to move through the text.
diff --git a/usr.sbin/pkg_manage/pkg_preview_fs.hlp b/usr.sbin/pkg_manage/pkg_preview_fs.hlp
new file mode 100644
index 0000000..5a7e3fe
--- /dev/null
+++ b/usr.sbin/pkg_manage/pkg_preview_fs.hlp
@@ -0,0 +1,10 @@
+
+ Select a package. The commands that will be executed on installation
+ of this package will be shown.
+
+ Use TAB and SHIFT-TAB to move from field to field.
+
+ Selection: contains the name of the selected filename. Edit the field
+ directly of choose a filename from the "Files:" box.
+
+
diff --git a/usr.sbin/pkg_manage/pkg_ui.c b/usr.sbin/pkg_manage/pkg_ui.c
index a24452d..b612aa5 100644
--- a/usr.sbin/pkg_manage/pkg_ui.c
+++ b/usr.sbin/pkg_manage/pkg_ui.c
@@ -147,6 +147,45 @@ delete_installed(void)
} /* delete_installed() */
void
+preview_pkg(void)
+/*
+ * Desc: View the package description and comment before installation
+ */
+{
+ char *fname, *tmp_file;
+ char args[512], title[512];
+ int err;
+
+ use_helpfile(PREVIEW_FS_HLP);
+ fname = dialog_fselect(".", "*.tgz");
+ while (fname) {
+ use_helpfile(PREVIEW_HLP);
+ use_helpline("use PgUp and PgDn and arrow-keys to move through the text");
+ tmp_file = tempnam(NULL, "pkg.");
+ if (!tmp_file) {
+ fprintf(stderr, "preview_pkg: Could not allocate space fore tmp_file");
+ exit(-1);
+ }
+ sprintf(args, "-n %s", fname);
+ err = exec_catch_errors(PKG_ADD, args, tmp_file);
+ if (!err) {
+ sprintf(title, "Preview package <%s>", fname);
+ dialog_textbox(title, tmp_file, LINES, COLS);
+ }
+ unlink(tmp_file);
+ free(fname);
+ free(tmp_file);
+ use_helpfile(PREVIEW_FS_HLP);
+ fname = dialog_fselect(".", "*.tgz");
+ }
+ if (fname) free(fname);
+ use_helpfile(NULL);
+ use_helpline(NULL);
+
+ return;
+} /* preview_pkg() */
+
+void
install_batch(void)
/*
* Desc: install several packages.
@@ -209,9 +248,25 @@ install_batch(void)
}
names = (char **) malloc( sizeof(char *) * nf);
+ if (!names) {
+ fprintf(stderr, "install_batch(): Error mallocing space for names\n");
+ exit(-1);
+ }
comment = (char **) malloc( sizeof(char *) * nf );
+ if (!comment) {
+ fprintf(stderr, "install_batch(): Error malloc'ing space for comment\n");
+ exit(-1);
+ }
desc = (char **) malloc( sizeof(char *) * nf );
+ if (!desc) {
+ fprintf(stderr, "install_batch(): Error malloc'ing space for desc\n");
+ exit(-1);
+ }
sizes = (long *) malloc( sizeof(long) * nf );
+ if (!sizes) {
+ fprintf(stderr, "install_batch(): Error malloc'ing space for desc\n");
+ exit(-1);
+ }
/* get_desc extracts the info from the file names[i] and puts the */
/* comment in comment[i] and the description in desc[i], space is */
@@ -227,7 +282,11 @@ install_batch(void)
fprintf(stderr, "install_batch(): Error malloc'ing space for tmpfile\n");
exit(1);
}
- sprintf(tmp_dir, "/tmp/%s", tmp_file);
+ if (getenv("TMPDIR")) {
+ sprintf(tmp_dir, "%s/%s", getenv("TMP_DIR"), tmp_file);
+ } else {
+ sprintf(tmp_dir, "/tmp/%s", tmp_file);
+ }
free(tmp_file);
if (mkdir(tmp_dir, S_IRWXU)) {
dialog_notify("Could not create temporary directory in /tmp, exiting");
@@ -242,6 +301,10 @@ install_batch(void)
w = dupwin(curscr);
+ if (!w) {
+ fprintf(stderr, "install_batch(): Error malloc'ing new window\n");
+ exit(-1);
+ }
a = (int *) malloc( nf * sizeof(int) );
j = 0;
for (i=0; i<nf; i++) {
@@ -407,10 +470,10 @@ install_batch(void)
i=0;
n=0;
while (i < nf) {
- if ((pkg_obj->seld[i]) && (already_installed(names[i+p]))) {
+ if ((pkg_obj->seld[i]) && (already_installed(names[i]))) {
/* popup a warning and remove the package from the */
/* packages that are going to be installed */
- sprintf(msg, " The following package is already installed:\n %s (%s)\n",
+ sprintf(msg, " The following package is already installed:\n\n %s (%s)\n\n",
names[i], fnames[i]);
strcat(msg, " This package will be skipped\n");
strcat(msg, " If you want to install it anyway, remove it first");
@@ -424,7 +487,7 @@ install_batch(void)
for (i=0; i<nf; i++) {
if (pkg_obj->seld[i]) {
dialog_gauge("Installing packages:", names[i], LINES/2-3,
- COLS/2-30, 7, 60, (int) ((float) i/n*100));
+ COLS/2-30, 7, 60, (int) ((float) (i+1)/n*100));
install_package(fnames[i]);
}
}
@@ -462,8 +525,9 @@ run_menu(void)
unsigned char *pkg_menu[] = {
"1. View installed", "Overview of the installed packages",
"2. Delete installed", "Delete an installed package",
- "3. Install packages", "Install one or more packages",
- "4. Quit", "Leave the program",
+ "3. Preview package", "Preview commands executed on installation",
+ "4. Install packages", "Install one or more packages",
+ "5. Quit", "Leave the program",
};
quit_pkg = FALSE;
@@ -471,7 +535,7 @@ run_menu(void)
use_helpline("F1=help, use arrow-keys or digit to select option and press enter");
use_helpfile(MAIN_HLP);
if (dialog_menu("Package Manager", "Choose one of the options",
- LINES, COLS, 4, 4, pkg_menu, selection, &ch, &sc)) {
+ LINES, COLS, 5, 5, pkg_menu, selection, &ch, &sc)) {
quit_pkg = TRUE;
} else {
sel = atoi(selection);
@@ -482,10 +546,13 @@ run_menu(void)
case 2: /* Delete installed package */
delete_installed();
break;
- case 3: /* Install multiple packages */
+ case 3: /* Preview install */
+ preview_pkg();
+ break;
+ case 4: /* Install multiple packages */
install_batch();
break;
- case 4: /* Quit */
+ case 5: /* Quit */
quit_pkg = TRUE;
break;
}
diff --git a/usr.sbin/pkg_manage/pkg_view_inst.hlp b/usr.sbin/pkg_manage/pkg_view_inst.hlp
new file mode 100644
index 0000000..af01a66
--- /dev/null
+++ b/usr.sbin/pkg_manage/pkg_view_inst.hlp
@@ -0,0 +1,8 @@
+
+ Choose a package from the list to see the description for the package.
+
+ Move the cursor with the arrow-keys and PgUp and PgDn, press enter
+ when the cursor highlights the right package.
+
+ When viewing the description use PgUp and PgDn and arrow-keys to move
+ through the text.
OpenPOWER on IntegriCloud