|
Harald Hoyer |
ee76a0 |
From b43d651511df184fcdc1677e11166bae2f61073a Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
ee76a0 |
From: Will Woods <wwoods@redhat.com>
|
|
Harald Hoyer |
ee76a0 |
Date: Wed, 7 Mar 2012 17:22:18 -0500
|
|
Harald Hoyer |
ee76a0 |
Subject: [PATCH] fix apply-live-updates failing because of /lib symlink
|
|
Harald Hoyer |
ee76a0 |
|
|
Harald Hoyer |
ee76a0 |
Since cp won't copy a directory over a symlink, any updates that were
|
|
Harald Hoyer |
ee76a0 |
supposed to go into e.g. /lib would get dropped if you had /updates/lib
|
|
Harald Hoyer |
ee76a0 |
as an actual directory, but the target system had /lib->/usr/lib.
|
|
Harald Hoyer |
ee76a0 |
---
|
|
Harald Hoyer |
ee76a0 |
modules.d/90dmsquash-live/apply-live-updates.sh | 20 ++++++++++++++------
|
|
Harald Hoyer |
ee76a0 |
1 files changed, 14 insertions(+), 6 deletions(-)
|
|
Harald Hoyer |
ee76a0 |
|
|
Harald Hoyer |
ee76a0 |
diff --git a/modules.d/90dmsquash-live/apply-live-updates.sh b/modules.d/90dmsquash-live/apply-live-updates.sh
|
|
Harald Hoyer |
ee76a0 |
index f840d1a..144e8b9 100755
|
|
Harald Hoyer |
ee76a0 |
--- a/modules.d/90dmsquash-live/apply-live-updates.sh
|
|
Harald Hoyer |
ee76a0 |
+++ b/modules.d/90dmsquash-live/apply-live-updates.sh
|
|
Harald Hoyer |
ee76a0 |
@@ -1,9 +1,17 @@
|
|
Harald Hoyer |
ee76a0 |
#!/bin/sh
|
|
Harald Hoyer |
ee76a0 |
-if [ -b /dev/mapper/live-rw ]; then
|
|
Harald Hoyer |
ee76a0 |
- if [ -d /updates ]; then
|
|
Harald Hoyer |
ee76a0 |
- echo "Applying updates to live image..."
|
|
Harald Hoyer |
ee76a0 |
+
|
|
Harald Hoyer |
ee76a0 |
+. /tmp/root.info
|
|
Harald Hoyer |
ee76a0 |
+
|
|
Harald Hoyer |
ee76a0 |
+if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then
|
|
Harald Hoyer |
ee76a0 |
+ info "Applying updates to live image..."
|
|
Harald Hoyer |
ee76a0 |
+ # avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
|
Harald Hoyer |
ee76a0 |
+ (
|
|
Harald Hoyer |
ee76a0 |
cd /updates
|
|
Harald Hoyer |
ee76a0 |
- /bin/cp -a -t $NEWROOT .
|
|
Harald Hoyer |
ee76a0 |
- cd -
|
|
Harald Hoyer |
ee76a0 |
- fi
|
|
Harald Hoyer |
ee76a0 |
+ find . -depth -type d | while read dir; do
|
|
Harald Hoyer |
ee76a0 |
+ [ -d "$NEWROOT/$dir" ] || mkdir -p "$NEWROOT/$dir"
|
|
Harald Hoyer |
ee76a0 |
+ done
|
|
Harald Hoyer |
ee76a0 |
+ find . -depth \! -type d | while read file; do
|
|
Harald Hoyer |
ee76a0 |
+ cp -a "$file" "$NEWROOT/$file"
|
|
Harald Hoyer |
ee76a0 |
+ done
|
|
Harald Hoyer |
ee76a0 |
+ )
|
|
Harald Hoyer |
ee76a0 |
fi
|