xref: /minix/minix/commands/pkgin_cd/pkgin_cd.sh (revision 35b65c5a)
1#!/bin/sh
2
3# This script can be used to install packages from the
4# the installation CD-ROM.
5
6RC=/usr/etc/rc.package
7CDPATH=packages/$(uname -r)/$(uname -m)/All
8PACKSUM=pkg_summary.bz2
9
10# Run user rc script
11if [ -f "$RC" ]
12then
13	. "$RC"
14fi
15
16# Mount CD
17if [ -n "$cddrive" ]
18then
19	if [ -z $(mount | grep 'on /mnt ') ]
20	then
21		echo "Mounting $cddrive on /mnt."
22		mount $cddrive /mnt
23	fi
24fi
25
26# Find package summary
27for i in / /mnt
28do
29	if [ -f $i/$CDPATH/$PACKSUM ]
30	then
31		(>&2 echo "Found package summary at $i/$CDPATH/$PACKSUM.")
32
33		# Set package repo to CD and populate package db
34		export PKG_REPOS=$i/$CDPATH/
35		pkgin update
36
37		# Run pkgin
38		exec pkgin $@
39	fi
40done
41
42echo "Can't find package summary. Please mount CD first at /mnt and make sure"
43echo "that $CDPATH/$PACKSUM exists on the CD."
44exit 1
45