view sources/native-builds/gentoo-stage1-files/init @ 1246:9f58f9a6b9e4

Strangely, ncurses won't build shared libraries unless explicitly told to do so on the configure command line. (Yes, it's a library package. No, I don't know what they were smoking either.)
author Rob Landley <rob@landley.net>
date Sun, 12 Sep 2010 19:21:42 -0500
parents db3b0244a49e
children b84cf2f3ef53
line wrap: on
line source

#!/bin/bash

upload_result()
{
  ftpput $FTP_SERVER -P $FTP_PORT "$1-$HOST" "$1"
}

set_titlebar()
{
  echo -en "\033]2;($HOST) $1\007"
  echo === "$1"
}

dotprogress()
{
  while read i; do echo -n .; done; echo
}

echo Started second stage init

# If the root filesystem is read only (squashfs), copy it into a new chroot
# directory under /home and restart in there.

touch /.iswriteable 2>/dev/null
rm /.iswriteable 2>/dev/null
if [ $? -ne 0 ]
then
  set_titlebar "writeable chroot"
  mkdir gentoo-stage1
  find / -xdev | cpio -m -v -p /home/gentoo-stage1 | dotprogress

  echo Restarting init script in chroot
  for i in mnt proc sys dev; do mount --bind /$i gentoo-stage1/$i; done
  chroot gentoo-stage1 /mnt/init
  RC=$?
  for i in mnt proc sys dev; do umount gentoo-stage1/$i; done


  if [ $RC -eq 0 ]
  then
    set_titlebar "upload tarball"
    tar czvf gentoo-stage1.tar.gz gentoo-stage1 | dotprogress &&
    upload_result gentoo-stage1.tar.gz
  fi

  sync
  exit
fi

set_titlebar "zlib" && cp -sfR /mnt/zlib zlib && cd zlib &&

# 1.2.5 accidentally shipped the Makefile, then configure tries to
# modify it in place.
rm Makefile && 
./configure --prefix=/usr &&
make -j $CPUS &&
make install &&

cd .. && rm -rf zlib || exit 1

set_titlebar "ncurses" && cp -sfR /mnt/ncurses ncurses && cd ncurses &&

./configure --without-cxx-binding --with-shared &&
make -j $CPUS &&
make install &&

cd .. && rm -rf ncurses || exit 1

set_titlebar "Python" && cp -sfR /mnt/Python python && cd python &&

./configure --prefix=/usr &&
make -j $CPUS &&
make install &&

cd .. && rm -rf python || exit 1

# Portage uses bash ~= regex matches, which were introduced in bash 3.

set_titlebar "Bash3" && cp -sfR /mnt/bash bash && cd bash &&

./configure --enable-cond-regexp --disable-nls --prefix=/usr &&
make -j $CPUS &&
make install &&

cd .. && rm -rf bash || exit 1

set_titlebar "rsync" && cp -sfR /mnt/rsync rsync && cd rsync &&

./configure --prefix=/usr &&
# Break link and touch file, otherwise ./configure tries to recreate it
# which requires perl.
cat proto.h-tstamp > proto.h.new &&
mv -f proto.h.new proto.h-tstamp &&
make -j $CPUS &&
make install &&

cd .. && rm -rf rsync || exit 1

# Need a patch with --dry-run to make portage happy

set_titlebar "patch" && cp -sfR /mnt/patch patch && cd patch &&

./configure --prefix=/usr &&
make -j $CPUS &&
make install &&

cd .. && rm -rf patch || exit 1



set_titlebar "portage" && cd /mnt/portage &&

echo portage:x:250:250:portage:/var/tmp/portage:/bin/false >> /etc/passwd &&
echo portage::250:portage >> /etc/group &&
mkdir -p /usr/lib/portage &&
cp -a bin pym /usr/lib/portage/ &&
echo /usr/lib/portage/pym > /usr/lib/python2.6/site-packages/gentoo.pth ||
  exit 1

for i in archive-conf dispatch-conf emaint emerge-webrsync env-update \
         etc-update fixpackages quickpkg regenworld
do
  ln /usr/lib/portage/bin/$i /usr/sbin/$i || exit 1
done

for i in  ebuild egencache emerge portageq repoman
do
  ln /usr/lib/portage/bin/$i /usr/bin/$i || exit 1
done

cp cnf/make.globals /etc/ &&
cp man/*.1 /usr/man/man1 &&
cp man/*.5 /usr/man/man5 &&
mv /usr/bin/emerge /usr/bin/emerge.real &&
cp /mnt/emerge_wrapper.sh /usr/bin/emerge

cd /home || exit 1