summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2010-10-21 17:20:37 +0000
committerimp <imp@FreeBSD.org>2010-10-21 17:20:37 +0000
commit53eaae898f8803ee6665077096a9de210db961d3 (patch)
treea493460cc6b19b10e267b784c0ed0c48984ad35d /usr.sbin
parent32ef4e45e32095244c8d6b516b28c918fcfa50ea (diff)
downloadFreeBSD-src-53eaae898f8803ee6665077096a9de210db961d3.zip
FreeBSD-src-53eaae898f8803ee6665077096a9de210db961d3.tar.gz
This is an updated patch to the last patch to do this which fixes a
local variable issue. This patch decompresses compressed images to the stdout when writing to a device to avoid running out of space issues. Submitted by: John Hixson Pr: 151049
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions.sh104
1 files changed, 44 insertions, 60 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions.sh b/usr.sbin/pc-sysinstall/backend/functions.sh
index cb3b698..46b5a02 100755
--- a/usr.sbin/pc-sysinstall/backend/functions.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions.sh
@@ -325,64 +325,8 @@ get_compression_type()
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
local DEVICE_FILE
IMAGE_FILE="$1"
@@ -418,11 +362,51 @@ write_image()
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}"
+ ;;
- rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k"
+ 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}"
+ ;;
+
+ 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()
OpenPOWER on IntegriCloud