CVS: src/si/rpm Configure.sh,1.3,1.4 Makefile,1.2,1.3 umlsi.sh,1.3,1.4 umlsi.spec,1.1,1.2

Mats Wichmann <[email protected]>
Newsgroups gmane.linux.lsb.implementation
Message-ID <[email protected]>
Update of /cvsroot/lsb/src/si/rpm
In directory sc8-pr-cvs1:/tmp/cvs-serv13981

Modified Files:
	Configure.sh Makefile umlsi.sh umlsi.spec 
Log Message:
Assorted changes.  Move config file to /etc/opt/lsb-umlsi. Add
error handling and memory setup to Configure.


Index: Configure.sh
===================================================================
RCS file: /cvsroot/lsb/src/si/rpm/Configure.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Configure.sh	27 Jan 2003 22:58:38 -0000	1.3
--- Configure.sh	6 Feb 2003 13:52:42 -0000	1.4
***************
*** 6,18 ****
  BIN=/opt/lsb-umlsi/bin
  DATA=/var/opt/lsb-umlsi
! CONFIG=${DATA}/config.status
  MNT=/mnt/umlsi
  LOOPDEV=/dev/loop0
  LOOPDEV2=/dev/loop1
  LOOPDEV3=/dev/loop2
  FSTAB=$MNT/etc/fstab
  
! #XXX need a trap-and-cleanup!!!
! 
  
  # if we have a saved config file, use settings from it as defaults. 
--- 6,25 ----
  BIN=/opt/lsb-umlsi/bin
  DATA=/var/opt/lsb-umlsi
! CONFIG=/etc/opt/lsb-umlsi/config.status
  MNT=/mnt/umlsi
  LOOPDEV=/dev/loop0
  LOOPDEV2=/dev/loop1
  LOOPDEV3=/dev/loop2
+ TMPTAB=/var/tmp/$$_fstab
  FSTAB=$MNT/etc/fstab
  
! cleanup() {
! 	trap - 0 1 2 3 13 15
! 	if [ $1 != 0 ] ; then echo -e "\nAborting, no changes saved" >&2 ; fi
! 	umount ${MNT} > /dev/null 2>&1
! 	losetup -d ${LOOPDEV} > /dev/null 2>&1
! 	losetup -d {LOOPDEV2} > /dev/null 2>&1
! 	exit $1
! }
  
  # if we have a saved config file, use settings from it as defaults. 
***************
*** 20,23 ****
--- 27,31 ----
  #
  if [ -f ${CONFIG} ] ; then
+ 	echo "Previous configuration found, using for defaults"
  	. ${CONFIG}
  else
***************
*** 35,46 ****
  
  	use_hostfs='y'
  fi
  
  
  # 0. setup root_fs so it can be modified
  #
! losetup ${LOOPDEV} ${LIB}/root_fs
  if [ $? -ne 0 ] ; then
!     losetup ${LOOPDEV2} ${LIB}/root_fs
      if [ $? -ne 0 ] ; then
  	echo "Fatal error: loopback devices ${LOOPDEV} and ${LOOPDEV2} not available" >&2
--- 43,61 ----
  
  	use_hostfs='y'
+ 
+ 	ram_size=128
  fi
  
+ trap 'cleanup 1' 0 1 2 3 13 15
  
  # 0. setup root_fs so it can be modified
  #
! if [ ! -f ${LIB}/root_fs ] ; then
!     echo "Fatal Error: cannot find ${LIB}/root_fs" >&2
!     exit 1
! fi
! losetup ${LOOPDEV} ${LIB}/root_fs > /dev/null 2>&1
  if [ $? -ne 0 ] ; then
!     losetup ${LOOPDEV2} ${LIB}/root_fs > /dev/null 2>&1
      if [ $? -ne 0 ] ; then
  	echo "Fatal error: loopback devices ${LOOPDEV} and ${LOOPDEV2} not available" >&2
***************
*** 56,62 ****
  if [ $? -ne 0 ] ; then
      echo "Fatal error: mounting of ${LOOPDEV} on ${MNT} failed" >&2
!     exit 1
  fi
  
  
  # 1. (optional) swap - 64 meg suggested
--- 71,82 ----
  if [ $? -ne 0 ] ; then
      echo "Fatal error: mounting of ${LOOPDEV} on ${MNT} failed" >&2
!     cleanup 1
  fi
  
+ echo "# Begin /etc/fstab" > $TMPTAB
+ echo "# Generated by /opt/lsb-umlsi/bin/Configure" >> $TMPTAB
+ echo "/dev/ubd0	/		ext3	defaults 1 1" >> $TMPTAB
+ echo "/proc		/proc		proc	defaults" >> $TMPTAB
+ echo "devpts		/dev/pts	devpts	mode=0620 0 0" >> $TMPTAB
  
  # 1. (optional) swap - 64 meg suggested
***************
*** 64,79 ****
  echo -n "Use a swap device [ ${use_swap} ] "
  read input
! if [ -z ${input} ]; then
!     input=${use_swap}
! fi
  use_swap=${input}
  if [ ${use_swap} = 'y' ] ; then
      make='n'
      if [ -f ${swapdev} ] ; then
! 	echo -n "swap device ${swapdev} exists, reuse (y for yes)? "
  	read input
! 	if [ ${input} != 'y' ] ; then
! 	    make='y'
! 	fi
      else
  	make='y'
--- 84,96 ----
  echo -n "Use a swap device [ ${use_swap} ] "
  read input
! if [ -z ${input} ]; then input=${use_swap} ; fi
  use_swap=${input}
  if [ ${use_swap} = 'y' ] ; then
      make='n'
      if [ -f ${swapdev} ] ; then
! 	echo -n "swap device ${swapdev} exists, reuse [ y ] "
  	read input
! 	if [ -z ${input} ]; then input='y' ; fi
! 	if [ ${input} != 'y' ] ; then make='y' ; fi
      else
  	make='y'
***************
*** 82,94 ****
  	echo -n "swap device [ $swapdev ] "
  	read input
! 	if [ -z $input ]; then
! 	    input=$swapdev
! 	fi
  	swapdev=${input}
  	echo -n "swap size in MB [ $swap_size ] "
  	read input
! 	if [ -z ${input} ]; then
! 	    input=${swap_size}
! 	fi
  	swap_size=${input}
  	rm ${swapdev} 2> /dev/null
--- 99,107 ----
  	echo -n "swap device [ $swapdev ] "
  	read input
! 	if [ -z $input ]; then input=$swapdev ; fi
  	swapdev=${input}
  	echo -n "swap size in MB [ $swap_size ] "
  	read input
! 	if [ -z ${input} ]; then input=${swap_size} ; fi
  	swap_size=${input}
  	rm ${swapdev} 2> /dev/null
***************
*** 96,100 ****
  	mkswap ${swapdev}
      fi
!     echo "/dev/ubd1       none            swap    sw" >> $FSTAB
  fi
  
--- 109,113 ----
  	mkswap ${swapdev}
      fi
!     echo "/dev/ubd1       none            swap    sw" >> $TMPTAB
  fi
  
***************
*** 104,119 ****
  echo -n "Use a separate /home [ ${use_home} ] "
  read input
! if [ -z ${input} ]; then
!     input=${use_home}
! fi
  use_home=${input}
  if [ ${use_home} = 'y' ] ; then
      make='n'
      if [ -f ${homedev} ] ; then
! 	echo -n "home device ${homedev} exists, reuse (y for yes)? "
  	read input
! 	if [ ${input} != 'y' ] ; then
! 	    make='y'
! 	fi
      else
  	make='y'
--- 117,129 ----
  echo -n "Use a separate /home [ ${use_home} ] "
  read input
! if [ -z ${input} ]; then input=${use_home} ; fi
  use_home=${input}
  if [ ${use_home} = 'y' ] ; then
      make='n'
      if [ -f ${homedev} ] ; then
! 	echo -n "home device ${homedev} exists, reuse [ y ] "
  	read input
! 	if [ -z ${input} ]; then input='y' ; fi
! 	if [ ${input} != 'y' ] ; then make='y' ; fi
      else
  	make='y'
***************
*** 122,134 ****
  	echo -n "home device [ $homedev ] "
  	read input
! 	if [ -z ${input} ]; then
! 	    input=$homedev
! 	fi
  	homedev=${input}
  	echo -n "home size in MB (suggest 128 if installing lsb-runtime-test) [ ${home_size} ] "
  	read input
! 	if [ -z ${input} ]; then
! 	    input=${home_size}
! 	fi
  	home_size=${input}
  	rm ${homedev} 2> /dev/null
--- 132,140 ----
  	echo -n "home device [ $homedev ] "
  	read input
! 	if [ -z ${input} ]; then input=$homedev ; fi
  	homedev=${input}
  	echo -n "home size in MB (suggest 128 if installing lsb-runtime-test) [ ${home_size} ] "
  	read input
! 	if [ -z ${input} ]; then input=${home_size} ; fi
  	home_size=${input}
  	rm ${homedev} 2> /dev/null
***************
*** 139,143 ****
  	losetup -d ${LOOPDEV2}
      fi
!     echo "/dev/ubd2       /home           ext3    defaults 1 2" >> $FSTAB
  fi
  
--- 145,149 ----
  	losetup -d ${LOOPDEV2}
      fi
!     echo "/dev/ubd2       /home           ext3    defaults 1 2" >> $TMPTAB
  fi
  
***************
*** 147,162 ****
  echo -n "Use a separate /opt [ ${use_opt} ] "
  read input
! if [ -z ${input} ]; then
!     input=${use_opt}
! fi
  use_opt=${input}
  if [ ${use_opt} = 'y' ] ; then
      make='n'
      if [ -f ${optdev} ] ; then
! 	echo -n "opt device ${optdev} exists, reuse (y for yes)?"
  	read input
! 	if [ ${input} != 'y' ] ; then
! 	    make='y'
! 	fi
      else
  	make='y'
--- 153,165 ----
  echo -n "Use a separate /opt [ ${use_opt} ] "
  read input
! if [ -z ${input} ]; then input=${use_opt} ; fi
  use_opt=${input}
  if [ ${use_opt} = 'y' ] ; then
      make='n'
      if [ -f ${optdev} ] ; then
! 	echo -n "opt device ${optdev} exists, reuse [ y ] "
  	read input
! 	if [ -z ${input} ]; then input='y' ; fi
! 	if [ ${input} != 'y' ] ; then make='y' ; fi
      else
  	make='y'
***************
*** 165,177 ****
  	echo -n "opt device [ $optdev ] "
  	read input
! 	if [ -z ${input} ]; then
! 	    input=$optdev
! 	fi
  	optdev=${input}
  	echo -n "opt size in MB [ $opt_size ] "
  	read input
! 	if [ -z ${input} ]; then
! 	    input=${opt_size}
!     fi
  	opt_size=${input}
  	rm ${optdev} 2> /dev/null
--- 168,176 ----
  	echo -n "opt device [ $optdev ] "
  	read input
! 	if [ -z ${input} ]; then input=$optdev ; fi
  	optdev=${input}
  	echo -n "opt size in MB [ $opt_size ] "
  	read input
! 	if [ -z ${input} ]; then input=${opt_size} ; fi
  	opt_size=${input}
  	rm ${optdev} 2> /dev/null
***************
*** 182,186 ****
  	losetup -d ${LOOPDEV2}
      fi
!     echo "/dev/ubd3       /opt            ext3    defaults 1 2" >> $FSTAB
  fi
  
--- 181,185 ----
  	losetup -d ${LOOPDEV2}
      fi
!     echo "/dev/ubd3       /opt            ext3    defaults 1 2" >> $TMPTAB
  fi
  
***************
*** 190,215 ****
  echo -n "Mount the host's filesystem as /mnt/host [ ${use_hostfs} ] "
  read input
! if [ -z ${input} ]; then
! 	input=${use_hostfs}
! fi
  use_hostfs=${input}
  if [ ${use_hostfs} = 'y' ] ; then
!     mkdir ${MNT}/mnt/disk
!     echo "none            /mnt/disk       hostfs  defaults" >> $FSTAB
  fi
  
  
! # 5. (optional) add networking
  # XXX
  
  
! # 6. clean up the mount
! #
! umount ${MNT}
! losetup -d ${LOOPDEV}
  
  
! # 7. save the settings to the config.status file
  #
  echo "# uml-si configuration file" > ${CONFIG}
  echo "#" `date` >> ${CONFIG}
--- 189,220 ----
  echo -n "Mount the host's filesystem as /mnt/host [ ${use_hostfs} ] "
  read input
! if [ -z ${input} ]; then input=${use_hostfs} ; fi
  use_hostfs=${input}
  if [ ${use_hostfs} = 'y' ] ; then
!     if [ ! -d $MNT/mnt/disk ] ; then mkdir $MNT/mnt/disk ; fi
!     echo "none            /mnt/disk       hostfs  defaults" >> $TMPTAB
  fi
  
  
! # 5. prompt for RAM size
! #
! echo -n "RAM size in MB (suggest 128) [ $ram_size ] "
! read input
! if [ -z ${input} ]; then input=${ram_size} ; fi
! ram_size=${input}
! 
! 
! # 6. (optional) add networking
  # XXX
  
  
! # 7. move over the new fstab file
! echo "# End /etc/fstab" >> ${TMPTAB}
! mv ${TMPTAB} ${FSTAB}
  
  
! # 8. save the settings to the config.status file
  #
+ echo "Saving configuration to ${CONFIG}"
  echo "# uml-si configuration file" > ${CONFIG}
  echo "#" `date` >> ${CONFIG}
***************
*** 224,225 ****
--- 229,233 ----
  echo "optdev=${optdev}" >> ${CONFIG}
  echo "use_hostfs=${use_hostfs}" >> ${CONFIG}
+ echo "ram_size=${ram_size}" >> ${CONFIG}
+ 
+ cleanup 0

Index: Makefile
===================================================================
RCS file: /cvsroot/lsb/src/si/rpm/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Makefile	27 Jan 2003 22:17:23 -0000	1.2
--- Makefile	6 Feb 2003 13:52:42 -0000	1.3
***************
*** 10,13 ****
--- 10,14 ----
  	@mkdir -p ${BUILDROOT}/opt/lsb-umlsi/lib
  	@mkdir -p ${BUILDROOT}/opt/lsb-umlsi/bin
+ 	@mkdir -p ${BUILDROOT}/etc/opt/lsb-umlsi/lib
  	@mkdir -p ${BUILDROOT}/var/opt/lsb-umlsi/lib
  	@cp Configure.sh ${BUILDROOT}/opt/lsb-umlsi/bin/Configure

Index: umlsi.sh
===================================================================
RCS file: /cvsroot/lsb/src/si/rpm/umlsi.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** umlsi.sh	30 Jan 2003 16:50:21 -0000	1.3
--- umlsi.sh	6 Feb 2003 13:52:42 -0000	1.4
***************
*** 6,15 ****
  LIB=/opt/lsb-umlsi/lib
  DATA=/var/opt/lsb-umlsi
  
! if [ -f ${DATA}/config.status ] ; then
! 	. ${DATA}/config.status
  else
! 	echo "The LSB-si UML environment is not configured. Running $BIN/Configure"
! 	echo "when complete, please rerun this program"
  	exec ${BIN}/Configure
  fi
--- 6,17 ----
  LIB=/opt/lsb-umlsi/lib
  DATA=/var/opt/lsb-umlsi
+ CONFIG=/etc/opt/lsb-umlsi/config.status
  
! if [ -f ${CONFIG} ] ; then
! 	. ${CONFIG}
  else
! 	echo "The LSB-si UML environment is not configured."
! 	echo "Running $BIN/Configure"
! 	echo "When complete, please rerun this program"
  	exec ${BIN}/Configure
  fi
***************
*** 25,28 ****
--- 27,32 ----
      CMD="${CMD} ubd3=${optdev}"
  fi
+ if [ "_${mem_size}" = "_" ] ; then mem_size=128 ; fi
+ CMD="${CMD} mem=${mem_size}M"
  
  #XXX add networking setup here
***************
*** 32,39 ****
  #   in /etc/inittab (to /dev/vc/#, I think), and to the naming
  #   of the ubd devices which will be /dev/ubd/# instead of /dev/ubd#
! # mem= should probably be prompted for; default is about 30M which
! #   is too small to do anything useful, 128M was picked out of a hat...
! 
! CMD="${CMD} devfs=nomount mem=128M"
  
  exec ${CMD}
--- 36,40 ----
  #   in /etc/inittab (to /dev/vc/#, I think), and to the naming
  #   of the ubd devices which will be /dev/ubd/# instead of /dev/ubd#
! CMD="${CMD} devfs=nomount"
  
  exec ${CMD}

Index: umlsi.spec
===================================================================
RCS file: /cvsroot/lsb/src/si/rpm/umlsi.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** umlsi.spec	25 Jan 2003 17:07:46 -0000	1.1
--- umlsi.spec	6 Feb 2003 13:52:42 -0000	1.2
***************
*** 3,8 ****
  Version: 1.3
  Release: 1
! Copyright: FSG
! Group: DevelopmentTools
  Requires: user_mode_linux
  Buildroot: /var/tmp/lsb-umlsi-root
--- 3,9 ----
  Version: 1.3
  Release: 1
! Vendor: Free Standards Group
! License: Artistic
! Group: Development Tools
  Requires: user_mode_linux
  Buildroot: /var/tmp/lsb-umlsi-root
***************
*** 28,30 ****
--- 29,32 ----
  
  /opt/lsb-umlsi
+ /etc/opt/lsb-umlsi
  /var/opt/lsb-umlsi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.