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
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
20 0) echo Usage
: $0 package ...
24 # Change to source directory
26 rm -f Log
# remove old debugging log
27 mkdir
$SOURCE_DIR || true
28 cd $SOURCE_DIR ||
exit
30 if [ "`id -u`" -ne 0 ]
32 # Check for write permission here
34 then echo You
do not have
write permission
for $SOURCE_DIR
39 # Check for -o flag; if found, set OVERWRITE
45 # Loop on the packages
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
52 then # Directory already exists. May it be overwritten?
53 if test $OVERWRITE = 0
54 then echo $i already exists. Skipping this package
56 else # Remove the directory
58 echo Existing directory
$i removed
62 # Remove any junk from previous attempts
63 rm -f $i.
tar.bz2
$i.
tar
66 URL
=$SOFTWARE_DIR/$i.
tar.bz2
68 if urlget
$URL >$TARBZ 2>/dev
/null
73 echo " " Skipping this package
78 # We got it. Unpack it.
79 echo Package
$i fetched
80 bunzip2
$TARBZ || smallbunzip2
$TARBZ
83 then echo Unable to unpack
$i
85 else echo Package
$i unpacked
88 # It is now unpacked. Build it
92 then sh build.minix
>>$ORIG_DIR/Log
2>&1
94 else sh build
>>$ORIG_DIR/Log
2>&1
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.
109 rm -f $i.
tar $TARBZ # Remove whatever is still lying around