From: Jean-Baptiste Boric Date: Tue, 11 Apr 2017 16:21:50 +0000 (+0200) Subject: Fix pkgin_cd.sh X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/howto.html?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F3497%2F2;p=minix.git Fix pkgin_cd.sh Change-Id: I513c16b0691897f3c665532d50ed398967f3e4d0 --- diff --git a/minix/commands/pkgin_cd/pkgin_cd.sh b/minix/commands/pkgin_cd/pkgin_cd.sh index 697d45192..c4a0341c8 100644 --- a/minix/commands/pkgin_cd/pkgin_cd.sh +++ b/minix/commands/pkgin_cd/pkgin_cd.sh @@ -4,41 +4,41 @@ # the installation CD-ROM. RC=/usr/etc/rc.package -CDMP=/mnt -CDPACK=${CDMP}/install/packages +CDPATH=packages/$(uname -r)/$(uname -m)/All PACKSUM=pkg_summary.bz2 -cdpackages="" -cdmounted="" +# Run user rc script if [ -f "$RC" ] -then . "$RC" +then + . "$RC" fi -# Is there a usable CD to install packages from? +# Mount CD if [ -n "$cddrive" ] -then pack=${cddrive}p2 - umount $pack >/dev/null 2>&1 || true - echo "Checking for CD in $pack." - if mount -r $pack $CDMP 2>/dev/null - then fn="$CDPACK/$PACKSUM" - echo "Found." - cdmounted=1 - cdpackages=$fn - if [ ! -f $cdpackages ] - then cdpackages="" - echo "No package summary found on CD in $fn." - exit 1 - fi - else echo "Not found." - exit 1 - fi -else echo "Don't know where the install CD is. You can set it in $RC." - exit 1 +then + if [ -z $(mount | grep 'on /mnt ') ] + then + echo "Mounting $cddrive on /mnt." + mount $cddrive /mnt + fi fi -# Set package repo to CD and populate package db -export PKG_REPOS=${CDPACK} -pkgin update +# Find package summary +for i in / /mnt +do + if [ -f $i/$CDPATH/$PACKSUM ] + then + (>&2 echo "Found package summary at $i/$CDPATH/$PACKSUM.") -# Run pkgin -pkgin $@ + # Set package repo to CD and populate package db + export PKG_REPOS=$i/$CDPATH/ + pkgin update + + # Run pkgin + exec pkgin $@ + fi +done + +echo "Can't find package summary. Please mount CD first at /mnt and make sure" +echo "that $CDPATH/$PACKSUM exists on the CD." +exit 1 diff --git a/minix/commands/setup/setup.sh b/minix/commands/setup/setup.sh index cdf80c5bb..2a7e76fe1 100644 --- a/minix/commands/setup/setup.sh +++ b/minix/commands/setup/setup.sh @@ -560,10 +560,6 @@ then ln -sf minix_default /mnt/boot/minix_latest fi chroot /mnt update_bootcfg -# Save name of CD drive -cddrive="`mount | fgrep ' /usr ' | awk '{ print $1 }' | sed 's/p.*//'`" -echo "cddrive=$cddrive" >>/mnt/usr/etc/rc.package - bios="`echo $primary | sed -e 's/d./dX/g' -e 's/c.//g'`" echo "Saving random data.." @@ -576,26 +572,19 @@ echo "" /bin/netconf -p /mnt || echo FAILED TO CONFIGURE NETWORK -PACKAGES_DIR="/usr/packages/$(uname -v | cut -f2 -d' ')/$(uname -p)/All" +PACKAGES_DIR="/packages/$(uname -v | cut -f2 -d' ')/$(uname -p)/All" if [ -e "$PACKAGES_DIR" ] then echo "Installing pkgin..." - sh -c "cp $PACKAGES_DIR/pkgin-* $PACKAGES_DIR/pkg_install-* $PACKAGES_DIR/libarchive-* /mnt/tmp && chroot /mnt pkg_add /tmp/pkgin-*" rm -f /mnt/tmp/* - if [ -f "$PACKAGES_DIR/pkg_summary.bz2" ] - then - echo "" - echo "Packages are bundled on this installation media." - echo "They are available under the directory $PACKAGES_DIR" - echo "To install them after rebooting, mount this CD, set PKG_PATH to this directory" - echo "and use pkg_add." - echo "If you mount the CD at /mnt, PKG_PATH should be:" - echo "/mnt$PACKAGES_DIR" - echo "" - fi + # Save name of CD drive + cddrive=$(mount | grep ' on / ' | cut -f1 -d' ') + echo "cddrive=$cddrive" >>/mnt/usr/etc/rc.package +else + echo "Package dir not found, skipping pkgin installation..." fi if [ "$nohome" = 0 ]; then