shithub: riscv

ref: eb6a4fc1a4a6e32cd35e76771fe8687b64e9122f
dir: /sys/src/cmd/pkg/install/

View raw version
#!/bin/rc

if(~ $#pkgpath 0)
	pkgpath=http://r-36.net/9front/pkg/$cputype

cd /
mkdir -p /sys/lib/pkg
if (test -s /sys/lib/pkg/$1) {
	echo $1 already installed
	exit
}
echo Installing $1
if(~ $pkgpath ftp* http*)
	cmd=hget
if not
	cmd=cat
if(! $cmd $pkgpath/$1.tbz | bunzip2 | pkg/unpkg >/sys/lib/pkg/$1)
	if(! test -s /sys/lib/pkg/$1)
		rm -f /sys/lib/pkg/$1