[Aurora-sparc-user] Step by Step: Portage on Aurora

Kyle Gordon geekmasterflash at gmail.com
Fri Jul 21 02:16:02 EDT 2006


#Get the portage rescue package

wget http://dev.gentoo.org/~carpaski/portage_rescue/portage-rescue-2.0.48-r1-sparc.tbz2

#Create a script that i found on the gentoo forums, don't really know
what it does, but apparently it does the whole job

cat > script.sh << "EOF"
#!/bin/bash
#
# call with one argument "again" or call it with no arguments at all
# call it with no arguments first time.
# call it again with "again" to bypass some operations.
#

if [ "$#" == "1" ];then
  again=$1
else
  again=""
fi

if [ "`id -u`" != "0" ]; then
  echo ""
  echo "Su as root and try again."
  echo ""
fi

pythonV=`python -V 2>&1`
if [ "$pythonV" \< "Python 2.2.0" ];then
  echo ""
  echo "Install python 2.2 and then try again"
  echo ""
  exit 1
fi

if [ "$again" == "" ];then
  mkdir -p /usr/lib/portage/bin
  mkdir -p /usr/lib/portage/pym
  mkdir -p /usr/portage/profiles
  mkdir /etc/env.d

  wget http://gentoo.mirrors.pair.com/distfiles/portage-2.0.51.22.tar.bz2
-O /tmp/portage-2.0.51.22.tar.bz2
  cd /tmp
  if [ ! -f portage-2.0.51.22.tar.bz2 ];then
      echo ""
      echo "Mirror error. Try this script again after a while without any args".
      echo ""
      exit 1
  fi
  tar jxf portage-2.0.51.22.tar.bz2

  cd portage-2.0.51.22/bin
  cp * /usr/lib/portage/bin
  export PATH=/usr/lib/portage/bin:$PATH
  cd ../pym ; cp * /usr/lib/portage/pym/
  cd ../man ;cp *.1 /usr/man/man1 ;cp *.5 /usr/man/man5
  cd ../src/python-missingos
  ./setup.py install
  cd ../sandbox-1.1
  make && make install
  cd ../../cnf; cp * /etc

  if [ "`id portage`" == "" ]; then
      groupadd -g 250 portage
      useradd -d /var/tmp/portage -g portage -u 250 portage
  fi

  cd /usr/sbin
  ln -s ../lib/portage/bin/regenworld .
  ln -s ../lib/portage/bin/pkgmerge .
  ln -s ../lib/portage/bin/fixpackages .
  ln -s ../lib/portage/bin/etc-update .
  ln -s ../lib/portage/bin/env-update .
  ln -s ../lib/portage/bin/emerge-webrsync .
  ln -s ../lib/portage/bin/ebuild.sh .
  ln -s ../lib/portage/bin/ebuild .
  ln -s ../lib/portage/bin/dispatch-conf .
  ln -s ../lib/portage/bin/archive-conf .

  cd /usr/bin
  ln -s ../lib/portage/bin/xpak .
  ln -s ../lib/portage/bin/repoman .
  ln -s ../lib/portage/bin/quickpkg .
  ln -s ../lib/portage/bin/portageq .
  ln -s ../lib/portage/bin/g-cpan.pl .
  ln -s ../lib/portage/bin/emerge .
fi

export PATH=/usr/lib/portage/bin:$PATH
echo "CC=gcc;CXX=g++" > /etc/env.d/compilers.sh
echo "LDPATH=\"/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib:/usr/kerberos/lib\""
> /etc/env.d/10ldpath
. /etc/env.d/compilers.sh
emerge sync
#
# emerge sync should get /usr/portage/profiles
#
if [ -d /usr/portage/profiles/default-linux/sparc ];then
  ln -s /usr/portage/profiles/default-linux/sparc /etc/make.profile
else
  echo ""
  echo "Something wrong. Get /usr/portage/profiles dir from a working"
  echo "Gentoo system and try again."
  echo ""
  exit 1
fi

# inject the "dangerous" packages first.
glibcP=`emerge -p -O glibc|grep ebuild|cut -d" " -f8`
emerge inject $glibcP
gccP=`emerge -p -O gcc|grep ebuild|cut -d" " -f8`
emerge inject $gccP
binP=`emerge -p -O binutils|grep ebuild|cut -d" " -f8`
emerge inject $binP

# fetch the baselayout.
emerge -f -O baselayout

# now inject it too.
baseP=`emerge -p -O baselayout|grep ebuild|cut -d" " -f8`
emerge inject $baseP

#was inject success
ret=`emerge -p baselayout|grep "ebuild  R"`

if [ "$ret" == "" ] ;then
  echo "Inject has failed. Please verify and continue with cut & paste
of rest of the steps"
  echo "ERROR."
  exit 1
fi

# if it fails with some errors, its fine.
emerge -O portage

cd /tmp
cp /usr/portage/distfiles/rc-scripts*.tar.bz2 .
tar xjpf rc-scripts*.tar.bz2
cd rc-scripts*/sbin
cp depscan.sh /sbin; cp functions.sh /sbin
mkdir -p /lib/rcscripts/awk
cd ../src/awk
cp *.awk /lib/rcscripts/awk/
cd /etc/init.d
ln -s /sbin/depscan.sh .
ln -s /sbin/functions.sh .

emerge -O gawk

# FOLLOWING SHOULD NOT GIVE ANY ERRORS HERE. You screwed up if it did.
emerge -O portage

if ! fgrep -q "/etc/profile.env" /etc/profile ; then
  echo ". /etc/profile.env" >> /etc/profile
fi

echo ""
echo "#############################################################"
echo "You are now free to enjoy portage. Make sure you tune"
echo "/etc/make.conf and other portage configuration files to take"
echo "advantage of portage. If you screwed up, its OK. Pick yourself"
echo "up and give it another go."
echo "#############################################################"
echo ""
EOF

#symlink nano to pico
ln -s /usr/bin/pico /usr/bin/nano

#make script executable
chmod +x script.sh

#extract the portage rescue from wherever you left it into root directory
cd /
tar -xvjpf /root/portage-rescue-2.0.48-r1-sparc.tbz2

#download and import an entire /usr/portage dir from another system,
if you don't have another system this can be done by importing a
portage snapshot from the gentoo site.
cd /usr
wget http://gentoo.mirrors.pair.com/snapshots/portage-20060713.tar.bz2

#run the script
cd /root/
./script.sh

#!!! BAD COUNTER in 'sys-devel/gcc-3.3.2-r5'
#expect this error, i don't know what causes it, neither does anyone else
#but apparently it's not a problem

#tell portage about all the apps that are already installed
emerge inject sys-libs/ncurses-5.4-13
emerge inject dev-python/python-fchksum-1.6.1-r1
emerge inject app-shells/bash-2.05b-r9
emerge inject sys-apps/groff-1.18.1-r4 sys-apps/man-1.5l-r6
emerge inject sys-apps/texinfo-4.5
emerge inject sys-devel/m4-1.4-r1
emerge inject sys-devel/libperl-5.8.2
emerge inject dev-lang/perl-5.8.2-r1
emerge inject sys-devel/autoconf-2.58-r1
emerge inject sys-devel/automake-1.8.3
emerge inject sys-apps/coreutils-5.0.91-r4
emerge inject sys-apps/texinfo-4.5
emerge inject dev-lang/python-2.3.5

#reinstall portage itself to ensure lasest version is installed
emerge portage

#same for autoconf/make
emerge autoconf automake

#this unbreaks some stuff
emerge pam

#update config files
etc-update

for those who like gui, once portage is installed you could do
webportage http://sourceforge.net/projects/webportage/ a webmin type
interface for portage.


More information about the Aurora-sparc-user mailing list