On Tuesday 25 February 2003 14:30, david mattatall wrote:
> Ok I generated this list by doing an emerge -ep --deep world and removing
> all the packages that I had previously finnished compiling. I need to know
> if there is a way I can turn this into a command I can use to resume where
> I left off.
>
> Hell I'll use this time to ask you all if there is an easier way to
> recompile every program already installed on ones system?

I use the following script:

----8<----

#!/bin/bash

#set -x

PACKAGES=/tmp/installed_packages
FAILED=/tmp/remerge.failed
SUCCESS=/tmp/remerge.success

# define ALSA_CARDS to make the compile for ALSA a bit more efficient
export ALSA_CARDS=ens1371

# define emerge flags
#EMERGEFLAGS="--pretend"
EMERGEFLAGS="--oneshot --verbose"

moveToFront() {
  echo move $1 to front

  mv ${PACKAGES} ${PACKAGES}.bak
  cat ${PACKAGES}.bak | grep $1 >> ${PACKAGES}.new
  cat ${PACKAGES}.bak | grep -v $1 > ${PACKAGES}
  rm ${PACKAGES}.bak
}

# collect all installed package we want to recompile
if [ ! -f ${PACKAGES} ]
then
  echo collecting packages to be recompiled
  emerge --update --deep --emptytree --pretend world | tail +5 | cut -c 16- > 
${PACKAGES}
  #qpkg --installed --no-color --verbose > ${PACKAGES}

  #emerge these first (see bootstrap)
  moveToFront baselayout
  moveToFront portage
  moveToFront binutils
  # just gcc will move gcc-config to the front
  moveToFront "gcc-[0-9]"
  moveToFront glibc
  moveToFront texinfo
  moveToFront zlib
  moveToFront ncurses

  # sun-j2sdk and openoffice takes too long to compile
  cat ${PACKAGES} | grep -v "sun-j2sdk" | grep -v "openoffice" >> 
${PACKAGES}.new
  mv ${PACKAGES}.new ${PACKAGES}

  rm ${FAILED}
  rm ${SUCCESS}
fi

while [ -s ${PACKAGES} ]
do
  PACKAGE=$(head -n 1 ${PACKAGES})

  nice --adjustment=19 emerge ${EMERGEFLAGS} \=$PACKAGE
  if [ $? == 0 ]
  then
    echo ${PACKAGE} >> ${SUCCESS}
  else
    echo ${PACKAGE} >> ${FAILED}
  fi

  # Whether the emerge failed or succeeded, remove the compile directory.
  # Especially when an emerge failed, the build directory can take up a
  # lot of space.
  /bin/rm -rf /var/tmp/portage/$(echo ${PACKAGE} | sed "s/.*\///")

  # update the track file
  mv ${PACKAGES} ${PACKAGES}.bak
  tail -n +2 ${PACKAGES}.bak > ${PACKAGES}
  rm ${PACKAGES}.bak
done

----8<----

If it fails or is interrupted, you can just start again and it will continue 
where it stopped.

-- 

/V\arijn |)eé - Software Engineer - DataDistilleries
E-mail: [EMAIL PROTECTED]
Web: www.DataDistilleries.com


--
[EMAIL PROTECTED] mailing list

Reply via email to