No more packman, easypack, packit

-Create a dummy packman script that tells users about pkgin
This commit is contained in:
Arun Thomas 2010-09-03 07:27:39 +00:00
parent 99d9144556
commit 9e4e26e0c8
8 changed files with 7 additions and 464 deletions

View file

@ -9,7 +9,7 @@ SUBDIR= aal add_route adduser advent arp ash at autil awk \
chmod chown chroot ci cksum cleantmp clear cmp co \
comm compress cp crc cron crontab cut date \
dd de decomp16 DESCRIBE dev2name devsize df dhcpd \
dhrystone diff dirname dis88 diskctl du dumpcore easypack \
dhrystone diff dirname dis88 diskctl du dumpcore \
ed eject elle elvis env expand factor file \
find finger fingerd fix fold format fortune fsck.mfs \
fsck1 ftp101 ftpd200 gcov-pull getty grep gomoku head host \
@ -19,7 +19,7 @@ SUBDIR= aal add_route adduser advent arp ash at autil awk \
lpd ls lspci M m4 mail make MAKEDEV man \
mdb mdocml mesg mined mkdep mkdir mkdist mkfifo mkfs.mfs mknod \
mkproto modem mount mt netconf newroot nice acknm nohup \
nonamed od packit packman passwd paste patch pax \
nonamed od packman passwd paste patch pax \
ping postinstall poweroff pr prep printf printroot \
profile progressbar proto pr_routes ps pwd pwdauth \
ramdisk rarpd rawspeed rcp rdate readall readclock \

View file

@ -1,4 +0,0 @@
SCRIPTS= easypack.sh
MAN=
.include <bsd.prog.mk>

View file

@ -1,109 +0,0 @@
#!/bin/sh
# This script gets and installs a package from the Website.
# It is called by easypack package1 ...
# A package must be in the form of pack.tar.bz2 and must
# include a build script that makes and installs it.
# The build script should succeed if installation works, else fail
# Examples:
# easypack awk elle telnet # fetch and install 3 packages
# easypack -o awk elle telnet # fetch and replace existing packs
SOURCE_DIR=/usr/local/src # where the source is deposited
OVERWRITE=0 # can an installed package be overwritten?
SOFTWARE_DIR="http://www.minix3.org/software"
# Check for at least one parameter
case $# in
0) echo Usage: $0 package ...
exit ;;
esac
# Change to source directory
ORIG_DIR=`pwd`
rm -f Log # remove old debugging log
mkdir $SOURCE_DIR || true
cd $SOURCE_DIR || exit
if [ "`id -u`" -ne 0 ]
then
# Check for write permission here
if test ! -w .
then echo You do not have write permission for $SOURCE_DIR
exit 1
fi
fi
# Check for -o flag; if found, set OVERWRITE
if test $1 = "-o"
then OVERWRITE=1
shift
fi
# Loop on the packages
for i
do # Check to see if it exists. Don't overwrite unless -o given
echo " " ; echo Start fetching package $i
echo " " >>$ORIG_DIR/Log
echo ------------- Start fetching $i ------------------ >>$ORIG_DIR/Log
if test -r $i
then # Directory already exists. May it be overwritten?
if test $OVERWRITE = 0
then echo $i already exists. Skipping this package
continue
else # Remove the directory
rm -rf $i
echo Existing directory $i removed
fi
fi
# Remove any junk from previous attempts
rm -f $i.tar.bz2 $i.tar
# Get the package
URL=$SOFTWARE_DIR/$i.tar.bz2
TARBZ=$i.tar.bz2
if urlget $URL >$TARBZ 2>/dev/null
then :
else
echo Cannot get $i.
echo " " Tried $URL
echo " " Skipping this package
rm -f $TARBZ
continue
fi
# We got it. Unpack it.
echo Package $i fetched
bunzip2 $TARBZ || smallbunzip2 $TARBZ
pax -r <$i.tar
if test ! -d $i
then echo Unable to unpack $i
continue
else echo Package $i unpacked
fi
# It is now unpacked. Build it
cd $i
if [ -f build.minix ]
then sh build.minix >>$ORIG_DIR/Log 2>&1
r=$?
else sh build >>$ORIG_DIR/Log 2>&1
r=$?
fi
if [ $r -eq 0 ]
then echo Package $i installed
else echo Package $i failed to install, see Log
fi
if [ -f .postinstall ]
then echo Running postinstall script.
sh -e .postinstall
fi
# Clean up
cd ..
rm -f $i.tar $TARBZ # Remove whatever is still lying around
done

View file

@ -1,4 +0,0 @@
SCRIPTS= packit.sh
MAN=
.include <bsd.prog.mk>

View file

@ -1,47 +0,0 @@
#!/bin/sh
PI=.postinstall
TMP=/usr/tmp
PATH=/bin:/usr/bin:/usr/local/bin
if [ "$#" -ne 1 ]
then
echo "Usage: $0 <package file>"
exit 1
fi
dir=`pwd`
if [ "$1" = "-" ]
then f=""
else case "$1" in
/*) f="$1" ;;
*) f="$dir/$1" ;;
esac
fi
cd $TMP
rm -f $PI
if [ -f $PI ]
then echo "$PI is in $TMP, please remove it first."
exit 1
fi
if [ ! -f $f ]
then echo "Couldn't find package $f."
exit 1
fi
# can we execute bunzip2?
if bunzip2 --help 2>&1 | grep usage >/dev/null
then BUNZIP2=bunzip2
else BUNZIP2=smallbunzip2
fi
cat $f | $BUNZIP2 | pax -r -p e
if [ -f $PI ]
then
sh -e $PI
rm -f $PI
fi

View file

@ -1,262 +1,6 @@
#!/bin/sh
TAG=`uname -p`-`uname -r`
PACKDIR=`uname -p`/`uname -r`
RC=/usr/etc/rc.package
CDDIR=PACKAGES
CDMP=/mnt
CDPACK=${CDMP}/install/packages
CDSRC=${CDMP}/install/package-sources
SRC=/usr/bigsrc
LISTFILE=/etc/packages-$TAG
LISTURL=http://www.minix3.org/packages/$PACKDIR/List
TMPDIR=/usr/tmp/packages
mkdir -p $TMPDIR
URL1=http://www.minix3.org/packages/$PACKDIR
SRCURL1=http://www.minix3.org/software
PATH=/bin:/sbin:/usr/bin:/usr/sbin
pack=""
cdpackages=""
netpackages=""
cdmounted=""
if [ ! "$PAGER" ]
then PAGER=more
fi
if [ "$1" = -y ]
then YESMODE=1
PAGER=cat
fi
myread()
{
if [ "$YESMODE" ]
then echo "all"
else read ans
echo $ans
fi
}
myexit()
{
if [ -n "$cdmounted" -a -n "$pack" ]
then
umount $pack || true
fi
exit $1
}
# can we execute bunzip2?
if bunzip2 --help 2>&1 | grep usage >/dev/null
then BUNZIP2=bunzip2
else BUNZIP2=smallbunzip2
fi
if id | fgrep "root" >/dev/null
then :
else echo "Please run $0 as root."
myexit 1
fi
chmod 700 $TMPDIR
if [ -f "$RC" ]
then . "$RC"
fi
cd /
# Make sure there is a $SRC dir
if [ ! -d "$SRC" ]
then mkdir $SRC || myexit 1
fi
# Is there a usable CD to install packages from?
if [ -n "$cddrive" ]
then pack=${cddrive}p2
umount $pack >/dev/null 2>&1 || true
echo "Checking for CD in $pack."
if mount -r $pack $CDMP 2>/dev/null
then fn="$CDPACK/List"
echo "Found."
cdmounted=1
cdpackages=$fn
if [ ! -f $cdpackages ]
then cdpackages=""
echo "No package list found on CD in $fn."
fi
else echo "Not found."
fi
else echo "Don't know where the install CD is. You can set it in $RC."
fi
TMPF=$TMPDIR/.list.$$
rm -f $TMPF
rm -f $TMPDIR/.* # Remove any remaining .postinstall script or .list*
# Check for network packages too
if ( : </dev/tcp ) 2>/dev/null
then echo -n "Update package list from network? (Y/n) "
y=`myread`
if [ "$y" != n -a "$y" != N ]
then echo "Fetching package list from $LISTURL."
fetch -o $TMPF $LISTURL && mv $TMPF $LISTFILE || echo "Update not successful."
fi
netpackages=$LISTFILE
if [ ! -f "$netpackages" -o ! `cat "$netpackages" 2>/dev/null | wc -l | awk '{ print $1 }'` -gt 1 ]
then netpackages=""
fi
else echo "No working network detected."
fi
# Is there at least one package type?
if [ ! -n "$netpackages" -a ! -n "$cdpackages" ]
then echo "No packages found."
myexit 1
fi
# Is there more than one package type?
if [ -n "$netpackages" -a -n "$cdpackages" ]
then echo -n "Would you like to install from (C)D or (N)etwork? [C] "
whichsrc=`myread`
if [ "$whichsrc" = N -o "$whichsrc" = n ]
then unset cdpackages
else unset netpackages
fi
fi
if [ -n "$netpackages" ]
then source=net
else source=cdrom
fi
cont=y
while [ "$cont" = y ]
do cd $TMPDIR
echo ""
echo "Showing you a list of packages using $PAGER. Press q when"
echo "you want to leave the list."
echo -n "Press RETURN to continue.."
xyzzy=`myread`
echo "Package list:"
( echo "No.|Package|Description"
(
if [ -f "$netpackages" -a "$source" = net ]
then cat $netpackages
fi
if [ -f "$cdpackages" -a "$source" = cdrom ]
then cat $cdpackages
fi
) | sort -f -t'|' +0 | awk '{ n++; printf "%d|%s\n", n, $0 }'
) >$TMPF
highest="`wc -l $TMPF | awk '{ print $1 - 1 }'`"
awk -F'|' <$TMPF '{ printf "%3s %-15s %s\n", $1, $2, $3 }' | $PAGER
echo "Format examples: '3', '3,6', '3-9', '3-9,11-15', 'all', 'gzip-1.2.4'"
echo -n "Package(s) to install (RETURN or q to exit)? "
packnolist=`myread`
if [ "$packnolist" = "" -o "$packnolist" = "q" ]
then myexit 0
fi
if [ "$packnolist" = all ]
then packnolist=1-$highest
fi
IFS=','
set $packnolist
echo -n "Get source(s) too? (y/N) "
getsources=`myread`
for packrange in $packnolist
do
# Get a-b range.
if [ "$packrange" : '^ *[0-9]' ]
then
# If it starts with a digit, it is a range of package numbers
IFS='-'
set $packrange
start=$1
if [ $# = 2 ]
then end=$2
else end=$1
fi
IFS=' '
packlist="`awk </dev/null "BEGIN { for(i=$start; i<=$end; i++) { printf \\\"%d \\\", i } }"`"
packlistno=1
else
# Otherwise it is a package name
packlist=$packrange
packlistno=0
fi
# use awk to make the range list
for packno in $packlist
do
ok=y
if [ $packlistno -eq 0 ]
then pat="^[1-9][0-9]*|$packno[-|.]"
else pat="^$packno|"
fi
if [ "`grep -c $pat $TMPF`" -ne 1 ]
then if [ "$packno" ]
then echo "$packno: Wrong package."
fi
ok=n
fi
if [ $ok = y ]
then
packagename="`grep $pat $TMPF | awk -F'|' '{ print $2 }'`"
file=$packagename.tar.bz2
echo ""
if [ -f $file -a ! "$YESMODE" ]
then echo "Skipping $file - it's already in $TMPDIR."
echo "Remove that file if you want to re-retrieve and install this package."
else
case $source in
net*) echo "Retrieving $packno ($packagename) from primary location into $TMPDIR .."
srcurl=""
if fetch -o $file $URL1/$file
then echo "Retrieved ok. Installing .."
packit $file && echo Installed ok.
srcurl=$SRCURL1/$file
else echo "Retrieval failed."
fi
if [ "$getsources" = y -o "$getsources" = Y ]
then ( cd $SRC || myexit 2
srcfile=${packagename}-src.tar.bz2
echo "Retrieving source from $srcurl .."
fetch -o $srcfile $srcurl || myexit 3
echo "Source retrieved in $SRC/$srcfile."
$BUNZIP2 -dc $srcfile | tar xf - >/dev/null || myexit 3
echo "Source unpacked in $SRC."
)
fi
;;
cdrom*)
if [ -f $CDPACK/$file ]
then echo "Installing from $CDPACK/$file .."
packit $CDPACK/$file && echo Installed ok.
else echo "$CDPACK/$file not found."
fi
srcfile=$CDSRC/${packagename}.tar.bz2
if [ -f $srcfile -a "$getsources" = y ]
then
( cd $SRC || myexit 2
$BUNZIP2 -dc $srcfile | tar xf - || myexit 3
echo "Source $srcfile unpacked in $SRC."
)
fi
;;
esac
fi
else cont=n
fi
done # Iterate package range
done # Iterate package range list
# Do not repeat after installing all packages if -y is specified
[ "$YESMODE" ] && cont=n
done
rm -f $TMPDIR/.* # Remove any remaining .postinstall script or .list*
myexit 0
echo "-----------------------------------"
echo "Packman has been replaced by pkgin."
echo "See man 1 pkgin for details."
echo "-----------------------------------"

View file

@ -4,7 +4,7 @@ MAN= acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \
chmem.1 chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \
cp.1 crc.1 crontab.1 ctags.1 dd.1 dev2name.1 \
df.1 dhrystone.1 dosdir.1 dosread.1 doswrite.1 du.1 \
dumpcore.1 easypack.1 echo.1 ed.1 eject.1 elvis.1 elvrec.1 \
dumpcore.1 echo.1 ed.1 eject.1 elvis.1 elvrec.1 \
env.1 expand.1 expr.1 factor.1 file.1 \
finger.1 flexdoc.1 fmt.1 fold.1 format.1 fortune.1 \
fsck.1 head.1 host.1 hostaddr.1 ifdef.1 \

View file

@ -1,37 +0,0 @@
.TH EASYPACK 1
.SH NAME
easypack \- Fetch and install a package
.SH SYNOPSIS
\fBeasypack\fR [\fB\-\fIo\fR]
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH OPTIONS
.FL "\-\fIo\fR" "If package is already installed, overwrite it
.SH EXAMPLES
.EX "easypack gzip-1.2.4" "Fetch gzip-1.2.4 package"
.EX "easypack -o indent telnet" "Refetch these 2 packages"
.SH DESCRIPTION
.PP
MINIX 3 user programs, such as emacs, kermit, and telnet are
organized into packages. The complete list is avail\%able at
\fIwww.minix3.org/software\fR. While most packages are included
on the downloadable CD-ROM image, the larger ones are not.
Any package can be easily downloaded and installed by just
giving one simple easypack command listing the package names
taken from the Website.
Each package is a .tar.bz2 file that is fetched from \fIwww.minix3.org\fR,
and then copied to \fI/usr/src/commands\fR, decompressed and untarred.
Then the \fIbuild\fR script in the top-level directory is executed
to install it. This command should be called when logged in as bin
to provide write access to the relevant directories. A log file,
\fILog\fR, is produced for debugging in case building fails.