From 9d32ae401ea25227bd8bcfe7dfaad6c06e349a6b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 28 Oct 2006 10:37:47 +0000 Subject: =?UTF-8?q?Use=20mtree=20to=20save/restore=20bsd=20file=20flags=20?= =?UTF-8?q?before/after=20prepall=20and=20installation.=20=20Thanks=20to?= =?UTF-8?q?=20Diego=20Petten=C3=B2=20for=20this=20patch=20(related=20to=20?= =?UTF-8?q?bug=20#153109).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/main/trunk/; revision=4863 --- bin/misc-functions.sh | 18 ++++++++++++++++++ bin/prepall | 13 +++++++++++++ 2 files changed, 31 insertions(+) (limited to 'bin') diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 9ae010e4d..3a1826e66 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -243,6 +243,24 @@ install_mask() { set -${shopts} } +preinst_bsdflags() { + type -p chflags &>/dev/null || return 0 + type -p mtree &>/dev/null || return 1 + # Save all the file flags for restoration after installation. + mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" + # Remove all the file flags so that the merge phase can do anything + # necessary. + chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" + chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null +} + +postinst_bsdflags() { + type -p chflags &>/dev/null || return 0 + type -p mtree &>/dev/null || return 1 + # Restore all the file flags that were saved before installation. + mtree -e -p "${ROOT}" -U -k flags < "${T}/bsdflags.mtree" &> /dev/null +} + preinst_mask() { if [ -z "$IMAGE" ]; then eerror "${FUNCNAME}: IMAGE is unset" diff --git a/bin/prepall b/bin/prepall index 118b85d8b..68af880dc 100755 --- a/bin/prepall +++ b/bin/prepall @@ -5,6 +5,14 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +if type -p chflags &>/dev/null && type -p mtree &>/dev/null; then + # Save all the file flags for restoration at the end of prepall. + mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" + # Remove all the file flags so that prepall can do anything necessary. + chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" + chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null +fi + prepallman prepallinfo prepallstrip @@ -88,3 +96,8 @@ for d in "${D}"lib* "${D}"usr/lib* ; do done fi + +if type -p chflags &>/dev/null && type -p mtree &>/dev/null; then + # Restore all the file flags that were saved at the beginning of prepall. + mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null +fi -- cgit v1.2.3-1-g7c22