# Makefile.usr - installed as /usr/Makefile # # Provides simple targets to download and maintain /usr/src, /usr/dports etc. 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/DragonFlyBSD/DPorts/tarball/ PKGBOOT_VERSION=01 PKGBOOT_i386=bootstrap_pkg_${PKGBOOT_VERSION}_x86-32.tar.xz PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}} GITNFMSG="git must be present on the system to use this option." ABIVERS=`uname -P` ERRDP="Error: ${.CURDIR}/dports already exists" ERRSR="Error: ${.CURDIR}/src already exists" 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" help all: @echo "HELP:" @echo .if exists(${.CURDIR}/dports/.git) @printf ${LPATT} "dports-update" "update your dports repository from the net" .else . if exists(${.CURDIR}/dports) @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)" . else @printf ${LPATT} "dports-create" "fetch initial dports repository from the net" @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository" @printf ${LPATT} "dports-download" "download & install dports tarball (Github)" . endif .endif @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages" @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)" @echo .if exists(${.CURDIR}/src/.git) .if exists(${.CURDIR}/src/Makefile) @printf ${LPATT} "src-update" "update your src repository from the net" .else @printf ${LPATT} "src-checkout" "Initial checkout of src repository" .endif .else @printf ${LPATT} "src-create" "fetch initial src repository from the net" @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository" @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout" .endif @echo .if exists(${.CURDIR}/src-sys.tar.bz2) @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources" @echo .endif @echo "If automating please feel free to run git pull's from cron." @echo "We prefer once a day but you can run them more often if you desire" src-create-repo: .if empty(THISGIT) @echo ${GITNFMSG} .elif exists (${.CURDIR}/src) @echo ${ERRSR} .else @echo "If problems occur you may have to rm -rf src and try again." @echo mkdir -p ${.CURDIR}/src cd ${.CURDIR}/src && git init cd ${.CURDIR}/src && \ git remote add origin git://${GITHOST}/dragonfly.git cd ${.CURDIR}/src && git fetch origin cd ${.CURDIR}/src && git branch master origin/master .endif src-create: src-create-repo .if empty(THISGIT) @echo ${GITNFMSG} .elif exists (${.CURDIR}/src) @echo ${ERRSR} .else cd ${.CURDIR}/src && git checkout master cd ${.CURDIR}/src && git pull .endif src-create-shallow: .if empty(THISGIT) @echo ${GITNFMSG} .elif exists (${.CURDIR}/src) @echo ${ERRSR} .else @echo "If problems occur you may have to rm -rf src and try again." @echo mkdir -p ${.CURDIR}/src cd ${.CURDIR}/src && git init cd ${.CURDIR}/src && \ git remote add origin git://${GITHOST}/dragonfly.git cd ${.CURDIR}/src && git fetch --depth=1 origin cd ${.CURDIR}/src && git branch master origin/master cd ${.CURDIR}/src && git checkout master cd ${.CURDIR}/src && git pull .endif src-checkout: .if empty(THISGIT) @echo ${GITNFMSG} .elif !exists (${.CURDIR}/src) @echo ${ERRNSR} .else cd ${.CURDIR}/src && git checkout master .endif src-update: .if empty(THISGIT) @echo ${GITNFMSG} .elif !exists (${.CURDIR}/src) @echo ${ERRNSR} .else cd ${.CURDIR}/src && git pull .endif release-sys-extract: cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2 dports-update: .if empty(THISGIT) @echo ${GITNFMSG} .elif !exists (${.CURDIR}/dports) @echo ${ERRNDP} .else cd ${.CURDIR}/dports && git pull .endif dports-create: .if empty(THISGIT) @echo ${GITNFMSG} .elif exists (${.CURDIR}/dports) @echo ${ERRDP} .else @echo "If problems occur you may have to rm -rf dports and try again." @echo git clone git://mirror-master.dragonflybsd.org/dports.git ${.CURDIR}/dports .if exists(${.CURDIR}/pkg) @echo ${WSTARS} @echo ${WARNPS} @echo ${WSTARS} .endif .endif dports-create-shallow: .if empty(THISGIT) @echo ${GITNFMSG} .elif exists (${.CURDIR}/dports) @echo ${ERRDP} .else @echo "If problems occur you may have to rm -rf dports and try again." @echo git clone --depth=1 git://mirror-master.dragonflybsd.org/dports.git \ ${.CURDIR}/dports .if exists(${.CURDIR}/pkg) @echo ${WSTARS} @echo ${WARNPS} @echo ${WSTARS} .endif .endif dports-download: .if exists (${.CURDIR}/dports) @echo ${ERRDP} .else rm -f ${DPTBALL} fetch -o ${DPTBALL} ${DPDLURL} tar -xf ${DPTBALL} -C ${.CURDIR} mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports rm -f ${DPTBALL} .if exists(${.CURDIR}/pkg) @echo ${WSTARS} @echo ${WARNPS} @echo ${WSTARS} .endif .endif dports-replace: .if !exists (${.CURDIR}/dports) @echo ${ERRNDP} .elif exists(${.CURDIR}/dports/.git) @echo "Error: this is git repository currently." @echo "Remove ${.CURDIR}/dports and execute \"make dports-downloads\" if you want" @echo "to convert to a non-git version." .else rm -f ${DPTBALL} fetch -o ${DPTBALL} ${DPDLURL} rm -rf ${.CURDIR}/dports tar -xf ${DPTBALL} -C ${.CURDIR} mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports rm -f ${DPTBALL} .endif pkg-bootstrap-force: @fetch -o ${PKGBALL} ${PKGBOOT} @tar -xJf ${PKGBALL} -C ${.CURDIR}/local @rm -f ${PKGBALL} ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg 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} ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg .endif