shithub: riscv

Download patch

ref: 55852fa53a24eab73e875fb50cd4a83c0e68aeb2
parent: 25e636199337af725a7e8cdf74542d4e61b75d1a
author: stanley lieber <[email protected]>
date: Sun May 15 01:24:08 EDT 2011

pkg: support installing from local directories as well as remote URLs; PKG_PATH -> pkgpath

--- a/sys/src/cmd/pkg/install
+++ b/sys/src/cmd/pkg/install
@@ -1,7 +1,7 @@
 #!/bin/rc -e
 
-if(~ $#PKG_PATH 0)
-	PKG_PATH=http://pkg.violetti.org
+if(~ $#pkgpath 0)
+	pkgpath=http://pkg.violetti.org/$cputype
 
 cd /
 mkdir -p /sys/lib/pkg
@@ -10,6 +10,10 @@
 	exit
 }
 echo Installing $1
-hget $PKG_PATH/$cputype/$1.tbz | bunzip2 | pkg/unpkg>[2]/sys/lib/pkg/$1
+if(~ $pkgpath ftp* http*)
+	cmd=hget
+if not
+	cmd=cat
+$cmd $pkgpath/$1.tbz | bunzip2 | pkg/unpkg>[2]/sys/lib/pkg/$1
 echo Done
 
--- a/sys/src/cmd/pkg/list
+++ b/sys/src/cmd/pkg/list
@@ -1,6 +1,9 @@
 #!/bin/rc
 
-if(~ $#PKG_PATH 0)
-	PKG_PATH=http://pkg.violetti.org
+if(~ $#pkgpath 0)
+	pkgpath=http://pkg.violetti.org/$cputype
 
-hget $PKG_PATH/$cputype | htmlfmt | grep '\.tbz' | sed -e 's/\.tbz$//'
+if(~ $pkgpath ftp* http*)
+	hget $pkgpath | htmlfmt | grep '\.tbz' | sed -e 's/\.tbz$//'
+if not
+	ls -p $pkgpath