svn commit: r217762 - in user/nwhitehorn/bsdinstall: distextract
release
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Jan 23 22:27:52 UTC 2011
Author: nwhitehorn
Date: Sun Jan 23 22:27:51 2011
New Revision: 217762
URL: http://svn.freebsd.org/changeset/base/217762
Log:
distextract was not setting permissions appropriately, for reasons I do
not understand. Fix that, and simplify the code a little. libarchive does
not like overlaid directories with some kinds of set flags, so roll the
distribution files into the 'world' archive for now. This is slightly
bogus, but unavoidable.
Reported by: rwatson
Modified:
user/nwhitehorn/bsdinstall/distextract/distextract.c
user/nwhitehorn/bsdinstall/release/testsystem.sh
Modified: user/nwhitehorn/bsdinstall/distextract/distextract.c
==============================================================================
--- user/nwhitehorn/bsdinstall/distextract/distextract.c Sun Jan 23 22:26:03 2011 (r217761)
+++ user/nwhitehorn/bsdinstall/distextract/distextract.c Sun Jan 23 22:27:51 2011 (r217762)
@@ -37,13 +37,10 @@ extract_files(int nfiles, const char **f
char path[PATH_MAX];
int archive_files[nfiles];
int total_files, current_files, archive_file;
- struct archive *archive, *disk;
+ struct archive *archive;
struct archive_entry *entry;
char errormsg[512];
char status[8];
- const void *block;
- size_t bsize;
- off_t offset;
int i, err, progress, last_progress;
err = 0;
@@ -90,12 +87,6 @@ extract_files(int nfiles, const char **f
}
current_files = 0;
- disk = archive_write_disk_new();
- archive_write_disk_set_options(disk, ARCHIVE_EXTRACT_TIME |
- ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL |
- ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_OWNER |
- ARCHIVE_EXTRACT_XATTR);
- archive_write_disk_set_standard_lookup(disk);
for (i = 0; i < nfiles; i++) {
archive = archive_read_new();
@@ -122,24 +113,13 @@ extract_files(int nfiles, const char **f
progress, nfiles,
__DECONST(char **, items));
- err = archive_write_header(disk, entry);
- if (err != ARCHIVE_OK)
- break;
-
- while (1) {
- err = archive_read_data_block(archive,
- &block, &bsize, &offset);
- if (err != ARCHIVE_OK)
- break;
- err = archive_write_data_block(disk,
- block, bsize, offset);
- if (err != ARCHIVE_OK)
- break;
- }
+ err = archive_read_extract(archive, entry,
+ ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_OWNER |
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL |
+ ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_FFLAGS);
- if (err != ARCHIVE_EOF)
+ if (err != ARCHIVE_OK)
break;
- archive_write_finish_entry(disk);
archive_file++;
current_files++;
@@ -148,15 +128,9 @@ extract_files(int nfiles, const char **f
items[i*2 + 1] = "Done";
if (err != ARCHIVE_EOF) {
- const char *errstring;
- if (archive_errno(archive) != 0)
- errstring = archive_error_string(archive);
- else
- errstring = archive_error_string(disk);
-
snprintf(errormsg, sizeof(errormsg),
"Error while extracting %s: %s\n", items[i*2],
- errstring);
+ archive_error_string(archive));
items[i*2 + 1] = "Failed";
dialog_msgbox("Extract Error", errormsg, 0, 0,
TRUE);
Modified: user/nwhitehorn/bsdinstall/release/testsystem.sh
==============================================================================
--- user/nwhitehorn/bsdinstall/release/testsystem.sh Sun Jan 23 22:26:03 2011 (r217761)
+++ user/nwhitehorn/bsdinstall/release/testsystem.sh Sun Jan 23 22:27:51 2011 (r217762)
@@ -15,33 +15,26 @@ tar cvzf $2/kernel.tgz .
chflags -R noschg .
rm -rf $1
-# Distribution
-cd /usr/src
-mkdir $1
-make distrib-dirs distribution DESTDIR=$1
-cd $1
-tar cvzf $2/distribution.tgz .
-chflags -R noschg .
-rm -rf $1
-
# World
cd /usr/src
mkdir $1
-make installworld DESTDIR=$1
+make installworld distribution DESTDIR=$1
cd $1
tar cvzf $2/world.tgz .
# Keep world around
# Make system
cd /usr/src
-make installkernel distribution DESTDIR=$1
+make installkernel DESTDIR=$1
mkdir $1/usr/bsdinstall-dist
-cp $2/kernel.tgz $2/world.tgz $2/distribution.tgz $1/usr/bsdinstall-dist
+cp $2/kernel.tgz $2/world.tgz $1/usr/bsdinstall-dist
# Things for the CD environment
ln -s /tmp/bsdinstall_etc/resolv.conf $1/etc/resolv.conf
echo kernel_options=\"-C\" > $1/boot/loader.conf
echo sendmail_enable=\"NONE\" > $1/etc/rc.conf
+echo hostid_enable=\"NO\" >> $1/etc/rc.conf
+touch $1/etc/fstab
cd $BSDINSTALL
cp release/rc.local $1/etc
More information about the svn-src-user
mailing list