added -d flag, plus fixes
This commit is contained in:
parent
63c7599fd7
commit
0f6b9827c5
29 changed files with 208 additions and 115 deletions
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.7 2005/03/17 08:45:27 imilh Exp $
|
||||
# $NetBSD: Makefile,v 1.8 2005/03/18 10:49:50 imilh Exp $
|
||||
#
|
||||
|
||||
DISTNAME= pkg_select-20050317
|
||||
DISTNAME= pkg_select-20050318
|
||||
CATEGORIES= pkgtools
|
||||
MASTER_SITES= # empty
|
||||
DISTFILES= # empty
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: conf.c,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: conf.c,v 1.2 2005/03/18 10:49:52 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: curses_helpers.c,v 1.4 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: curses_helpers.c,v 1.5 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
@ -635,7 +635,8 @@ progress_bar(const char **keylist, char *key, int mode)
|
|||
}
|
||||
|
||||
void
|
||||
cmd_spawn(int waitkey, const char **progress_list, const char *command, ...)
|
||||
cmd_spawn(int waitkey, const char **progress_list, int progress_mode,
|
||||
const char *command, ...)
|
||||
{
|
||||
int next;
|
||||
FILE *fp;
|
||||
|
@ -660,7 +661,7 @@ cmd_spawn(int waitkey, const char **progress_list, const char *command, ...)
|
|||
else
|
||||
if (next)
|
||||
next = progress_bar(progress_list,
|
||||
buf, CYCLIC);
|
||||
buf, progress_mode);
|
||||
}
|
||||
pclose(fp);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: curses_helpers.h,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: curses_helpers.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include <curses.h>
|
||||
|
@ -53,7 +53,7 @@ extern void draw_box(WINDOW *, const char *);
|
|||
extern int combo_list(WINDOW *, Etree **, HL_datas *, const char *);
|
||||
extern char *combo_select(Etree **, const char *, int, int, int, int, int);
|
||||
extern int progress_bar(const char **, char *, int);
|
||||
extern void cmd_spawn(int, const char **, const char *, ...);
|
||||
extern void cmd_spawn(int, const char **, int, const char *, ...);
|
||||
#define ANY_KEY "\nPress any key to continue..."
|
||||
|
||||
#define CYCLIC 0
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: curses_input.c,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: curses_input.c,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include <curses.h>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: curses_input.h,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: curses_input.h,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CURSES_INPUT_H__
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datatypes.h,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: datatypes.h,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
typedef struct Etree {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: extern.h,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: extern.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _EXTERN_H_
|
||||
|
@ -62,6 +62,7 @@ extern char *getcomment(struct cf *);
|
|||
extern char *list_mirrors(const char *);
|
||||
extern int pkgsrc_chk(const char *);
|
||||
extern int cvs_up(const char *);
|
||||
extern int download_pkgsrc(const char *, const char *);
|
||||
|
||||
/* install_many */
|
||||
extern int tb_installed(const char *);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: file.c,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: file.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: file.h,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: file.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
struct cf {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* $NetBSD: ftpio.c,v 1.2 2005/03/17 08:45:29 imilh Exp $ */
|
||||
/* $NetBSD: ftpio.c,v 1.3 2005/03/18 10:50:04 imilh Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.2 2005/03/17 08:45:29 imilh Exp $");
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.3 2005/03/18 10:50:04 imilh Exp $");
|
||||
#endif
|
||||
|
||||
/* slightly modified version of ftpio.c with pkg_select integration */
|
||||
|
@ -321,20 +321,24 @@ expect(int fd, const char *str, int *ftprc)
|
|||
/* used for progress bars with tar(1) */
|
||||
if (use_tar && strncmp(buf, "pkgsrc/", 7) == 0 &&
|
||||
(p = strchr(buf, '/')) != NULL) {
|
||||
p++; /* point after pkgsrc/ */
|
||||
strcpy(progress_str, p);
|
||||
if ((p = strchr(progress_str, '/')) != NULL) {
|
||||
/* pkg_select addon */
|
||||
/* point after pkgsrc/ */
|
||||
strcpy(progress_str, p); /* /category/blah */
|
||||
|
||||
p++; /* category/blah */
|
||||
if ((p = strchr(p, '/')) != NULL) {
|
||||
|
||||
if (conf.shell_output)
|
||||
printf("%s\n", progress_str);
|
||||
|
||||
else if (next) {
|
||||
char msg[MAXLEN];
|
||||
p++;
|
||||
*p = '\0';
|
||||
|
||||
snprintf(msg, MAXLEN,
|
||||
"extracting %s",
|
||||
"extracting pkgsrc%s",
|
||||
progress_str);
|
||||
|
||||
next = progress_bar(pkgsrc_progress,
|
||||
msg,
|
||||
INCREMENTAL);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: install_many.c,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: install_many.c,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: listmgt.c,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: listmgt.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: live.c,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: live.c,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: live.h,v 1.1 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: live.h,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.5 2005/03/16 08:26:10 imilh Exp $
|
||||
* $Id: main.c,v 1.6 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char *rcsid = "$Id: main.c,v 1.5 2005/03/16 08:26:10 imilh Exp $";
|
||||
static char *rcsid = "$Id: main.c,v 1.6 2005/03/18 10:50:04 imilh Exp $";
|
||||
#else
|
||||
__RCSID("$Id: main.c,v 1.5 2005/03/16 08:26:10 imilh Exp $");
|
||||
__RCSID("$Id: main.c,v 1.6 2005/03/18 10:50:04 imilh Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ usage()
|
|||
{
|
||||
(void) fprintf(stderr, "%s\n%s\n",
|
||||
"usage: pkg_select [-h] [-b pkgsrcdir] [-K pkg_dbdir] [-c conf file]",
|
||||
" [-l [-m] [-u NetBSD ftp mirror]]");
|
||||
" [-l [-m] [-u NetBSD ftp mirror]] [-d url] [-s]");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
@ -467,15 +467,15 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
Etree **etree;
|
||||
char ch, basepath[MAXLEN], *confpath, *ftp_url;
|
||||
int where, use_live_ftp, read_makefiles;
|
||||
char ch, basepath[MAXLEN], *confpath, *ftp_url, *dl_path;
|
||||
int where, use_live_ftp, read_makefiles, console_output;
|
||||
|
||||
pkgsrcbase = pkg_dbdir = confpath = ftp_url = NULL;
|
||||
use_live_ftp = 0;
|
||||
pkgsrcbase = pkg_dbdir = confpath = ftp_url = dl_path = NULL;
|
||||
use_live_ftp = console_output = T_FALSE;
|
||||
read_makefiles = T_TRUE; /* live_ftp option */
|
||||
|
||||
/* command line handling */
|
||||
while ((ch = getopt(argc, argv, "c:b:K:u:lmh")) != -1)
|
||||
while ((ch = getopt(argc, argv, "c:b:K:u:d:lmsh")) != -1)
|
||||
switch(ch) {
|
||||
case 'b':
|
||||
pkgsrcbase = optarg;
|
||||
|
@ -494,6 +494,12 @@ main(int argc, char *argv[])
|
|||
case 'm':
|
||||
read_makefiles = T_FALSE;
|
||||
break;
|
||||
case 'd':
|
||||
dl_path = optarg;
|
||||
break;
|
||||
case 's':
|
||||
console_output = T_TRUE;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
|
@ -525,6 +531,9 @@ main(int argc, char *argv[])
|
|||
pkg_dbdir = PKGDB;
|
||||
}
|
||||
|
||||
if (console_output == T_TRUE)
|
||||
conf.shell_output = T_TRUE;
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
/* end of command line handlig */
|
||||
|
@ -575,10 +584,19 @@ main(int argc, char *argv[])
|
|||
/* set pkgsrc base to ftp base */
|
||||
pkgsrcbase = conf.live_ftp;
|
||||
} else {
|
||||
/* was pkgsrc download asked ? */
|
||||
if (dl_path != NULL) {
|
||||
if (download_pkgsrc(dl_path, basepath) < 0) {
|
||||
warnx("pkgsrc download failed");
|
||||
finish(0);
|
||||
}
|
||||
} else
|
||||
/* check for pkgsrc presence */
|
||||
if (pkgsrc_chk(basepath) < 0)
|
||||
if (pkgsrc_chk(basepath) < 0) {
|
||||
warnx("%s does not exists", basepath);
|
||||
/* pkgsrc fetch failed */
|
||||
finish(0);
|
||||
}
|
||||
|
||||
where = IN_PKGSRC;
|
||||
/* get directory listing */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* $Id: makefile.c,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: makefile.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: more.c,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: more.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: parsedirs.c,v 1.5 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: parsedirs.c,v 1.6 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pkg_adm.c,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: pkg_adm.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
@ -290,7 +290,7 @@ pkgsrc_make(const char *action, const char *path, int waitkey)
|
|||
if ((env = getenv("PKG_PATH")) != NULL)
|
||||
unsetenv("PKG_PATH");
|
||||
|
||||
(void) cmd_spawn(waitkey, make_progress,
|
||||
(void) cmd_spawn(waitkey, make_progress, CYCLIC,
|
||||
"cd %s && %s %s %s",
|
||||
path, MAKE, action, "clean");
|
||||
|
||||
|
@ -317,7 +317,7 @@ pkg_tool(const char *action, const char *pkg, const char *option, int waitkey)
|
|||
break;
|
||||
}
|
||||
|
||||
(void) cmd_spawn(waitkey, tool_progress,
|
||||
(void) cmd_spawn(waitkey, tool_progress, CYCLIC,
|
||||
"%s/pkg_%s %s %s 2>&1",
|
||||
PKGTOOLS_PATH, action, option, pkg);
|
||||
reload_pkgdb();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pkg_adm.h,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: pkg_adm.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
extern void free_pkgdb(void);
|
||||
|
@ -91,54 +91,54 @@ extern void set_pkg_path(const char *);
|
|||
NULL }
|
||||
|
||||
#define PKGSRC_PROGRESS { \
|
||||
"archivers/", \
|
||||
"audio/", \
|
||||
"benchmarks/", \
|
||||
"biology/", \
|
||||
"bootstrap/", \
|
||||
"cad/", \
|
||||
"chat/", \
|
||||
"comms/", \
|
||||
"converters/", \
|
||||
"cross/", \
|
||||
"databases/", \
|
||||
"devel/", \
|
||||
"distfiles/", \
|
||||
"doc/", \
|
||||
"editors/", \
|
||||
"emulators/", \
|
||||
"finance/", \
|
||||
"fonts/", \
|
||||
"games/", \
|
||||
"geography/", \
|
||||
"graphics/", \
|
||||
"ham/", \
|
||||
"inputmethod/", \
|
||||
"lang/", \
|
||||
"licenses/", \
|
||||
"mail/", \
|
||||
"math/", \
|
||||
"mbone/", \
|
||||
"meta-pkgs/", \
|
||||
"misc/", \
|
||||
"mk/", \
|
||||
"multimedia/", \
|
||||
"net/", \
|
||||
"news/", \
|
||||
"packages/", \
|
||||
"parallel/", \
|
||||
"pkgtools/", \
|
||||
"print/", \
|
||||
"regress/", \
|
||||
"security/", \
|
||||
"shells/", \
|
||||
"sysutils/", \
|
||||
"templates/", \
|
||||
"textproc/", \
|
||||
"time/", \
|
||||
"wm/", \
|
||||
"www/", \
|
||||
"x11/", \
|
||||
"/archivers/", \
|
||||
"/audio/", \
|
||||
"/benchmarks/", \
|
||||
"/biology/", \
|
||||
"/bootstrap/", \
|
||||
"/cad/", \
|
||||
"/chat/", \
|
||||
"/comms/", \
|
||||
"/converters/", \
|
||||
"/cross/", \
|
||||
"/databases/", \
|
||||
"/devel/", \
|
||||
"/distfiles/", \
|
||||
"/doc/", \
|
||||
"/editors/", \
|
||||
"/emulators/", \
|
||||
"/finance/", \
|
||||
"/fonts/", \
|
||||
"/games/", \
|
||||
"/geography/", \
|
||||
"/graphics/", \
|
||||
"/ham/", \
|
||||
"/inputmethod/", \
|
||||
"/lang/", \
|
||||
"/licenses/", \
|
||||
"/mail/", \
|
||||
"/math/", \
|
||||
"/mbone/", \
|
||||
"/meta-pkgs/", \
|
||||
"/misc/", \
|
||||
"/mk/", \
|
||||
"/multimedia/", \
|
||||
"/net/", \
|
||||
"/news/", \
|
||||
"/packages/", \
|
||||
"/parallel/", \
|
||||
"/pkgtools/", \
|
||||
"/print/", \
|
||||
"/regress/", \
|
||||
"/security/", \
|
||||
"/shells/", \
|
||||
"/sysutils/", \
|
||||
"/templates/", \
|
||||
"/textproc/", \
|
||||
"/time/", \
|
||||
"/wm/", \
|
||||
"/www/", \
|
||||
"/x11/", \
|
||||
NULL }
|
||||
|
||||
extern void pkgsrc_make(const char *, const char *, int);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pkg_info.c,v 1.6 2005/03/17 08:45:29 imilh Exp $
|
||||
* $Id: pkg_info.c,v 1.7 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $Id: pkg_select.1,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
.\" $Id: pkg_select.1,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2005
|
||||
.\" iMil <imil@gcu.info>. All rights reserved.
|
||||
|
@ -44,6 +44,8 @@
|
|||
.Op Fl l
|
||||
.Op Fl m
|
||||
.Op Fl u Ar NetBSD ftp mirror
|
||||
.Op Fl d Ar download url
|
||||
.Op Fl s
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
will display a curses file browser for the pkg system. You can browse
|
||||
|
@ -64,8 +66,8 @@ If no
|
|||
.Ar pkgsrc
|
||||
is installed,
|
||||
.Nm
|
||||
offers ability fo fetch it, either by FTP or CVS. It is also possible to update
|
||||
an existing pkgsrc via the interface.
|
||||
offers ability fo fetch it by FTP, CVS or directory copy. It is also possible to
|
||||
update an existing pkgsrc via the interface.
|
||||
.Pp
|
||||
.Nm
|
||||
user interface is quite self explainatory, every available shortcut is
|
||||
|
@ -100,6 +102,23 @@ over FTP
|
|||
Defines a
|
||||
.Ar NetBSD ftp mirror
|
||||
for live pkgsrc-over-FTP
|
||||
.It Fl d Ar url
|
||||
Set
|
||||
.Ar url
|
||||
as the pkgsrc tree download url.
|
||||
.Ar url
|
||||
can be one of
|
||||
.Pp
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa ftp://ftp.mirror.NetBSD.org/pub/NetBSD
|
||||
.It
|
||||
.Pa cvs://[:pserver:]anoncvs@anoncvs.mirror.NetBSD.org:/cvsroot
|
||||
.It
|
||||
.Pa file:///some/path
|
||||
.El
|
||||
.It Fl s
|
||||
Force shell output instead of curses progress bars
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width indent -compact
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pkg_select.h,v 1.3 2005/03/15 17:14:25 imilh Exp $
|
||||
* $Id: pkg_select.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _PKG_SELECT_H_
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pkgsrc.c,v 1.1 2005/03/15 17:14:26 imilh Exp $
|
||||
* $Id: pkgsrc.c,v 1.2 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
@ -44,6 +44,7 @@ static char **build_mirror_list(const char *);
|
|||
static int ftp_fetch(const char *, const char *);
|
||||
static int cvs_fetch(const char *, const char *, int);
|
||||
static char *get_cvs_branch(const char *, int);
|
||||
static int dir_fetch(const char *, const char *);
|
||||
|
||||
static char **
|
||||
build_mirror_list(const char *method)
|
||||
|
@ -98,9 +99,9 @@ pkgsrc_chk(const char *path)
|
|||
{
|
||||
int rc, len;
|
||||
struct stat sb;
|
||||
char resp, *mirror, *p, bpath[MAXLEN], message[MAXLEN];
|
||||
char resp, *p, *mirror, bpath[MAXLEN], message[MAXLEN];
|
||||
|
||||
/* check if we are browsing a directory */
|
||||
/* check if we are browsing a directory and it is called pkgsrc */
|
||||
if (stat(path, &sb) > -1 &&
|
||||
(sb.st_mode & S_IFMT) == S_IFDIR &&
|
||||
strstr(path, "pkgsrc") != NULL)
|
||||
|
@ -118,12 +119,10 @@ pkgsrc_chk(const char *path)
|
|||
len = strlen(bpath);
|
||||
if (bpath[len - 1] == '/')
|
||||
bpath[len - 1] = '\0';
|
||||
/* in case user set a bad path, rewind to last / */
|
||||
if ((p = strrchr(bpath, '/')) == NULL)
|
||||
/* no / ?? set p to curdir */
|
||||
strcpy(bpath, "./");
|
||||
else
|
||||
*(++p) = '\0';
|
||||
|
||||
/* strip "pkgsrc" from dest path */
|
||||
if ((p = strstr(bpath, "/pkgsrc")) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
do {
|
||||
resp = mid_getch_popup("Download method", DL_METHOD);
|
||||
|
@ -137,6 +136,10 @@ pkgsrc_chk(const char *path)
|
|||
if ((mirror = list_mirrors("cvs")) != NULL)
|
||||
rc = cvs_fetch(mirror, bpath, CHECKOUT);
|
||||
break;
|
||||
case 'd':
|
||||
if ((mirror = mid_getstr_popup("enter directory")) != NULL)
|
||||
rc = dir_fetch(mirror, bpath);
|
||||
break;
|
||||
}
|
||||
|
||||
if (mirror == NULL || rc < 0) {
|
||||
|
@ -264,7 +267,7 @@ cvs_fetch(const char *anoncvs, const char *dir, int mode)
|
|||
/* if it's a pserver, be sure to login */
|
||||
snprintf(cmd, MAXLEN, "%s -d %s login && ", CVS_CMD, anoncvs);
|
||||
|
||||
popup = mid_info_popup("cvs", "connecting to cvs server...");
|
||||
popup = mid_info_popup("cvs", CVS_CONNECT);
|
||||
wrefresh(popup);
|
||||
|
||||
/* select branch */
|
||||
|
@ -283,7 +286,7 @@ cvs_fetch(const char *anoncvs, const char *dir, int mode)
|
|||
snprintf(rel, MAXLEN, "-r%s ", branch);
|
||||
}
|
||||
|
||||
popup = mid_info_popup("cvs", "comparing trees, please wait...");
|
||||
popup = mid_info_popup("cvs", CVS_COMPARE);
|
||||
wrefresh(popup);
|
||||
|
||||
if (mode == CHECKOUT)
|
||||
|
@ -293,7 +296,7 @@ cvs_fetch(const char *anoncvs, const char *dir, int mode)
|
|||
snprintf(cmd, MAXLEN, "%s -d %s update -PAd %s 2>&1",
|
||||
CVS_CMD, anoncvs, rel);
|
||||
|
||||
cmd_spawn(DONT_WAIT, pkgsrc_progress, cmd);
|
||||
cmd_spawn(DONT_WAIT, pkgsrc_progress, CYCLIC, cmd);
|
||||
clr_del_win(popup);
|
||||
XFREE(branch);
|
||||
|
||||
|
@ -318,3 +321,47 @@ cvs_up(const char *dir)
|
|||
trimcr(buf);
|
||||
return(cvs_fetch(buf, dir, UPDATE));
|
||||
}
|
||||
|
||||
/* fetch by simple cp */
|
||||
static int
|
||||
dir_fetch(const char *dir, const char *dest)
|
||||
{
|
||||
char cmd[MAXLEN];
|
||||
|
||||
snprintf(cmd, MAXLEN, "cp -pRv %s %s", dir, dest);
|
||||
/* incremental progress bar, cp does not follow alphabetic order */
|
||||
cmd_spawn(DONT_WAIT, pkgsrc_progress, INCREMENTAL, cmd);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
download_pkgsrc(const char *dl_path, const char *path)
|
||||
{
|
||||
char *p, *ppath, buf[MAXLEN];
|
||||
|
||||
if ((p = strstr(dl_path, "://")) == NULL) {
|
||||
warnx(WARN_DOWN_URL);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
p += 3;
|
||||
|
||||
XSTRCPY(buf, path);
|
||||
if ((ppath = strstr(buf, "/pkgsrc")) == NULL) {
|
||||
warnx("%s must contain /pkgsrc !", pkgsrcbase);
|
||||
return(-1);
|
||||
}
|
||||
*ppath = '\0';
|
||||
|
||||
if (strncmp(dl_path, "ftp://", 6) == 0)
|
||||
ftp_fetch(dl_path, buf);
|
||||
|
||||
if (strncmp(dl_path, "cvs://", 6) == 0)
|
||||
cvs_fetch(p, buf, CHECKOUT);
|
||||
|
||||
if (strncmp(dl_path, "file://", 7) == 0)
|
||||
dir_fetch(p, buf);
|
||||
|
||||
return(chdir(path));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prefs.c,v 1.2 2005/03/16 08:26:10 imilh Exp $
|
||||
* $Id: prefs.c,v 1.3 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "pkg_select.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* $Id: texts.h,v 1.3 2005/03/15 17:14:26 imilh Exp $
|
||||
* $Id: texts.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _TEXTS_H_
|
||||
|
@ -43,13 +43,16 @@
|
|||
#define INST_PKGS "installed packages"
|
||||
#define SEARCH_INFOS "searching infos..."
|
||||
#define PKGSRC_NOTFOUND "pkgsrc was not found in %s, download it ? [Y/n]"
|
||||
#define DL_METHOD "Download method: (f)tp / (c)vs ?"
|
||||
#define DL_METHOD "Download method: (f)tp / (c)vs / (d)irectory cp ?"
|
||||
#define FETCH_FAILED "pkgsrc fetch failed, retry ? [Y/n]"
|
||||
#define UPDT_FAILED "pkgsrc update failed, retry ? [Y/n]"
|
||||
#define NEXT ">> Next"
|
||||
#define PKG_TB_INST "packages to be installed"
|
||||
#define PKG_TB_DEINST "packages to be deinstalled"
|
||||
#define REALLY_MASS_DELETE "really delete these packages ? [Y/n/r(ecursive)]"
|
||||
#define CVS_CONNECT "connecting to cvs server..."
|
||||
#define CVS_COMPARE "comparing trees, please wait..."
|
||||
#define WARN_DOWN_URL "download url must be one of ftp://, cvs:// or file://"
|
||||
|
||||
/* shortcuts */
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tools.c,v 1.3 2005/03/15 17:14:26 imilh Exp $
|
||||
* $Id: tools.c,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#include "tools.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tools.h,v 1.3 2005/03/15 17:14:26 imilh Exp $
|
||||
* $Id: tools.h,v 1.4 2005/03/18 10:50:04 imilh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _TOOLS_H
|
||||
|
|
Loading…
Reference in a new issue