Create /etc/portage on stage1-controller.
[catalyst.git] / targets / stage1 / stage1-controller.sh
1 #!/bin/bash
2
3 . ${clst_sharedir}/targets/support/functions.sh
4
5 case $1 in
6         enter)
7         ;;
8         run)
9                 cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
10
11                 # Setup "ROOT in chroot" dir
12                 install -d ${clst_chroot_path}/${clst_root_path}/etc
13                 install -d ${clst_chroot_path}/${clst_root_path}/etc/portage
14
15                 # Setup make.conf and make.profile link in "ROOT in chroot":
16                 copy_to_chroot ${clst_chroot_path}/etc/portage/make.conf /${clst_root_path}/etc/portage
17
18                 # Enter chroot, execute our build script
19                 exec_in_chroot \
20                         ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh \
21                         || exit 1
22         ;;
23         preclean)
24                 exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh /tmp/stage1root || exit 1
25         ;;
26         clean)
27                 # Clean out man, info and doc files
28                 rm -rf usr/share/{man,doc,info}/*
29                 # Zap all .pyc and .pyo files
30                 find . -iname "*.py[co]" -exec rm -f {} \;
31                 # Cleanup all .a files except libgcc.a, *_nonshared.a and
32                 # /usr/lib/portage/bin/*.a
33                 find . -type f -iname "*.a" | grep -v 'libgcc.a' | \
34                         grep -v 'nonshared.a' | grep -v '/usr/lib/portage/bin/' | \
35                         grep -v 'libgcc_eh.a' | xargs rm -f
36         ;;
37         *)
38                 exit 1
39         ;;
40 esac
41 exit $?