Alan Pevec
2008-Sep-23 12:35 UTC
[Ovirt-devel] [PATCH node] do not preserve SELinux context when copying
iso9660_t cannot be applied on the normal filesystems Signed-off-by: Alan Pevec <apevec at redhat.com> --- scripts/ovirt-early | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 3d2d0ca..6dff7ab 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -263,9 +263,9 @@ local_install() { rm -rf $ovirt/LiveOS mkdir -p $ovirt/boot/grub mkdir -p $ovirt/LiveOS - cp -a $live/LiveOS/squashfs.img $ovirt/LiveOS \ - && cp -a $live/$syslinux/initrd0.img $ovirt/boot \ - && cp -a $live/$syslinux/vmlinuz0 $ovirt/boot + cp -p $live/LiveOS/squashfs.img $ovirt/LiveOS \ + && cp -p $live/$syslinux/initrd0.img $ovirt/boot \ + && cp -p $live/$syslinux/vmlinuz0 $ovirt/boot if [ $? -ne 0 ]; then echo "image copy failed"; return 1 fi -- 1.5.5.1
Alan Pevec
2008-Sep-23 12:35 UTC
[Ovirt-devel] [PATCH node] add cleanup after local install failures
Signed-off-by: Alan Pevec <apevec at redhat.com> --- scripts/ovirt-early | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 6dff7ab..d2caf9b 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -232,11 +232,16 @@ local_install() { live=$(mktemp -d) mount -r $live_dev $live if [ $? -ne 0 ]; then - echo "source image mount failed"; return 1 + echo "source image mount failed" + rmdir $live + return 1 fi mount $part $ovirt if [ $? -ne 0 ]; then - echo "target mount failed"; return 1 + echo "target mount failed" + umount $live && rmdir $live + rmdir $ovirt + return 1 fi mkdir -p $ovirt/config # update local config using the one embedded in livecd image @@ -267,7 +272,10 @@ local_install() { && cp -p $live/$syslinux/initrd0.img $ovirt/boot \ && cp -p $live/$syslinux/vmlinuz0 $ovirt/boot if [ $? -ne 0 ]; then - echo "image copy failed"; return 1 + echo "image copy failed" + umount $ovirt && rmdir $ovirt + umount $live && rmdir $live + return 1 fi part_num=$(( ${part#$disk} - 1 )) cat > $ovirt/boot/grub/grub.conf << EOF -- 1.5.5.1
Jim Meyering
2008-Sep-23 14:09 UTC
[Ovirt-devel] [PATCH node] do not preserve SELinux context when copying
Alan Pevec <apevec at redhat.com> wrote:> iso9660_t cannot be applied on the normal filesystems...> diff --git a/scripts/ovirt-early b/scripts/ovirt-early > index 3d2d0ca..6dff7ab 100755 > --- a/scripts/ovirt-early > +++ b/scripts/ovirt-early > @@ -263,9 +263,9 @@ local_install() { > rm -rf $ovirt/LiveOS > mkdir -p $ovirt/boot/grub > mkdir -p $ovirt/LiveOS > - cp -a $live/LiveOS/squashfs.img $ovirt/LiveOS \ > - && cp -a $live/$syslinux/initrd0.img $ovirt/boot \ > - && cp -a $live/$syslinux/vmlinuz0 $ovirt/boot > + cp -p $live/LiveOS/squashfs.img $ovirt/LiveOS \ > + && cp -p $live/$syslinux/initrd0.img $ovirt/boot \ > + && cp -p $live/$syslinux/vmlinuz0 $ovirt/bootACK. FYI, the fact that "cp -a" copies SELinux attributes is Red Hat specific. Never versions of cp make cp's -a act as documented: "like -dpPR", which does not include copying SELinux context.