source: src-sh/warden/linux-installs/gentoo-stage3-i486 @ 1620346

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 21 months ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100755
File size: 4.1 KB
Line 
1#!/bin/sh
2# Script to install gentoo i386 release into a jail
3# Author: Kris Moore <kris@pcbsd.org>
4
5# Jail / chroot dir
6jDIR="$1"
7
8# Target jail IP address
9jIP="$2"
10
11# Jail meta-directory
12jMETA="$3"
13
14
15if [ ! -e "${jDIR}" ] ; then
16  mkdir -p "${jDIR}"
17fi
18
19INDEXFILE="latest-stage3-i486.txt"
20SUBDIR="releases/x86/autobuilds"
21MASTER_SITE="http://ftp.roedu.net/pub/mirrors/gentoo.org/$SUBDIR/\n
22http://distro.ibiblio.org/pub/linux/distributions/gentoo/$SUBDIR/\n
23http://gentoo.mirrors.pair.com/$SUBDIR/\n
24http://gentoo.chem.wisc.edu/gentoo/$SUBDIR/\n
25http://adelie.polymtl.ca/$SUBDIR/\n
26http://mirrors.tds.net/gentoo/$SUBDIR/\n
27ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/$SUBDIR/\n
28http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/\n
29http://ftp.easynet.nl/mirror/gentoo/$SUBDIR/\n
30http://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/\n
31http://trumpetti.atm.tut.fi/gentoo/$SUBDIR/\n
32http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo/$SUBDIR/\n
33http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/$SUBDIR/\n
34http://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/\n
35http://darkstar.ist.utl.pt/gentoo/$SUBDIR/\n
36http://gentoo.inode.at/$SUBDIR/\n
37http://ftp.rhnet.is/pub/gentoo/$SUBDIR/\n
38http://gentoo.mirror.sdv.fr/$SUBDIR/\n
39http://gentoo.gg3.net/$SUBDIR/\n
40http://gentoo.kems.net/$SUBDIR/\n
41ftp://ftp.gtlib.gatech.edu/pub/gentoo/$SUBDIR/\n
42ftp://mirror.iawnet.sandia.gov/pub/gentoo/$SUBDIR/\n
43ftp://ftp.ussg.iu.edu/pub/linux/gentoo/$SUBDIR/\n
44ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/$SUBDIR/\n
45ftp://gentoo.mirrors.pair.com/$SUBDIR/\n
46ftp://mirrors.tds.net/gentoo/$SUBDIR/\n
47ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/\n
48ftp://ftp.easynet.nl/mirror/gentoo/$SUBDIR/\n
49ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/\n
50ftp://trumpetti.atm.tut.fi/gentoo/$SUBDIR/\n
51ftp://sunsite.cnlab-switch.ch/mirror/gentoo/$SUBDIR/\n
52ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/\n
53ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/\n
54ftp://ftp.tu-clausthal.de/pub/linux/gentoo/$SUBDIR/\n
55ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/$SUBDIR/\n
56ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/$SUBDIR/\n
57ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/\n
58ftp://darkstar.ist.utl.pt/pub/gentoo/$SUBDIR/\n
59ftp://gentoo.inode.at/source/$SUBDIR/\n
60ftp://ftp.rhnet.is/pub/gentoo/$SUBDIR/\n
61ftp://files.gentoo.gr/$SUBDIR/\n
62ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO/$SUBDIR/\n
63ftp://gentoo.kems.net/pub/mirrors/gentoo/$SUBDIR/"
64
65echo -e $MASTER_SITE | while read url
66do
67  echo "Trying to fetch index: ${url}${INDEXFILE}"
68  fetch -o ${INDEXFILE} ${url}${INDEXFILE}
69  if [ $? -eq 0 ] ; then
70     break
71  fi
72done
73
74ARCHIVEFILE="`cat ${INDEXFILE} | grep 'stage3'`"
75DLFILE="`basename $ARCHIVEFILE`"
76rm ${INDEXFILE}
77if [ -z "$ARCHIVEFILE" ] ; then
78   echo "Failed to locate current archive"
79   exit 1
80fi
81
82echo -e $MASTER_SITE | while read url
83do
84  echo "Fetching archive: ${url}${ARCHIVEFILE}"
85  fetch -o ${DLFILE} ${url}${ARCHIVEFILE}
86  if [ $? -eq 0 ] ; then
87     break
88  fi
89done
90
91
92if [ ! -e "${DLFILE}" ] ; then
93   echo "Failed to download.."
94   exit 1
95fi
96
97echo "Extracting Gentoo base...Please wait..."
98tar --exclude=./dev -xpy --exclude=./proc --exclude=./lib/udev --exclude=./lib/udev-state -C ${jDIR} -f ${DLFILE}
99err=$?
100rm ${DLFILE}
101mkdir ${jDIR}/dev >/dev/null 2>/dev/null
102mkdir ${jDIR}/dev/fd >/dev/null 2>/dev/null
103mkdir ${jDIR}/proc >/dev/null 2>/dev/null
104mkdir ${jDIR}/sys >/dev/null 2>/dev/null
105
106#@${FIND} ${PREFIX}/${PREFIX_SUBDIR}bin ${PREFIX}/${PREFIX_SUBDIR}sbin/ \
107#       ${PREFIX}/${PREFIX_SUBDIR}usr/bin ${PREFIX}/${PREFIX_SUBDIR}/usr/sbin \
108#       -type f -print0 | ${XARGS} -0 ${FILE} \
109#       | ${GREP} ELF | ${CUT} -d : -f 1 | ${XARGS} ${BRANDELF} -t Linux
110#@${BRANDELF} -t Linux ${PREFIX}/${PREFIX_SUBDIR}/lib/ld-*.so
111
112umount -f ${jDIR}/dev/fd >/dev/null 2>/dev/null
113umount -f ${jDIR}/dev >/dev/null 2>/dev/null
114umount -f ${jDIR}/sys >/dev/null 2>/dev/null
115umount -f ${jDIR}/proc >/dev/null 2>/dev/null
116
117# Get rid of umount
118mv ${jDIR}/bin/umount ${jDIR}/bin/umount.prev
119ln -s /bin/true ${jDIR}/bin/umount
120
121# Setup some custom start / stop stuff
122echo "/sbin/rc default" > ${jMETA}/jail-start
123echo "/sbin/rc shutdown" > ${jMETA}/jail-stop
124
125exit $err
Note: See TracBrowser for help on using the repository browser.