pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / scripts / easypack.sh
bloba04f6dc743e54f8e81109201d8674416e842d58b
1 #!/bin/sh
3 # This script gets and installs a package from the Website.
4 # It is called by easypack package1 ...
5 # A package must be in the form of pack.tar.bz2 and must
6 # include a build script that makes and installs it.
7 # The build script should succeed if installation works, else fail
9 # Examples:
10 # easypack awk elle telnet # fetch and install 3 packages
11 # easypack -o awk elle telnet # fetch and replace existing packs
13 SOURCE_DIR=/usr/local/src # where the source is deposited
14 OVERWRITE=0 # can an installed package be overwritten?
15 SOFTWARE_DIR="http://www.minix3.org/software"
18 # Check for at least one parameter
19 case $# in
20 0) echo Usage: $0 package ...
21 exit ;;
22 esac
24 # Change to source directory
25 ORIG_DIR=`pwd`
26 rm -f Log # remove old debugging log
27 mkdir $SOURCE_DIR || true
28 cd $SOURCE_DIR || exit
30 if [ "`id -u`" -ne 0 ]
31 then
32 # Check for write permission here
33 if test ! -w .
34 then echo You do not have write permission for $SOURCE_DIR
35 exit 1
39 # Check for -o flag; if found, set OVERWRITE
40 if test $1 = "-o"
41 then OVERWRITE=1
42 shift
45 # Loop on the packages
46 for i
47 do # Check to see if it exists. Don't overwrite unless -o given
48 echo " " ; echo Start fetching package $i
49 echo " " >>$ORIG_DIR/Log
50 echo ------------- Start fetching $i ------------------ >>$ORIG_DIR/Log
51 if test -r $i
52 then # Directory already exists. May it be overwritten?
53 if test $OVERWRITE = 0
54 then echo $i already exists. Skipping this package
55 continue
56 else # Remove the directory
57 rm -rf $i
58 echo Existing directory $i removed
62 # Remove any junk from previous attempts
63 rm -f $i.tar.bz2 $i.tar
65 # Get the package
66 URL=$SOFTWARE_DIR/$i.tar.bz2
67 TARBZ=$i.tar.bz2
68 if urlget $URL >$TARBZ 2>/dev/null
69 then :
70 else
71 echo Cannot get $i.
72 echo " " Tried $URL
73 echo " " Skipping this package
74 rm -f $TARBZ
75 continue
78 # We got it. Unpack it.
79 echo Package $i fetched
80 bunzip2 $TARBZ || smallbunzip2 $TARBZ
81 pax -r <$i.tar
82 if test ! -d $i
83 then echo Unable to unpack $i
84 continue
85 else echo Package $i unpacked
88 # It is now unpacked. Build it
89 cd $i
90 binsizes big
91 if [ -f build.minix ]
92 then sh build.minix >>$ORIG_DIR/Log 2>&1
93 r=$?
94 else sh build >>$ORIG_DIR/Log 2>&1
95 r=$?
97 if [ $r -eq 0 ]
98 then echo Package $i installed
99 else echo Package $i failed to install, see Log
101 if [ -f .postinstall ]
102 then echo Running postinstall script.
103 sh -e .postinstall
105 binsizes normal
107 # Clean up
108 cd ..
109 rm -f $i.tar $TARBZ # Remove whatever is still lying around
110 done