Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
authorMichael Neumann <mneumann@ntecs.de>
Fri, 9 Jan 2009 16:37:56 +0000 (17:37 +0100)
committerMichael Neumann <mneumann@ntecs.de>
Fri, 9 Jan 2009 16:37:56 +0000 (17:37 +0100)
1  2 
nrelease/Makefile

diff --combined nrelease/Makefile
@@@ -133,7 -133,9 +133,7 @@@ ROOTSKELS+=                ${.CURDIR}/gu
  ISOFILE ?= ${ISODIR}/dfly.iso
  IMGFILE ?= ${ISODIR}/dfly.img
  
 -IMGMNT ?= /mnt
 -IMGSIZE ?= 450
 -IMGVN ?= vn0
 +IMGMNT ?= ${ISODIR}/mnt
  IMGUSBDEV ?= /dev/da0
  
  # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
@@@ -289,16 -291,19 +289,19 @@@ customizeiso
                     periodic/monthly/Makefile
        cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
  .endfor
+       # There seems to be no reliable way to install a package to a target
+       # directory prefix so we mount_null our package directory into the
+       # ISO root and do the install chrooted.
+       #
+       mkdir ${ISOROOT}/tmp/packages
+       mount_null -o ro ${PKGSRC_PKG_PATH} ${ISOROOT}/tmp/packages
  .for PKG in ${PKGSRC_PACKAGES}
-       ${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
+       ${ENVCMD} PKG_PATH=/tmp/packages chroot ${ISOROOT} ${PKGBIN_PKG_ADD} ${PKG}
  .endfor
+       umount ${ISOROOT}/tmp/packages
+       rmdir ${ISOROOT}/tmp/packages
        find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
-       ${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
- .if defined(WITH_GUI)
- .for FONT in 75dpi 100dpi misc Type1 TTF
-       chroot ${ISOROOT} /usr/pkg/bin/mkfontdir /usr/pkg/lib/X11/fonts/${FONT}
- .endfor
- .endif
+       chroot ${ISOROOT} ${PKGBIN_PKG_ADMIN} rebuild
        makewhatis ${ISOROOT}/usr/local/man
        makewhatis ${ISOROOT}/usr/pkg/man
  
@@@ -316,42 -321,40 +319,43 @@@ mkiso
  
  mkimg:
  .if defined(WITH_IMG)
 -      dd if=/dev/zero of=${IMGFILE} bs=1m count=${IMGSIZE}
 -      fdisk -IB -p ${IMGFILE}
 -      vnconfig -e -s labels ${IMGVN} ${IMGFILE}
 -      # write standard disklabel
 -      disklabel -w -r ${IMGVN}s1 auto
 -      # read back disklabel
 -      disklabel -r ${IMGVN}s1 > ${IMGFILE}.label
 -      # determine number of sectors of whole disk
 -      # and add a: partition
 -      ( secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w` && \
 -        echo "  a:  $${secs} 0 4.2BSD" >> ${IMGFILE}.label )
 -      # write modified disklabel back
 -      disklabel -R -r ${IMGVN}s1 ${IMGFILE}.label
 -      # write bootsector
 -      disklabel -B ${IMGVN}s1 
 -      newfs /dev/${IMGVN}s1a
 -      mount  /dev/${IMGVN}s1a ${IMGMNT}
 -
 -      cpdup -vvv ${ISOROOT} ${IMGMNT}
 -
 -      #
 -      # fix /etc/fstab
 -      #
 -      mv ${IMGMNT}/etc/fstab ${IMGMNT}/etc/fstab.old 
 -      cat ${IMGMNT}/etc/fstab.old | grep -v "cd9660" > ${IMGMNT}/etc/fstab
 -      echo "${IMGUSBDEV}s1a / ufs rw 0 0" >> ${IMGMNT}/etc/fstab
 -      rm ${IMGMNT}/etc/fstab.old
 -
 -      umount ${IMGMNT}
 -      vnconfig -u ${IMGVN}
 +      if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
 +
 +      echo "determine required image size" > /dev/null;               \
 +      sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`;                  \
 +      echo "add 10 MB more space as required" > /dev/null;            \
 +      sz=`bc -e "($${sz}) / 1024 + 10" -equit`;                       \
 +      dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz};               \
 +      fdisk -IB -p ${IMGFILE};                                        \
 +      echo "determine free vn device" > /dev/null;                    \
 +      vn=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
 +      vnconfig -e -s labels $${vn} ${IMGFILE};                        \
 +      echo "write standard disklabel" > /dev/null;                    \
 +      disklabel -w -r $${vn}s1 auto;                                  \
 +      echo "read disklabel back" > /dev/null;                         \
 +      disklabel -r $${vn}s1 > ${IMGFILE}.label;                       \
 +      echo "determine number of sectors of whole disk" > /dev/null;   \
 +      secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`;                \
 +      echo "and add a: partition" > /dev/null;                        \
 +      echo "  a:  $${secs} 0 4.2BSD" >> ${IMGFILE}.label;             \
 +      echo "write modified disklabel back" > /dev/null;               \
 +      disklabel -R -r $${vn}s1 ${IMGFILE}.label;                      \
 +      rm ${IMGFILE}.label;                                            \
 +      echo "write bootsector" >  /dev/null;                           \
 +      disklabel -B $${vn}s1;                                          \
 +      newfs /dev/$${vn}s1a;                                           \
 +      mount /dev/$${vn}s1a ${IMGMNT};                                 \
 +      cpdup -vvv ${ISOROOT} ${IMGMNT};                                \
 +      echo "fix /etc/fstab" > /dev/null;                              \
 +      echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab;      \
 +      echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab;         \
 +      umount ${IMGMNT};                                               \
 +      vnconfig -u $${vn};                                             \
 +      rmdir ${IMGMNT}
  .endif
  
  clean:
+       -umount ${ISOROOT}/tmp/packages
        if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
        if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
        if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi