Fix pkgin_cd.sh

Change-Id: I513c16b0691897f3c665532d50ed398967f3e4d0
This commit is contained in:
Jean-Baptiste Boric 2017-04-11 18:21:50 +02:00 committed by David van Moolenbroek
parent 66e071a40c
commit c1d4abeb0c
2 changed files with 35 additions and 46 deletions

View File

@ -4,41 +4,41 @@
# the installation CD-ROM. # the installation CD-ROM.
RC=/usr/etc/rc.package RC=/usr/etc/rc.package
CDMP=/mnt CDPATH=packages/$(uname -r)/$(uname -m)/All
CDPACK=${CDMP}/install/packages
PACKSUM=pkg_summary.bz2 PACKSUM=pkg_summary.bz2
cdpackages=""
cdmounted=""
# Run user rc script
if [ -f "$RC" ] if [ -f "$RC" ]
then . "$RC" then
. "$RC"
fi fi
# Is there a usable CD to install packages from? # Mount CD
if [ -n "$cddrive" ] if [ -n "$cddrive" ]
then pack=${cddrive}p2 then
umount $pack >/dev/null 2>&1 || true if [ -z $(mount | grep 'on /mnt ') ]
echo "Checking for CD in $pack." then
if mount -r $pack $CDMP 2>/dev/null echo "Mounting $cddrive on /mnt."
then fn="$CDPACK/$PACKSUM" mount $cddrive /mnt
echo "Found."
cdmounted=1
cdpackages=$fn
if [ ! -f $cdpackages ]
then cdpackages=""
echo "No package summary found on CD in $fn."
exit 1
fi 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
fi fi
# Find package summary
for i in / /mnt
do
if [ -f $i/$CDPATH/$PACKSUM ]
then
(>&2 echo "Found package summary at $i/$CDPATH/$PACKSUM.")
# Set package repo to CD and populate package db # Set package repo to CD and populate package db
export PKG_REPOS=${CDPACK} export PKG_REPOS=$i/$CDPATH/
pkgin update pkgin update
# Run pkgin # Run pkgin
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

View File

@ -560,10 +560,6 @@ then ln -sf minix_default /mnt/boot/minix_latest
fi fi
chroot /mnt update_bootcfg 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'`" bios="`echo $primary | sed -e 's/d./dX/g' -e 's/c.//g'`"
echo "Saving random data.." echo "Saving random data.."
@ -576,26 +572,19 @@ echo ""
/bin/netconf -p /mnt || echo FAILED TO CONFIGURE NETWORK /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" ] if [ -e "$PACKAGES_DIR" ]
then then
echo "Installing pkgin..." echo "Installing pkgin..."
sh -c "cp $PACKAGES_DIR/pkgin-* $PACKAGES_DIR/pkg_install-* $PACKAGES_DIR/libarchive-* /mnt/tmp && sh -c "cp $PACKAGES_DIR/pkgin-* $PACKAGES_DIR/pkg_install-* $PACKAGES_DIR/libarchive-* /mnt/tmp &&
chroot /mnt pkg_add /tmp/pkgin-*" chroot /mnt pkg_add /tmp/pkgin-*"
rm -f /mnt/tmp/* rm -f /mnt/tmp/*
if [ -f "$PACKAGES_DIR/pkg_summary.bz2" ] # Save name of CD drive
then cddrive=$(mount | grep ' on / ' | cut -f1 -d' ')
echo "" echo "cddrive=$cddrive" >>/mnt/usr/etc/rc.package
echo "Packages are bundled on this installation media." else
echo "They are available under the directory $PACKAGES_DIR" echo "Package dir not found, skipping pkgin installation..."
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
fi fi
if [ "$nohome" = 0 ]; then if [ "$nohome" = 0 ]; then