3 TAG
=`uname -p`-`uname -r`.
`uname -v`
4 PACKDIR
=`uname -p`/`uname -r`.
`uname -v`
8 CDPACK
=${CDMP}/install
/packages
9 CDSRC
=${CDMP}/install
/package-sources
11 LISTFILE
=/etc
/packages-
$TAG
12 LISTURL
=http
://www.minix3.org
/packages
/$PACKDIR/List
13 TMPDIR
=/usr
/tmp
/packages
15 URL1
=http
://www.minix3.org
/packages
/$PACKDIR
16 SRCURL1
=http
://www.minix3.org
/software
17 PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
19 # can we execute bunzip2?
20 if bunzip2
--help 2>&1 |
grep usage
>/dev
/null
22 else BUNZIP2
=smallbunzip2
25 if id | fgrep
"uid=0(" >/dev
/null
27 else echo "Please run $0 as root."
39 # Make sure there is a $SRC dir
41 then mkdir
$SRC ||
exit
44 # Is there a usable CD to install packages from?
47 then pack
=${cddrive}p2
48 umount
$pack >/dev
/null
2>&1 || true
49 echo "Checking for CD in $pack."
50 if mount
-r $pack $CDMP 2>/dev
/null
51 then fn
="$CDPACK/List"
54 if [ ! -f $cdpackages ]
56 echo "No package list found on CD in $fn."
58 else echo "Not found."
60 else echo "Don't know where the install CD is. You can set it in $RC."
65 rm -f $TMPDIR/.
* # Remove any remaining .postinstall script or .list*
67 # Check for network packages too
69 if ( : </dev
/tcp
) 2>/dev
/null
70 then echo -n "Update package list from network? (Y/n) "
72 if [ "$y" != n
-a "$y" != N
]
73 then echo "Fetching package list from $LISTURL."
74 urlget
$LISTURL >$TMPF && mv $TMPF $LISTFILE ||
echo "Update not successful."
77 if [ ! -f "$netpackages" -o ! `cat "$netpackages" 2>/dev/null | wc -l | awk '{ print $1 }'` -gt 1 ]
80 else echo "No working network detected."
83 # Is there at least one package type?
84 if [ ! -n "$netpackages" -a ! -n "$cdpackages" ]
85 then echo "No packages found."
89 # Is there more than one package type?
90 if [ -n "$netpackages" -a -n "$cdpackages" ]
91 then echo -n "Would you like to install from (C)D or (N)etwork? [C] "
93 if [ "$whichsrc" = N
-o "$whichsrc" = n
]
95 else unset netpackages
99 if [ -n "$netpackages" ]
105 while [ "$cont" = y
]
108 echo "Showing you a list of packages using more. Press q when"
109 echo "you want to leave the list."
110 echo -n "Press RETURN to continue.."
113 ( echo "No.|Package|Description"
115 if [ -f "$netpackages" -a "$source" = net
]
116 then cat $netpackages
118 if [ -f "$cdpackages" -a "$source" = cdrom
]
121 ) |
sort -f -t'|' +0 |
awk '{ n++; printf "%d|%s\n", n, $0 }'
123 highest
="`wc -l $TMPF | awk '{ print $1 - 1 }'`"
124 awk -F'|' <$TMPF '{ printf "%3s %-15s %s\n", $1, $2, $3 }' |
more
125 echo "Format examples: '3', '3,6', '3-9', '3-9,11-15', 'all'"
126 echo -n "Package(s) to install (RETURN or q to exit)? "
128 if [ "$packnolist" = "" -o "$packnolist" = "q" ]
131 if [ "$packnolist" = all
]
132 then packnolist
=1-$highest
136 echo -n "Get source(s) too? (y/N) "
138 for packrange
in $packnolist
149 # use awk to make the range list
150 for packno
in `awk </dev/null "BEGIN { for(i=$start; i<=$end; i++) { printf \"%d \", i } }"`
154 if [ "`grep -c $pat $TMPF`" -ne 1 ]
155 then if [ "$packno" ]
156 then echo "$packno: Wrong package number."
162 packagename
="`grep $pat $TMPF | awk -F'|' '{ print $2 }'`"
163 file=$packagename.
tar.bz2
168 then echo "Skipping $file - it's already in $TMPDIR."
169 echo "Remove that file if you want to re-retrieve and install this package."
172 net
*) echo "Retrieving $packno ($packagename) from primary location into $TMPDIR .."
174 if urlget
$URL1/$file >$file
175 then echo "Retrieved ok. Installing .."
176 packit
$file && echo Installed ok.
177 srcurl
=$SRCURL1/$file
178 else echo "Retrieval failed."
180 if [ "$getsources" = y
-o "$getsources" = Y
]
181 then ( cd $SRC ||
exit
182 srcfile
=${packagename}-src.
tar.bz2
183 echo "Retrieving source from $srcurl .."
184 urlget
$srcurl >$srcfile ||
exit
185 echo "Source retrieved in $SRC/$srcfile."
186 $BUNZIP2 -dc $srcfile |
tar xf
- >/dev
/null ||
exit
187 echo "Source unpacked in $SRC."
192 if [ -f $CDPACK/$file ]
193 then echo "Installing from $CDPACK/$file .."
194 packit
$CDPACK/$file && echo Installed ok.
195 else echo "$CDPACK/$file not found."
197 srcfile
=$CDSRC/${packagename}.
tar.bz2
198 if [ -f $srcfile -a "$getsources" = y
]
201 $BUNZIP2 -dc $srcfile |
tar xf
- ||
exit
202 echo "Source $srcfile unpacked in $SRC."
210 done # Iterate package range
211 done # Iterate package range list
214 rm -f $TMPDIR/.
* # Remove any remaining .postinstall script or .list*