tags 486926 + patch
thanks
Chris Lamb wrote:
> I tried a few fd/fifo redirection tricks, but couldn't get the right
> combination..any ideas?
Got it, hurrah. Updated and tested patch attached.
Regards,
--
Chris Lamb, UK chris@chris-lamb.co.uk
GPG: 0x634F9A20
From 8d1275ccb68117d1f288adf4691f255b09bbe71a Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Thu, 19 Jun 2008 16:10:42 +0100
Subject: [PATCH] I suggest getting rid of this mkdir/rm/cp nonsense and just pipe tar to
tar. d-i busybox tar cannot create tar archives, but that's ok, we have
a live filesystem with a fullfledged tar on it available to use.
---
packages/live-installer/debian/changelog | 2 +
packages/live-installer/debian/postinst | 45 +++++++++++++++++------------
2 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/packages/live-installer/debian/changelog b/packages/live-installer/debian/changelog
index 6b6de43..4cfaac7 100644
--- a/packages/live-installer/debian/changelog
+++ b/packages/live-installer/debian/changelog
@@ -2,6 +2,8 @@ live-installer (6) UNRELEASED; urgency=low
* Bail-out much earlier if a filesystem image cannot be found (Chris Lamb)
Closes: #486184
+ * Copy files using tar, avoids permissions problems and other nonsense.
+ Closes: #486926
-- Joey Hess <joeyh@debian.org> Wed, 18 Jun 2008 21:45:14 -0400
diff --git a/packages/live-installer/debian/postinst b/packages/live-installer/debian/postinst
index c9817f9..bed9f09 100755
--- a/packages/live-installer/debian/postinst
+++ b/packages/live-installer/debian/postinst
@@ -40,25 +40,32 @@ install_live_system () {
COUNT=0
OLD_IFS=$IFS
IFS=$NEWLINE
- for item in `find .`; do
- # We need to be ensure it's not a symbolic link otherwise
- # it breaks links for directories.
- if [ -d "$item" ] && [ ! -h "$item" ]; then
- mkdir -p /target/"$item"
- else
- mkdir -p /target/"$(dirname $item)"
- rm -f /target/"$item"
- cp -a "$item" /target/"$item"
- fi
-
- COUNT=$(($COUNT + 1))
- CURRENT=$(($COUNT * 100 / $STEPS))
-
- [ x$CURRENT = x$LAST_UPDATE ] && continue
-
- LAST_UPDATE=$CURRENT
- db_progress STEP 1
- done
+ mkdir -p /target
+ # use tar from inside the live filesystem to create
+ # the tarball, because busybox tar in d-i does not
+ # support creating tarballs.
+ #
+ # The --exclude is a paranoia measure, in case this program
+ # is running from the toplevel of a live filesystem,
+ # which is not normally the case.
+
+ exec 4<&0
+ chroot . tar c . --exclude=target | \
+ (chdir /target && tar xv) | \
+ (
+ while read line && exec 5<&0; do
+ COUNT=$(($COUNT + 1))
+ CURRENT=$(($COUNT * 100 / $STEPS))
+
+ [ x$CURRENT = x$LAST_UPDATE ] && continue
+
+ LAST_UPDATE=$CURRENT
+ exec <&4
+ db_progress STEP 1
+ exec <&5
+ done
+ )
+ exec 4<&- 5<&-
IFS=$OLD_IFS
done
--
1.5.5.4
Attachment:
signature.asc
Description: PGP signature