1993-08-26 01:19:55 +00:00
|
|
|
#ifndef lint
|
1994-11-17 10:35:04 +00:00
|
|
|
static const char *rcsid = "$Id: pl.c,v 1.4 1994/08/29 16:31:38 adam Exp $";
|
1993-08-26 01:19:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FreeBSD install - a package for the installation and maintainance
|
|
|
|
* of non-core utilities.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* Jordan K. Hubbard
|
|
|
|
* 18 July 1993
|
|
|
|
*
|
|
|
|
* Routines for dealing with the packing list.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lib.h"
|
|
|
|
#include "create.h"
|
|
|
|
|
|
|
|
/* Check a list for files that require preconversion */
|
|
|
|
void
|
|
|
|
check_list(char *home, Package *pkg)
|
|
|
|
{
|
|
|
|
char cmd[FILENAME_MAX];
|
|
|
|
char name[FILENAME_MAX];
|
|
|
|
char *where = home;
|
1994-08-29 16:31:38 +00:00
|
|
|
char *there = NULL;
|
1993-08-26 01:19:55 +00:00
|
|
|
PackingList p = pkg->head;
|
|
|
|
|
|
|
|
while (p) {
|
|
|
|
if (p->type == PLIST_CWD)
|
|
|
|
where = p->name;
|
|
|
|
else if (p->type == PLIST_IGNORE)
|
|
|
|
p = p->next;
|
1994-08-29 16:31:38 +00:00
|
|
|
else if (p->type == PLIST_SRC) {
|
|
|
|
there = p->name;
|
|
|
|
}
|
1993-08-26 01:19:55 +00:00
|
|
|
else if (p->type == PLIST_FILE) {
|
|
|
|
cmd[0] = '\0';
|
1994-08-29 16:31:38 +00:00
|
|
|
sprintf(name, "%s/%s", there ? there : where, p->name);
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
if (*cmd) {
|
|
|
|
if (Verbose)
|
|
|
|
printf("Uncompressing-> %s\n", cmd);
|
|
|
|
if (system(cmd))
|
|
|
|
barf("%s failed!", cmd);
|
|
|
|
nuke_suffix(p->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy unmarked files in packing list to playpen - marked files
|
|
|
|
* have already been copied in an earlier pass through the list.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
copy_plist(char *home, Package *plist)
|
|
|
|
{
|
|
|
|
PackingList p = plist->head;
|
|
|
|
char *where = home;
|
1994-08-29 16:31:38 +00:00
|
|
|
char *there = NULL;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
while (p) {
|
|
|
|
if (p->type == PLIST_CWD)
|
|
|
|
where = p->name;
|
1994-08-28 14:15:30 +00:00
|
|
|
else if (p->type == PLIST_SRC)
|
1994-08-29 16:31:38 +00:00
|
|
|
there = p->name;
|
1993-08-26 01:19:55 +00:00
|
|
|
else if (p->type == PLIST_IGNORE)
|
|
|
|
p = p->next;
|
|
|
|
else if (p->type == PLIST_FILE && !p->marked) {
|
|
|
|
char fn[FILENAME_MAX];
|
|
|
|
|
|
|
|
/* First, look for it in the "home" dir */
|
|
|
|
sprintf(fn, "%s/%s", home, p->name);
|
|
|
|
if (fexists(fn))
|
|
|
|
copy_hierarchy(home, p->name, FALSE);
|
|
|
|
/*
|
|
|
|
* Otherwise, try along the actual extraction path..
|
|
|
|
*/
|
|
|
|
else
|
1994-08-29 16:31:38 +00:00
|
|
|
copy_hierarchy(there ? there : where, p->name, FALSE);
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
}
|