Jean-Baptiste Boric c1d4abeb0c Fix pkgin_cd.sh
Change-Id: I513c16b0691897f3c665532d50ed398967f3e4d0
2017-05-07 00:54:46 +02:00

45 lines
800 B
Bash

#!/bin/sh
# This script can be used to install packages from the
# the installation CD-ROM.
RC=/usr/etc/rc.package
CDPATH=packages/$(uname -r)/$(uname -m)/All
PACKSUM=pkg_summary.bz2
# Run user rc script
if [ -f "$RC" ]
then
. "$RC"
fi
# Mount CD
if [ -n "$cddrive" ]
then
if [ -z $(mount | grep 'on /mnt ') ]
then
echo "Mounting $cddrive on /mnt."
mount $cddrive /mnt
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
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