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
43 if [ -n "$cdmounted" -a -n "$pack" ]
51 # can we execute bunzip2?
52 if bunzip2
--help 2>&1 |
grep usage
>/dev
/null
54 else BUNZIP2
=smallbunzip2
57 if id | fgrep
"uid=0(" >/dev
/null
59 else echo "Please run $0 as root."
71 # Make sure there is a $SRC dir
73 then mkdir
$SRC || myexit
1
76 # Is there a usable CD to install packages from?
78 then pack
=${cddrive}p2
79 umount
$pack >/dev
/null
2>&1 || true
80 echo "Checking for CD in $pack."
81 if mount
-r $pack $CDMP 2>/dev
/null
82 then fn
="$CDPACK/List"
86 if [ ! -f $cdpackages ]
88 echo "No package list found on CD in $fn."
90 else echo "Not found."
92 else echo "Don't know where the install CD is. You can set it in $RC."
97 rm -f $TMPDIR/.
* # Remove any remaining .postinstall script or .list*
99 # Check for network packages too
100 if ( : </dev
/tcp
) 2>/dev
/null
101 then echo -n "Update package list from network? (Y/n) "
103 if [ "$y" != n
-a "$y" != N
]
104 then echo "Fetching package list from $LISTURL."
105 urlget
$LISTURL >$TMPF && mv $TMPF $LISTFILE ||
echo "Update not successful."
107 netpackages
=$LISTFILE
108 if [ ! -f "$netpackages" -o ! `cat "$netpackages" 2>/dev/null | wc -l | awk '{ print $1 }'` -gt 1 ]
111 else echo "No working network detected."
114 # Is there at least one package type?
115 if [ ! -n "$netpackages" -a ! -n "$cdpackages" ]
116 then echo "No packages found."
120 # Is there more than one package type?
121 if [ -n "$netpackages" -a -n "$cdpackages" ]
122 then echo -n "Would you like to install from (C)D or (N)etwork? [C] "
124 if [ "$whichsrc" = N
-o "$whichsrc" = n
]
125 then unset cdpackages
126 else unset netpackages
130 if [ -n "$netpackages" ]
136 while [ "$cont" = y
]
139 echo "Showing you a list of packages using $PAGER. Press q when"
140 echo "you want to leave the list."
141 echo -n "Press RETURN to continue.."
144 ( echo "No.|Package|Description"
146 if [ -f "$netpackages" -a "$source" = net
]
147 then cat $netpackages
149 if [ -f "$cdpackages" -a "$source" = cdrom
]
152 ) |
sort -f -t'|' +0 |
awk '{ n++; printf "%d|%s\n", n, $0 }'
154 highest
="`wc -l $TMPF | awk '{ print $1 - 1 }'`"
155 awk -F'|' <$TMPF '{ printf "%3s %-15s %s\n", $1, $2, $3 }' |
$PAGER
156 echo "Format examples: '3', '3,6', '3-9', '3-9,11-15', 'all'"
157 echo -n "Package(s) to install (RETURN or q to exit)? "
159 if [ "$packnolist" = "" -o "$packnolist" = "q" ]
162 if [ "$packnolist" = all
]
163 then packnolist
=1-$highest
167 echo -n "Get source(s) too? (y/N) "
169 for packrange
in $packnolist
180 # use awk to make the range list
181 for packno
in `awk </dev/null "BEGIN { for(i=$start; i<=$end; i++) { printf \"%d \", i } }"`
185 if [ "`grep -c $pat $TMPF`" -ne 1 ]
186 then if [ "$packno" ]
187 then echo "$packno: Wrong package number."
193 packagename
="`grep $pat $TMPF | awk -F'|' '{ print $2 }'`"
194 file=$packagename.
tar.bz2
198 if [ -f $file -a ! "$YESMODE" ]
199 then echo "Skipping $file - it's already in $TMPDIR."
200 echo "Remove that file if you want to re-retrieve and install this package."
203 net
*) echo "Retrieving $packno ($packagename) from primary location into $TMPDIR .."
205 if urlget
$URL1/$file >$file
206 then echo "Retrieved ok. Installing .."
207 packit
$file && echo Installed ok.
208 srcurl
=$SRCURL1/$file
209 else echo "Retrieval failed."
211 if [ "$getsources" = y
-o "$getsources" = Y
]
212 then ( cd $SRC || myexit
2
213 srcfile
=${packagename}-src.
tar.bz2
214 echo "Retrieving source from $srcurl .."
215 urlget
$srcurl >$srcfile || myexit
3
216 echo "Source retrieved in $SRC/$srcfile."
217 $BUNZIP2 -dc $srcfile |
tar xf
- >/dev
/null || myexit
3
218 echo "Source unpacked in $SRC."
223 if [ -f $CDPACK/$file ]
224 then echo "Installing from $CDPACK/$file .."
225 packit
$CDPACK/$file && echo Installed ok.
226 else echo "$CDPACK/$file not found."
228 srcfile
=$CDSRC/${packagename}.
tar.bz2
229 if [ -f $srcfile -a "$getsources" = y
]
231 ( cd $SRC || myexit
2
232 $BUNZIP2 -dc $srcfile |
tar xf
- || myexit
3
233 echo "Source $srcfile unpacked in $SRC."
241 done # Iterate package range
242 done # Iterate package range list
245 rm -f $TMPDIR/.
* # Remove any remaining .postinstall script or .list*