Add the ability to use Bzip'ed packages.
Also add the ability to use Bzip'ed distributions -- but this is exclusive of being able to use Gzip'ed distributions. Sponsored by: FreeBSD Mall, Inc.
This commit is contained in:
parent
289f207c81
commit
ee1c407b54
@ -15,7 +15,7 @@ SRCS+= pccard.c
|
||||
.endif
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I.
|
||||
CFLAGS+= -DX_AS_PKG
|
||||
CFLAGS+= -DX_AS_PKG -DUSE_GZIP=1
|
||||
.if ${MACHINE} == "pc98"
|
||||
CFLAGS+= -DPC98
|
||||
.endif
|
||||
|
@ -803,5 +803,11 @@ extern void slice_wizard(Disk *d);
|
||||
#define DEVICE_GET(d, b, f) ((d) != NULL ? (d)->get((d), (b), (f)) : NULL)
|
||||
#define DEVICE_SHUTDOWN(d) ((d) != NULL ? (d)->shutdown((d)) : (void)0)
|
||||
|
||||
#ifdef USE_GZIP
|
||||
#define UNZIPPER "gunzip"
|
||||
#else
|
||||
#define UNZIPPER "bunzip2"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* _SYSINSTALL_H_INCLUDE */
|
||||
|
@ -15,7 +15,7 @@ SRCS+= pccard.c
|
||||
.endif
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I.
|
||||
CFLAGS+= -DX_AS_PKG
|
||||
CFLAGS+= -DX_AS_PKG -DUSE_GZIP=1
|
||||
.if ${MACHINE} == "pc98"
|
||||
CFLAGS+= -DPC98
|
||||
.endif
|
||||
|
@ -641,10 +641,11 @@ distExtract(char *parent, Distribution *me)
|
||||
}
|
||||
else {
|
||||
/* Try to get the distribution as a single file */
|
||||
snprintf(buf, sizeof buf, "%s/%s.tgz", path, dist);
|
||||
snprintf(buf, sizeof buf, "%s/%s.%s", path, dist,
|
||||
USE_GZIP ? "tgz" : "tbz");
|
||||
/*
|
||||
* Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors
|
||||
* are not considered too significant.
|
||||
* Passing TRUE as 3rd parm to get routine makes this a "probing"
|
||||
* get, for which errors are not considered too significant.
|
||||
*/
|
||||
getsingle:
|
||||
fp = DEVICE_GET(mediaDevice, buf, TRUE);
|
||||
|
@ -604,7 +604,8 @@ mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpid)
|
||||
pipe(qfd);
|
||||
*zpid = fork();
|
||||
if (!*zpid) {
|
||||
char *gunzip = RunningAsInit ? "/stand/gunzip" : "/usr/bin/gunzip";
|
||||
char *unzipper = RunningAsInit ? "/stand/" UNZIPPER
|
||||
: "/usr/bin/" UNZIPPER;
|
||||
|
||||
dup2(qfd[0], 0); close(qfd[0]);
|
||||
dup2(pfd[1], 1); close(pfd[1]);
|
||||
@ -616,9 +617,9 @@ mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpid)
|
||||
}
|
||||
close(qfd[1]);
|
||||
close(pfd[0]);
|
||||
i = execl(gunzip, gunzip, (char *)0);
|
||||
i = execl(unzipper, unzipper, (char *)0);
|
||||
if (isDebug())
|
||||
msgDebug("%s command returns %d status\n", gunzip, i);
|
||||
msgDebug("%s command returns %d status\n", unzipper, i);
|
||||
exit(i);
|
||||
}
|
||||
*fd = qfd[1];
|
||||
@ -660,7 +661,8 @@ mediaExtractDistEnd(int zpid, int cpid)
|
||||
/* Don't check exit status - gunzip seems to return a bogus one! */
|
||||
if (i < 0) {
|
||||
if (isDebug())
|
||||
msgDebug("wait for gunzip returned status of %d!\n", i);
|
||||
msgDebug("wait for %s returned status of %d!\n",
|
||||
USE_GZIP ? "gunzip" : "bunzip2", i);
|
||||
return FALSE;
|
||||
}
|
||||
i = waitpid(cpid, &j, 0);
|
||||
@ -689,7 +691,8 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
||||
pipe(qfd); /* write end */
|
||||
zpid = fork();
|
||||
if (!zpid) {
|
||||
char *gunzip = RunningAsInit ? "/stand/gunzip" : "/usr/bin/gunzip";
|
||||
char *unzipper = RunningAsInit ? "/stand/" UNZIPPER
|
||||
: "/usr/bin/" UNZIPPER;
|
||||
|
||||
fclose(fp);
|
||||
close(qfd[1]);
|
||||
@ -704,9 +707,9 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
||||
close(2);
|
||||
open("/dev/null", O_WRONLY);
|
||||
}
|
||||
i = execl(gunzip, gunzip, (char *)0);
|
||||
i = execl(unzipper, unzipper, (char *)0);
|
||||
if (isDebug())
|
||||
msgDebug("%s command returns %d status\n", gunzip, i);
|
||||
msgDebug("%s command returns %d status\n", unzipper, i);
|
||||
exit(i);
|
||||
}
|
||||
cpid = fork();
|
||||
@ -775,7 +778,8 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
||||
/* Don't check exit status - gunzip seems to return a bogus one! */
|
||||
if (i < 0) {
|
||||
if (isDebug())
|
||||
msgDebug("wait for gunzip returned status of %d!\n", i);
|
||||
msgDebug("wait for %s returned status of %d!\n",
|
||||
USE_GZIP ? "gunzip" : "bunzip2", i);
|
||||
return FALSE;
|
||||
}
|
||||
i = waitpid(cpid, &j, 0);
|
||||
|
@ -114,10 +114,13 @@ package_exists(char *name)
|
||||
int
|
||||
package_extract(Device *dev, char *name, Boolean depended)
|
||||
{
|
||||
char path[511];
|
||||
int ret, last_msg = 0;
|
||||
char path[MAXPATHLEN];
|
||||
const char *PkgExts[] = { "", ".tbz", ".tbz2", ".tgz" };
|
||||
int ext, last_msg, pathend, ret;
|
||||
FILE *fp;
|
||||
|
||||
last_msg = 0;
|
||||
|
||||
/* Check to make sure it's not already there */
|
||||
if (package_exists(name))
|
||||
return DITEM_SUCCESS;
|
||||
@ -145,15 +148,20 @@ package_extract(Device *dev, char *name, Boolean depended)
|
||||
|
||||
if (!index(name, '/')) {
|
||||
if (!strpbrk(name, "-_"))
|
||||
sprintf(path, "packages/Latest/%s.tgz", name);
|
||||
pathend = snprintf(path, sizeof path, "packages/Latest/%s", name);
|
||||
else
|
||||
sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
|
||||
pathend = snprintf(path, sizeof path, "packages/All/%s", name);
|
||||
}
|
||||
else
|
||||
sprintf(path, "%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
|
||||
pathend = snprintf(path, sizeof path, "%s", name);
|
||||
|
||||
/* We have a path, call the device strategy routine to get the file */
|
||||
fp = DEVICE_GET(dev, path, TRUE);
|
||||
for (ext = 0 ; ext < sizeof PkgExts / sizeof PkgExts[0]; ++ext) {
|
||||
strlcpy(path + pathend, PkgExts[ext], sizeof path - pathend);
|
||||
if ((fp = DEVICE_GET(dev, path, TRUE)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
int i = 0, tot, pfd[2];
|
||||
pid_t pid;
|
||||
|
@ -803,5 +803,11 @@ extern void slice_wizard(Disk *d);
|
||||
#define DEVICE_GET(d, b, f) ((d) != NULL ? (d)->get((d), (b), (f)) : NULL)
|
||||
#define DEVICE_SHUTDOWN(d) ((d) != NULL ? (d)->shutdown((d)) : (void)0)
|
||||
|
||||
#ifdef USE_GZIP
|
||||
#define UNZIPPER "gunzip"
|
||||
#else
|
||||
#define UNZIPPER "bunzip2"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* _SYSINSTALL_H_INCLUDE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user