Deleted Added
full compact
perform.c (93520) perform.c (95161)
1/*
2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 5 unchanged lines hidden (view full) ---

14 * Jordan K. Hubbard
15 * 18 July 1993
16 *
17 * This is the main body of the create module.
18 *
19 */
20
21#include <sys/cdefs.h>
1/*
2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 5 unchanged lines hidden (view full) ---

14 * Jordan K. Hubbard
15 * 18 July 1993
16 *
17 * This is the main body of the create module.
18 *
19 */
20
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/perform.c 93520 2002-04-01 09:39:07Z obrien $");
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/perform.c 95161 2002-04-20 21:20:58Z obrien $");
23
24#include "lib.h"
25#include "create.h"
26
27#include <err.h>
28#include <libgen.h>
29#include <signal.h>
30#include <stdlib.h>

--- 11 unchanged lines hidden (view full) ---

42pkg_perform(char **pkgs)
43{
44 char *pkg = *pkgs; /* Only one arg to create */
45 char *cp;
46 FILE *pkg_in, *fp;
47 Package plist;
48 int len;
49 const char *suf;
23
24#include "lib.h"
25#include "create.h"
26
27#include <err.h>
28#include <libgen.h>
29#include <signal.h>
30#include <stdlib.h>

--- 11 unchanged lines hidden (view full) ---

42pkg_perform(char **pkgs)
43{
44 char *pkg = *pkgs; /* Only one arg to create */
45 char *cp;
46 FILE *pkg_in, *fp;
47 Package plist;
48 int len;
49 const char *suf;
50 int compress = TRUE; /* default is to compress packages */
50 enum zipper Zipper = GZIP; /* default is to compress packages */
51
52 /* Preliminary setup */
53 if (InstalledPkg == NULL)
54 sanity_check();
55 if (Verbose && !PlistOnly)
56 printf("Creating package %s\n", pkg);
57
58 /* chop suffix off if already specified, remembering if we want to compress */
59 len = strlen(pkg);
60 if (len > 4) {
61 if (!strcmp(&pkg[len - 4], ".tgz")) {
51
52 /* Preliminary setup */
53 if (InstalledPkg == NULL)
54 sanity_check();
55 if (Verbose && !PlistOnly)
56 printf("Creating package %s\n", pkg);
57
58 /* chop suffix off if already specified, remembering if we want to compress */
59 len = strlen(pkg);
60 if (len > 4) {
61 if (!strcmp(&pkg[len - 4], ".tgz")) {
62 compress = TRUE;
63 UseBzip2 = FALSE;
62 Zipper = GZIP;
64 pkg[len - 4] = '\0';
65 }
66 else if (!strcmp(&pkg[len - 4], ".tar")) {
63 pkg[len - 4] = '\0';
64 }
65 else if (!strcmp(&pkg[len - 4], ".tar")) {
67 compress = FALSE;
68 UseBzip2 = FALSE;
66 Zipper = NONE;
69 pkg[len - 4] = '\0';
70 }
67 pkg[len - 4] = '\0';
68 }
69 else if (!strcmp(&pkg[len - 4], ".tbz")) {
70 Zipper = BZIP2;
71 pkg[len - 4] = '\0';
72 }
71 else if ((len > 5) && (!strcmp(&pkg[len - 5], ".tbz2"))) {
73 else if ((len > 5) && (!strcmp(&pkg[len - 5], ".tbz2"))) {
72 compress = FALSE;
73 UseBzip2 = TRUE;
74 Zipper = BZIP2;
74 pkg[len - 5] = '\0';
75 }
76 }
75 pkg[len - 5] = '\0';
76 }
77 }
77 if (UseBzip2)
78 if (Zipper == BZIP2) {
78 suf = "tbz2";
79 suf = "tbz2";
79 else if (compress) {
80 setenv("BZIP2", "-9", 0);
81 } else if (Zipper == GZIP) {
80 suf = "tgz";
81 setenv("GZIP", "-9", 0);
82 } else
83 suf = "tar";
84
85 if (InstalledPkg != NULL)
86 return (create_from_installed(pkg, suf));
87

--- 198 unchanged lines hidden (view full) ---

286 snprintf(tball, FILENAME_MAX, "%s.%s", pkg, suff);
287 else
288 snprintf(tball, FILENAME_MAX, "%s/%s.%s", homedir, pkg, suff);
289
290 args[nargs++] = "-c";
291 args[nargs++] = "-f";
292 args[nargs++] = tball;
293 if (strchr(suff, 'z')) { /* Compress/gzip/bzip2? */
82 suf = "tgz";
83 setenv("GZIP", "-9", 0);
84 } else
85 suf = "tar";
86
87 if (InstalledPkg != NULL)
88 return (create_from_installed(pkg, suf));
89

--- 198 unchanged lines hidden (view full) ---

288 snprintf(tball, FILENAME_MAX, "%s.%s", pkg, suff);
289 else
290 snprintf(tball, FILENAME_MAX, "%s/%s.%s", homedir, pkg, suff);
291
292 args[nargs++] = "-c";
293 args[nargs++] = "-f";
294 args[nargs++] = tball;
295 if (strchr(suff, 'z')) { /* Compress/gzip/bzip2? */
294 if (UseBzip2) {
295 args[nargs++] = "-y";
296 if (Zipper == BZIP2) {
297 args[nargs++] = "-j";
296 cname = "bzip'd ";
297 }
298 else {
299 args[nargs++] = "-z";
300 cname = "gzip'd ";
301 }
302 } else {
303 cname = "";

--- 141 unchanged lines hidden ---
298 cname = "bzip'd ";
299 }
300 else {
301 args[nargs++] = "-z";
302 cname = "gzip'd ";
303 }
304 } else {
305 cname = "";

--- 141 unchanged lines hidden ---