Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102039424
D29232.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D29232.diff
View Options
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -84,6 +84,12 @@
STAILQ_ENTRY(fingerprint) next;
};
+static const char *bootstrap_names [] = {
+ "pkg.bsd",
+ "pkg.txz",
+ NULL
+};
+
STAILQ_HEAD(fingerprint_list, fingerprint);
static int
@@ -836,6 +842,7 @@
const char *packagesite;
const char *signature_type;
char pkgstatic[MAXPATHLEN];
+ const char *bootstrap_name;
fd_sig = -1;
ret = -1;
@@ -858,22 +865,29 @@
if (strncmp(URL_SCHEME_PREFIX, packagesite,
strlen(URL_SCHEME_PREFIX)) == 0)
packagesite += strlen(URL_SCHEME_PREFIX);
- snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite);
-
- snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX",
- getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP);
-
- if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1)
+ for (int j = 0; bootstrap_names[j] != NULL; j++) {
+ bootstrap_name = bootstrap_names[j];
+
+ snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name);
+ snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX",
+ getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP,
+ bootstrap_name);
+ if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1)
+ break;
+ bootstrap_name = NULL;
+ }
+ if (bootstrap_name == NULL)
goto fetchfail;
if (signature_type != NULL &&
strcasecmp(signature_type, "NONE") != 0) {
if (strcasecmp(signature_type, "FINGERPRINTS") == 0) {
- snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX",
- getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP);
- snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig",
- packagesite);
+ snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX",
+ getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP,
+ bootstrap_name);
+ snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig",
+ packagesite, bootstrap_name);
if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) {
fprintf(stderr, "Signature for pkg not "
@@ -886,10 +900,11 @@
} else if (strcasecmp(signature_type, "PUBKEY") == 0) {
snprintf(tmpsig, MAXPATHLEN,
- "%s/pkg.txz.pubkeysig.XXXXXX",
- getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP);
- snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig",
- packagesite);
+ "%s/%s.pubkeysig.XXXXXX",
+ getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP,
+ bootstrap_name);
+ snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig",
+ packagesite, bootstrap_name);
if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) {
fprintf(stderr, "Signature for pkg not "
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 8:39 PM (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14520325
Default Alt Text
D29232.diff (2 KB)
Attached To
Mode
D29232: pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz
Attached
Detach File
Event Timeline
Log In to Comment