Fixed gcc-config calls. This is 2.0_rc11.
[catalyst.git] / targets / stage1 / stage1-controller.sh
1 #!/bin/bash
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-controller.sh,v 1.7 2005/12/20 17:05:39 wolf31o2 Exp $
5
6 . ${clst_sharedir}/targets/support/functions.sh
7
8 case $1 in
9         enter)
10         ;;
11         run)
12                 cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
13                 
14                 # Setup "ROOT in chroot" dir
15                 install -d ${clst_chroot_path}/${clst_root_path}/etc
16                 
17                 # Setup make.conf and make.profile link in "ROOT in chroot":
18                 copy_to_chroot ${clst_chroot_path}/etc/make.conf /${clst_root_path}/etc
19                 copy_to_chroot ${clst_chroot_path}/etc/make.profile \
20                         /${clst_root_path}/etc
21                 
22                 # Enter chroot, execute our build script
23                 exec_in_chroot \
24                         ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh \
25                         || exit 1
26         ;;
27         preclean)
28                 # We run gcc-config here this way so it works on all arches.
29                 if [ -x /usr/bin/gcc-config ]
30                 then
31                         mythang=$( cd /tmp/stage1root/etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
32                         if [ -z "${mythang}" ]
33                         then
34                                 mythang=1
35                         fi
36                         ROOT=/tmp/stage1root/ gcc-config ${mythang}
37                 fi
38                 # We run binutils-config here so it works on all arches.
39                 if [ -x /usr/bin/binutils-config ]
40                 then
41                         mythang=$( cd /tmp/stage1root/etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
42                         if [ -z "${mythang}" ]
43                         then
44                                 mythang=1
45                         fi
46                         ROOT=/tmp/stage1root/ binutils-config ${mythang}
47                 fi
48                 exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh /tmp/stage1root || exit 1
49         ;;
50         clean)
51                 # Clean out man, info and doc files
52                 rm -rf usr/share/{man,doc,info}/*
53                 # Zap all .pyc and .pyo files
54                 find -iname "*.py[co]" -exec rm -f {} \;
55                 # Cleanup all .a files except libgcc.a, *_nonshared.a and
56                 # /usr/lib/portage/bin/*.a
57                 find -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' | \
58                         grep -v '/usr/lib/portage/bin/' | grep -v 'libgcc_eh.a' | xargs \
59                         rm -f
60         ;;
61         *)
62                 exit 1
63         ;;
64 esac
65 exit $?