From owner-freebsd-bugs@FreeBSD.ORG Wed Sep 29 04:40:02 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9792D1065674 for ; Wed, 29 Sep 2010 04:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 19BF98FC1A for ; Wed, 29 Sep 2010 04:40:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8T4e1YE042433 for ; Wed, 29 Sep 2010 04:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o8T4e1BW042432; Wed, 29 Sep 2010 04:40:01 GMT (envelope-from gnats) Resent-Date: Wed, 29 Sep 2010 04:40:01 GMT Resent-Message-Id: <201009290440.o8T4e1BW042432@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, John Hixson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0091F1065679 for ; Wed, 29 Sep 2010 04:37:13 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id D7E598FC13 for ; Wed, 29 Sep 2010 04:37:12 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o8T4bCam007726 for ; Wed, 29 Sep 2010 04:37:12 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o8T4bCib007725; Wed, 29 Sep 2010 04:37:12 GMT (envelope-from nobody) Message-Id: <201009290437.o8T4bCib007725@www.freebsd.org> Date: Wed, 29 Sep 2010 04:37:12 GMT From: John Hixson To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/151048: pc-sysinstall patch that modifies image writing to decompress to stdout X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 04:40:02 -0000 >Number: 151048 >Category: bin >Synopsis: pc-sysinstall patch that modifies image writing to decompress to stdout >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Wed Sep 29 04:40:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: John Hixson >Release: 9.0-CURRENT >Organization: iXsystems >Environment: FreeBSD thinkbsd 9.0-CURRENT FreeBSD 9.0-CURRENT #6: Sat Sep 25 05:21:08 PDT 2010 john@thinkbsd:/usr/obj/usr/src/sys/THINKBSD amd64 >Description: This patch modifies the current image writing ability to decompress to the stdout when writing images to avoid space issues. >How-To-Repeat: >Fix: Patch attached with submission follows: diff -urN usr.sbin/pc-sysinstall.orig/backend/functions.sh usr.sbin/pc-sysinstall/backend/functions.sh --- usr.sbin/pc-sysinstall.orig/backend/functions.sh 2010-09-28 20:24:03.000000000 -0700 +++ usr.sbin/pc-sysinstall/backend/functions.sh 2010-09-28 21:32:36.000000000 -0700 @@ -325,61 +325,6 @@ export VAL } -decompress_file() -{ - local FILE - local COMPRESSION - - FILE="$1" - COMPRESSION="$2" - - if [ -n "${COMPRESSION}" ] - then - case "${COMPRESSION}" in - lzw) - rc_halt "uncompress ${FILE}" - VAL="${FILE%.Z}" - ;; - - lzo) - rc_halt "lzop -d ${FILE}" - VAL="${FILE%.lzo}" - ;; - - lzma) - rc_halt "lzma -d ${FILE}" - VAL="${FILE%.lzma}" - ;; - - gzip) - rc_halt "gunzip ${FILE}" - VAL="${FILE%.gz}" - ;; - - bzip2) - rc_halt "bunzip2 ${FILE}" - VAL="${FILE%.bz2}" - ;; - - xz) - rc_halt "xz -d ${FILE}" - VAL="${FILE%.xz}" - ;; - - zip) - rc_halt "unzip ${FILE}" - VAL="${FILE%.zip}" - ;; - - *) - exit_err "ERROR: ${COMPRESSION} compression is not supported" - ;; - esac - fi - - export VAL -} - write_image() { local IMAGE_FILE @@ -418,11 +363,51 @@ get_compression_type "${IMAGE_FILE}" COMPRESSION="${VAL}" - decompress_file "${IMAGE_FILE}" "${COMPRESSION}" - IMAGE_FILE="${VAL}" - fi + case "${COMPRESSION}" in + lzw) + rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.Z}" + ;; + + lzo) + rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.lzo}" + ;; + + lzma) + rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.lzma}" + ;; + + gzip) + rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.gz}" + ;; - rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k" + bzip2) + rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.bz2}" + ;; + + xz) + rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.xz}" + ;; + + zip) + rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.zip}" + ;; + + *) + exit_err "ERROR: ${COMPRESSION} compression is not supported" + ;; + esac + + else + rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k" + + fi }; install_fresh() >Release-Note: >Audit-Trail: >Unformatted: