From 3271cef575a2c2788dee60090dae9c01d21b62ac Mon Sep 17 00:00:00 2001 From: John Marino Date: Thu, 6 Jun 2013 01:51:47 +0200 Subject: [PATCH] /usr/Makefile: Add pkg-bootstrap target New snapshots provide a pre-built "pkg" tool so pre-build dports binaries can be installed easily. However, upgrades from older releases won't have "pkg" available, and for those systems they had to download the entire dports repository just to build pkg in order to take advantage of the available pre-built packages. To fix this situation, and the situation where /usr/local/sbin/pkg is lost for any reason, a new make target has been added to /usr/Makefile: pkg-bootstrap The pkg-bootstrap target will download a pre-built "pkg-static" program along with pkg.conf and all the man pages. In reality, pkg-static is only used for one command, and that is to install a full "pkg" program from the dragonfly repository. If "pkg.conf" already exists, a message will instruct the user to move it first. If /usr/local/sbin/pkg already exists, the target won't work and it won't even show as an option. After pkg-static is installed, the user will be instructed to type "rehash; pkg-static install -y pkg; rehash" which should result in the system having the latest pkg on their system and thus can proceed to install packages normally. --- etc/Makefile.usr | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/etc/Makefile.usr b/etc/Makefile.usr index ea9edc186a..9d904e3566 100644 --- a/etc/Makefile.usr +++ b/etc/Makefile.usr @@ -6,7 +6,11 @@ GITHOST?=git.dragonflybsd.org THISGIT!= which git 2>/dev/null; echo DPTBALL=/tmp/dports.tar.gz +PKGBALL=/tmp/pkgboot.tar.xz DPDLURL=https://api.github.com/repos/jrmarino/DPorts/tarball/ +PKGBOOT_i386=bootstrap_pkg_x86-32.tar.xz +PKGBOOT_x86_64=bootstrap_pkg_x86-64.tar.xz +PKGBOOT=http://leaf.dragonflybsd.org/~marino/dports-src/${PKGBOOT_${MACHINE_ARCH}} GITNFMSG="git must be present on the system to use this option." ERRPS="Error: ${.CURDIR}/pkgsrc already exists" ERRDP="Error: ${.CURDIR}/dports already exists" @@ -14,6 +18,7 @@ ERRSR="Error: ${.CURDIR}/src already exists" ERRNPS="Error: ${.CURDIR}/pkgsrc does not exist" ERRNDP="Error: ${.CURDIR}/dports does not exist" ERRNSR="Error: ${.CURDIR}/src does not exist" +ERRPKG="Error: Bootstrap not neccessary, ${.CURDIR}/local/sbin/pkg already exists" WSTARS="***************************************************************" WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!" LPATT=" make %-23s- %s\n" @@ -43,6 +48,9 @@ help all: @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository" @printf ${LPATT} "dports-download" "download & install dports tarball from Github" . endif +.endif +.if !exists(${.CURDIR}/local/sbin/pkg) + @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages" .endif @echo @@ -265,3 +273,16 @@ dports-replace: mv /usr/jrmarino-DPorts-* ${.CURDIR}/dports rm -f ${DPTBALL} .endif + +pkg-bootstrap: +.if exists(${.CURDIR}/local/sbin/pkg) + @echo ${ERRPKG} +.elif exists(${.CURDIR}/local/etc/pkg.conf) + @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten" + @echo "Please move this file and rerun 'make pkg-bootstrap'" +.else + @fetch -o ${PKGBALL} ${PKGBOOT} + @tar -xJf ${PKGBALL} -C ${.CURDIR}/local + @rm -f ${PKGBALL} + @echo "type 'rehash; pkg-static install -y pkg; rehash' to install the latest pkg" +.endif -- 2.41.0