diff options
author | <gerald.jelinek@sun.com> | 2009-08-07 06:47:37 -0600 |
---|---|---|
committer | <gerald.jelinek@sun.com> | 2009-08-07 06:47:37 -0600 |
commit | 62ac53366ae15a996820cda28eda6998f2347413 (patch) | |
tree | 6aa3eb937eb65cb6571fbbef0b6965fe82019670 /usr/src | |
parent | d55e25c39b551e85cf934ffcd77b0a9a2e93a234 (diff) | |
download | illumos-joyent-62ac53366ae15a996820cda28eda6998f2347413.tar.gz |
6868481 p2v should handle absolute path archives
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/brand/native/zone/common.ksh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/src/lib/brand/native/zone/common.ksh b/usr/src/lib/brand/native/zone/common.ksh index 8d31cfdf8f..17dc979908 100644 --- a/usr/src/lib/brand/native/zone/common.ksh +++ b/usr/src/lib/brand/native/zone/common.ksh @@ -409,6 +409,15 @@ install_cpio() stage1=$1 archive=$2 + # Check the first few members of the archive for an absolute path. + for i in `$stage1 "$archive" | cpio -it | head | cut -b1` + do + if [[ "$i" == "/" ]]; then + umnt_fs + fatal "$e_absolute_archive" + fi + done + cpioopts="-idmfE $ipdcpiofile" vlog "cd \"$ZONEROOT\" && $stage1 \"$archive\" | cpio $cpioopts" @@ -428,6 +437,15 @@ install_pax() { archive=$1 + # Check the first few members of the archive for an absolute path. + for i in `pax -f "$archive" | head | cut -b1` + do + if [[ "$i" == "/" ]]; then + umnt_fs + fatal "$e_absolute_archive" + fi + done + if [[ -s $ipdpaxfile ]]; then filtopt="-c $(/usr/bin/cat $ipdpaxfile)" fi @@ -822,6 +840,7 @@ e_install_abort=$(gettext "Installation aborted.") e_not_readable=$(gettext "Cannot read directory '%s'") e_not_dir=$(gettext "Error: must be a directory") e_unknown_archive=$(gettext "Error: Unknown archive format. Must be a flash archive, a cpio archive (can also be gzipped or bzipped), a pax XUSTAR archive, or a level 0 ufsdump archive.") +e_absolute_archive=$(gettext "Error: archive contains absolute paths instead of relative paths.") e_tmpfile=$(gettext "Unable to create temporary file") e_root_full=$(gettext "Zonepath root %s exists and contains data; remove or move aside prior to install.") |