
rm -rf ./usr/share/zoneinfo #100526

#130307 arch has moved libs from /lib to /usr/lib, which breaks chroot. move them back to proper place...
if [ "$DISTRO_BINARY_COMPAT" = "arch" ];then #exported from 2createpackages.
 mkdir -p lib
 mkdir -p usr/lib
 FNDCLIBS="$(find usr/lib -mindepth 1 -maxdepth 1 -name '*.so*')"
 if [ "$FNDCLIBS" != "" ];then
  for ONECLIB in $FNDCLIBS
  do
   [ "$ONECLIB" = "" ] && continue
   BASECLIB="$(basename $ONECLIB)"
   #it seems, traditionally, these stay in /usr/lib...
   [ "$BASECLIB" = "libc.so" ] && [ ! -h $ONECLIB ] && continue
   [ "$BASECLIB" = "libpthread.so" ] && [ ! -h $ONECLIB ] && continue
   cp -a -f --remove-destination $ONECLIB ./lib/
   rm -f $ONECLIB
  done
  #traditionally, there are some symlinks in /usr/lib, recreate...
  FNDSYMLINKS="$(find lib -mindepth 1 -maxdepth 1 -name '*.so.[0-9]')"
  if [ "$FNDSYMLINKS" != "" ];then
   for ONESYMLINK in $FNDSYMLINKS
   do
    [ "$ONESYMLINK" = "" ] && continue
    if [ -h $ONESYMLINK ];then
     #TARGETLINK="$(readlink $ONESYMLINK)"
     TARGETLINK="$(basename $ONESYMLINK)"
     BASESYM="$(basename $ONESYMLINK | rev | cut -f 2-9 -d '.' | rev)"
     [ -e usr/lib/$BASESYM ] && continue
     ln -s ../../lib/$TARGETLINK usr/lib/$BASESYM
    fi
   done
  fi
 fi
fi
