From owner-svn-src-user@FreeBSD.ORG Fri Dec 31 15:16:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 859AB106564A; Fri, 31 Dec 2010 15:16:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DCC8FC15; Fri, 31 Dec 2010 15:16:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBVFGJ3A078048; Fri, 31 Dec 2010 15:16:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBVFGJW6078040; Fri, 31 Dec 2010 15:16:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201012311516.oBVFGJW6078040@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 31 Dec 2010 15:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216842 - in user/nwhitehorn/bsdinstall: . distextract distfetch scripts X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 15:16:19 -0000 Author: nwhitehorn Date: Fri Dec 31 15:16:18 2010 New Revision: 216842 URL: http://svn.freebsd.org/changeset/base/216842 Log: Fix a spelling error pointed out by brucec, repair distfetch so it works again, and improve documentation. Modified: user/nwhitehorn/bsdinstall/NOTES user/nwhitehorn/bsdinstall/README user/nwhitehorn/bsdinstall/bsdinstall user/nwhitehorn/bsdinstall/distextract/distextract.c user/nwhitehorn/bsdinstall/distfetch/distfetch.c user/nwhitehorn/bsdinstall/scripts/auto Modified: user/nwhitehorn/bsdinstall/NOTES ============================================================================== --- user/nwhitehorn/bsdinstall/NOTES Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/NOTES Fri Dec 31 15:16:18 2010 (r216842) @@ -1,3 +1,15 @@ Targets for tarballs: installkernel installworld (distrib-dirs distribution) Tools used in scripts: dialog sh awk sort cp dd ifconfig sysctl xargs mkdir mount cat uname netstat newfs + +Environment variables affecting modules: +- DISTRIBUTIONS: List of tarballs to unpack, including .tgz extension +- BSDINSTALL_DISTDIR: Files system location at which to download distfiles and + from which to extract them +- BSDINSTALL_DISTSITE: Base URL for downloading distfiles. Will be downloaded + from $BSDINSTALL_DISTSITE/$DIST +- BSDINSTALL_LOG: Log file path for installation log +- PATH_FSTAB: fstab file to use. Need not exist yet. +- BSDINSTALL_CHROOT: Destination location for the installation. File systems + are mounted here and files installed to this path. + Modified: user/nwhitehorn/bsdinstall/README ============================================================================== --- user/nwhitehorn/bsdinstall/README Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/README Fri Dec 31 15:16:18 2010 (r216842) @@ -21,7 +21,7 @@ Missing features: Goals: - Reinvent as few wheels as possible -- Extensability +- Extensibility - Scriptability without a scripting language -- the installer itself should be a script a user can modify - Minimal grubbing around in outputs of shell commands with awk, sed, etc. Modified: user/nwhitehorn/bsdinstall/bsdinstall ============================================================================== --- user/nwhitehorn/bsdinstall/bsdinstall Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/bsdinstall Fri Dec 31 15:16:18 2010 (r216842) @@ -1,6 +1,6 @@ #!/bin/sh -DISTRIBUTIONS="kernel world distribution"; export DISTRIBUTIONS +DISTRIBUTIONS="kernel.tgz world.tgz distribution.tgz"; export DISTRIBUTIONS BSDINSTALL_LOG="/tmp/bsdinstall_log"; export BSDINSTALL_LOG PATH_FSTAB="/tmp/fstab"; export PATH_FSTAB BSDINSTALL_DISTDIR="/var/dist"; export BSDINSTALL_DISTDIR Modified: user/nwhitehorn/bsdinstall/distextract/distextract.c ============================================================================== --- user/nwhitehorn/bsdinstall/distextract/distextract.c Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/distextract/distextract.c Fri Dec 31 15:16:18 2010 (r216842) @@ -70,8 +70,7 @@ extract_files(int nfiles, const char **f archive = archive_read_new(); archive_read_support_format_all(archive); archive_read_support_compression_all(archive); - sprintf(path, "%s/%s.tgz", getenv("BSDINSTALL_DISTDIR"), - files[i]); + sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), files[i]); err = archive_read_open_filename(archive, path, 4096); if (err != ARCHIVE_OK) { snprintf(errormsg, sizeof(errormsg), @@ -101,8 +100,7 @@ extract_files(int nfiles, const char **f archive = archive_read_new(); archive_read_support_format_all(archive); archive_read_support_compression_all(archive); - sprintf(path, "%s/%s.tgz", getenv("BSDINSTALL_DISTDIR"), - files[i]); + sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), files[i]); err = archive_read_open_filename(archive, path, 4096); items[i*2 + 1] = "In Progress"; Modified: user/nwhitehorn/bsdinstall/distfetch/distfetch.c ============================================================================== --- user/nwhitehorn/bsdinstall/distfetch/distfetch.c Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/distfetch/distfetch.c Fri Dec 31 15:16:18 2010 (r216842) @@ -4,16 +4,37 @@ #include #include -static int fetch_files(int nfiles, const char **urls); +static int fetch_files(int nfiles, char **urls); int main(void) { - return (fetch_files(argc - 1, &argv[1])); + char *diststring = strdup(getenv("DISTRIBUTIONS")); + char **urls; + int i, retval, ndists = 0; + for (i = 0; diststring[i] != 0; i++) + if (isspace(diststring[i]) && !isspace(diststring[i+1])) + ndists++; + ndists++; /* Last one */ + + urls = calloc(ndists, sizeof(const char *)); + for (i = 0; i < ndists; i++) { + urls[i] = malloc(PATH_MAX); + sprintf(urls[i], "%s/%s", getenv("BSDINSTALL_DISTSITE"), + strsep(&diststring, " \t")); + } + + chdir(getenv("BSDINSTALL_DISTDIR")); + retval = fetch_files(ndists, urls); + + free(diststring); + for (i = 0; i < ndists; i++) + free(urls[i]); + free(urls); } static int -fetch_files(int nfiles, const char **urls) +fetch_files(int nfiles, char **urls) { const char **items; FILE *fetch_out, *file_out; Modified: user/nwhitehorn/bsdinstall/scripts/auto ============================================================================== --- user/nwhitehorn/bsdinstall/scripts/auto Fri Dec 31 14:03:57 2010 (r216841) +++ user/nwhitehorn/bsdinstall/scripts/auto Fri Dec 31 15:16:18 2010 (r216842) @@ -8,7 +8,7 @@ bsdinstall hostname FETCH_DISTRIBUTIONS="" for dist in $DISTRIBUTIONS; do - if [ ! -f $BSDINSTALL_DISTDIR/$dist.tgz ]; then + if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist" fi done