]> git.wh0rd.org Git - patches.git/blob - busybox-symlinks.patch
initial import
[patches.git] / busybox-symlinks.patch
1 Index: busybox-1.2.1.ebuild
2 ===================================================================
3 RCS file: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-1.2.1.ebuild,v
4 retrieving revision 1.7
5 diff -u -p -r1.7 busybox-1.2.1.ebuild
6 --- busybox-1.2.1.ebuild        9 Aug 2006 18:18:00 -0000       1.7
7 +++ busybox-1.2.1.ebuild        28 Aug 2006 05:54:07 -0000
8 @@ -169,8 +169,11 @@ src_unpack() {
9  
10  src_compile() {
11         busybox_set_env
12 +
13 +       # work around broken ass powerpc compilers
14         use ppc64 && append-flags -mminimal-toc $(test-flags-CC -fno-stack-protector)
15         use ppc && append-flags $(test-flags-CC -fno-stack-protector)
16 +
17         emake CROSS="${CROSS}" busybox || die "build failed"
18         if ! use static ; then
19                 mv busybox_unstripped{,.bak}
20 @@ -203,27 +206,12 @@ src_install() {
21                 && dosym busybox /bin/bb \
22                 || dobin bb
23  
24 -       if use make-symlinks ; then
25 -               if [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
26 -                       ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
27 -                       ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
28 -                       ewarn "If you are creating a binary only and not merging this is probably ok."
29 -                       ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is realy what you want."
30 -                       die "silly options will destroy your system"
31 -               fi
32 -               make CROSS="${CROSS}" install || die
33 -               cp -pPR _install/${x}/* "${D}"/ || die "copying links for ${x} failed"
34 -               cd "${D}"
35 -               # XXX: should really move this to pkg_preinst() ...
36 -               local symlink
37 -               for symlink in {,usr/}{bin,sbin}/* linuxrc ; do
38 -                       [[ -L ${symlink} ]] || continue
39 -                       [[ -e ${ROOT}/${symlink} ]] \
40 -                               && eerror "Deleting symlink ${symlink} because it exists in ${ROOT}" \
41 -                               && rm ${symlink}
42 -               done
43 -               cd "${S}"
44 -       fi
45 +       # bundle up the symlink files for use later
46 +       make CROSS="${CROSS}" install || die
47 +       rm _install/bin/busybox
48 +       tar cf busybox-links.tar -C _install . || die
49 +       insinto /usr/share/${PN}
50 +       doins busybox-links.tar || die
51  
52         dodoc AUTHORS README TODO
53  
54 @@ -234,9 +222,6 @@ src_install() {
55         dodoc *.pod
56         dohtml *.html *.sgml
57  
58 -       # no man files?
59 -       # cd ../man && doman *.1
60 -
61         cd ../examples || die
62         docinto examples
63         dodoc inittab depmod.pl *.conf *.script undeb unrpm
64 @@ -244,23 +229,28 @@ src_install() {
65         cd bootfloppy || die
66         docinto bootfloppy
67         dodoc * etc/* etc/init.d/* 2>/dev/null
68 +}
69  
70 -       cd ../../ || die
71 -       if has buildpkg ${FEATURES} && has keepwork ${FEATURES} ; then
72 -               cd "${S}"
73 -               # this should install to the ./_install/ dir by default.
74 -               # we make a micro pkg of busybox that can be used for
75 -               # embedded systems -solar
76 -               if ! use make-symlinks ; then
77 -                       make CROSS="${CROSS}" install || die
78 -               fi
79 -               cd ./_install/ \
80 -                       && tar --no-same-owner -jcvf ${WORKDIR}/${MY_P}-${ARCH}.bz2 . \
81 -                       && cd ..
82 +pkg_preinst() {
83 +       if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
84 +               ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
85 +               ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
86 +               ewarn "If you are creating a binary only and not merging this is probably ok."
87 +               ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is realy what you want."
88 +               die "silly options will destroy your system"
89         fi
90 +
91 +       mv "${D}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
92  }
93  
94  pkg_postinst() {
95 +       if use make-symlinks ; then
96 +               cd "${T}" || die
97 +               mkdir _install
98 +               tar xf busybox-links.tar -C _install || die
99 +               cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
100 +       fi
101 +
102         if use savedconfig ; then
103                 local config_dir="${PORTAGE_CONFIGROOT:-${ROOT}}/etc/portage/savedconfig"
104                 einfo "Saving this build config to ${config_dir}/${PF}.config"
105 @@ -275,6 +265,3 @@ pkg_postinst() {
106         einfo "if you want to add or remove functionality for ${PN}"
107         echo
108  }
109 -
110 -
111 -