Magellan Linux

Diff of /trunk/bootstrap/mage-bootstrap.sh.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/bootstrap/scripts/mage-bootstrap.sh revision 338 by niro, Thu Feb 23 16:46:03 2006 UTC trunk/bootstrap/mage-bootstrap.sh.in revision 1487 by niro, Thu Aug 4 13:19:28 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /home/cvsd/magellan-cvs/magellan-src/bootstrap/scripts/mage-bootstrap.sh,v 1.3 2006-02-23 16:46:03 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/bootstrap/scripts/mage-bootstrap.sh,v 1.8 2008-06-23 19:26:40 niro Exp $
3    
4  TOOLCHAIN=""  TOOLCHAIN=""
5  BASESYSTEM=""  BASESYSTEM=""
# Line 8  MROOT="" Line 8  MROOT=""
8  ABORT_AFTER_STAGE1=false  ABORT_AFTER_STAGE1=false
9  MY_MAGEDIR=""  MY_MAGEDIR=""
10  MY_PKGDIR=""  MY_PKGDIR=""
11    MAGEUPDATE=true
12    MAGEUPDATETARBALL=false
13    
14  die()  die()
15  {  {
# Line 55  read_magerc() Line 57  read_magerc()
57   local SMAGE2RSYNC   local SMAGE2RSYNC
58    
59   # sanity checks   # sanity checks
60     [ -f /etc/mage.rc.global ] && source /etc/mage.rc.global || \
61     die "get_value_from_magefile: /etc/mage.rc.global not found."
62   [ -f ${magerc} ] && source ${magerc} || \   [ -f ${magerc} ] && source ${magerc} || \
63   die "get_value_from_magefile: ${magerc} not found."   die "get_value_from_magefile: ${magerc} not found."
64   [ -z "${var}" ] && die "get_value_from_magefile: \$var not given."   [ -z "${var}" ] && die "get_value_from_magefile: \$var not given."
# Line 109  trap_exit() Line 113  trap_exit()
113    
114  print_usage()  print_usage()
115  {  {
116   echo "mage-bootstrap, version $Version$"   echo "mage-bootstrap, version @VERSION@"
117   echo "Usage: $(basename $0) --opt arg ..."   echo "Usage: $(basename $0) --opt arg ..."
118   echo   echo
119   echo "Options:"   echo "Options:"
120   echo " --profile,    -p  --  select a profile (needed)"   echo " --profile,        -p  --  select a profile (needed)"
121   echo " --root,       -r  --  location to new root (needed)"   echo " --root,           -r  --  location to new root (needed)"
122   echo " --magerc,     -m  --  location of mage.rc (needed)"   echo " --magerc,         -m  --  location of mage.rc (needed)"
123   echo   echo
124   echo " --toolchain,  -t  --  select other toolchain than from profile"   echo " --toolchain,      -t  --  select other toolchain than from profile"
125   echo " --basesystem, -b  --  select other basesystem than from profile"   echo " --basesystem,     -b  --  select other basesystem than from profile"
126   echo " --stage1,     -s1 --  if set, abort after stage1 (toolchain)"   echo " --stage1,         -s1 --  if set, abort after stage1 (toolchain)"
127   echo " --help,       -h  --  prints this help"   echo " --update-tarball, -ut --  update via tarball not rsync"
128     echo " --no-update,      -u  --  do not update the mage tree"
129     echo " --help,           -h  --  prints this help"
130   echo   echo
131    
132   exit 1   exit 1
# Line 142  do Line 148  do
148   --root|-r) shift; MROOT="$1" ;;   --root|-r) shift; MROOT="$1" ;;
149   --stage1|-s1) ABORT_AFTER_STAGE1=true ;;   --stage1|-s1) ABORT_AFTER_STAGE1=true ;;
150   --magerc|-m) shift; MAGERC="$1" ;;   --magerc|-m) shift; MAGERC="$1" ;;
151     --update-tarball|-ut) MAGEUPDATETARBALL=true ;;
152     --no-update|-u) MAGEUPDATE=false ;;
153   --help|-h) print_usage ;;   --help|-h) print_usage ;;
154   '') shift;;   '') shift;;
155   *) echo "Unkown option '$1', use --help or -h to get more info."; exit 1 ;;   *) echo "Unkown option '$1', use --help or -h to get more info."; exit 1 ;;
# Line 183  mount -o bind ${MROOT}/${MY_PKGDIR} ${MY Line 191  mount -o bind ${MROOT}/${MY_PKGDIR} ${MY
191  ln -snf ${MY_MAGEDIR}/profiles/${PROFILE} /etc/mage-profile || die "link profile"  ln -snf ${MY_MAGEDIR}/profiles/${PROFILE} /etc/mage-profile || die "link profile"
192    
193  # update mage tree  # update mage tree
194  mage update || die "update mage-tree"  if [[ ${MAGEUPDATE} = true ]]
195    then
196     if [[ ${MAGEUPDATETARBALL} = true ]]
197     then
198     MAGERC="${MAGERC}" mage update-tarball || die "update mage-tree"
199     else
200     MAGERC="${MAGERC}" mage update || die "update mage-tree"
201     fi
202    fi
203    
204  # now get the toolchain and the basesystem layout file  # now get the toolchain and the basesystem layout file
205  # [ -z "${TOOLCHAIN}" ] && TOOLCHAIN="toolchain.defaults"  # [ -z "${TOOLCHAIN}" ] && TOOLCHAIN="toolchain.defaults"
# Line 192  mage update || die "update mage-tree" Line 208  mage update || die "update mage-tree"
208  # TOOLCHAIN="$(< /etc/mage-profile/${TOOLCHAIN})"  # TOOLCHAIN="$(< /etc/mage-profile/${TOOLCHAIN})"
209  # BASESYSTEM="$(< /etc/mage-profile/${BASESYSTEM})"  # BASESYSTEM="$(< /etc/mage-profile/${BASESYSTEM})"
210    
211  # this way toolchain and basesytem can be packages;  # this way toolchain and basesystem can be packages;
212  # only if nothing set the layout files from the profile will be taken  # only if nothing set the layout files from the profile will be taken
213  [ -z "${TOOLCHAIN}" ] && TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)"  [ -z "${TOOLCHAIN}" ] && TOOLCHAIN="$(< ${MY_MAGEDIR}/profiles/${PROFILE}/toolchain.defaults)"
214  [ -z "${BASESYSTEM}" ] && BASESYSTEM="$(< /etc/mage-profile/basesystem.defaults)"  [ -z "${BASESYSTEM}" ] && BASESYSTEM="$(< ${MY_MAGEDIR}/profiles/${PROFILE}/basesystem.defaults)"
215    
216  # install toolchain  # install toolchain
217  CONFIG_PROTECT="-*" MROOT="${MROOT}" mage install ${TOOLCHAIN} || die "toolchain install"  CONFIG_PROTECT="-*" MROOT="${MROOT}" MAGERC="${MAGERC}" mage install ${TOOLCHAIN} || die "toolchain install"
218    
219  # umount dirs, they are not needed anymore  # umount dirs, they are not needed anymore
220  umount ${MY_MAGEDIR} ${MY_PKGDIR} || die "umount mage/pkgdir"  umount ${MY_MAGEDIR} ${MY_PKGDIR} || die "umount mage/pkgdir"
# Line 217  fi Line 233  fi
233    
234  # now create an initrc for the installation of the basesystem  # now create an initrc for the installation of the basesystem
235  :> ${MROOT}/.installrc  :> ${MROOT}/.installrc
236    add_initrc "export MAGE_BOOTSTRAP=true"
237  add_initrc "export HOME=/root"  add_initrc "export HOME=/root"
238  add_initrc "export PATH=/bin:/usr/bin:/sbin:/usr/sbin"  add_initrc "export PATH=/bin:/usr/bin:/sbin:/usr/sbin"
239  add_initrc "export BASESYSTEM=${BASESYSTEM}"  add_initrc "export BASESYSTEM=${BASESYSTEM}"
# Line 239  add_initrc "mage clean" Line 256  add_initrc "mage clean"
256  enter_chroot  enter_chroot
257    
258  echo "System bootstrap to '${MROOT}' finished."  echo "System bootstrap to '${MROOT}' finished."
   
259  exit 0  exit 0
   

Legend:
Removed from v.338  
changed lines
  Added in v.1487