summaryrefslogtreecommitdiff
path: root/minix/commands/pkgin_cd/pkgin_cd.sh
blob: c4a0341c8b540bca14d174fbee3fc5e31c53911e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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