# 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
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.."
/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