aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authordinoex <dinoex@FreeBSD.org>2018-08-16 15:57:02 +0800
committerdinoex <dinoex@FreeBSD.org>2018-08-16 15:57:02 +0800
commitbc0fc976d1068c39e29e5e68e59cf7761c341591 (patch)
tree8bad9a87562f6b5c5b69ae3b158ad8bd6ca80256 /ports-mgmt
parentda145027e30883f104806b63e974231f734f53a4 (diff)
downloadfreebsd-ports-gnome-bc0fc976d1068c39e29e5e68e59cf7761c341591.tar.gz
freebsd-ports-gnome-bc0fc976d1068c39e29e5e68e59cf7761c341591.tar.zst
freebsd-ports-gnome-bc0fc976d1068c39e29e5e68e59cf7761c341591.zip
- switch MASTER_SITES to github
- add more scripts
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/pkg_jail/Makefile38
-rw-r--r--ports-mgmt/pkg_jail/files/README.txt190
-rw-r--r--ports-mgmt/pkg_jail/files/pkg_jail311
-rw-r--r--ports-mgmt/pkg_jail/files/pkg_jail.184
-rw-r--r--ports-mgmt/pkg_jail/files/pkg_update2077
-rw-r--r--ports-mgmt/pkg_jail/files/pkg_update.1155
6 files changed, 16 insertions, 2839 deletions
diff --git a/ports-mgmt/pkg_jail/Makefile b/ports-mgmt/pkg_jail/Makefile
index 466a6e22feda..1333cb160195 100644
--- a/ports-mgmt/pkg_jail/Makefile
+++ b/ports-mgmt/pkg_jail/Makefile
@@ -1,11 +1,9 @@
# $FreeBSD$
PORTNAME= pkg_jail
-PORTVERSION= 2.0
-PORTREVISION= 1
+PORTVERSION= 2.2
+DISTVERSIONPREFIX= v
CATEGORIES= ports-mgmt
-MASTER_SITES= # empty
-DISTFILES= # empty
MAINTAINER= dinoex@FreeBSD.org
COMMENT= Manage your own package jail
@@ -15,28 +13,24 @@ LICENSE= BSD3CLAUSE
NO_BUILD= yes
NO_ARCH= yes
-PLIST_FILES= bin/pkg_jail bin/pkg_update \
- man/man1/pkg_jail.1.gz man/man1/pkg_update.1.gz
-PORTDOCS= README.txt
-LMAN1= pkg_jail.1 pkg_update.1
+USE_GITHUB= yes
+GH_ACCOUNT= dinoex
-OPTIONS_DEFINE= DOCS
+LMAN1= allservice.1 check-allservice.1 pkg_jail.1 pkg_update.1
+LMAN8= make-base.8 update-base.8 update-pkg.8
do-install:
- ${INSTALL_SCRIPT} ${FILESDIR}/pkg_jail ${FILESDIR}/pkg_update \
- ${STAGEDIR}${PREFIX}/bin/
+ ( cd ${WRKSRC} && \
+ ${INSTALL_SCRIPT} allservice check-allservice pkg_jail pkg_update \
+ ${STAGEDIR}${PREFIX}/bin/ )
+ ( cd ${WRKSRC} && \
+ ${INSTALL_SCRIPT} make-base update-base update-pkg \
+ ${STAGEDIR}${PREFIX}/sbin/ )
.for i in ${LMAN1}
- ${INSTALL_MAN} ${FILESDIR}/${i} ${STAGEDIR}${PREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/${i} ${STAGEDIR}${PREFIX}/man/man1/
+.endfor
+.for i in ${LMAN8}
+ ${INSTALL_MAN} ${WRKSRC}/${i} ${STAGEDIR}${PREFIX}/man/man8/
.endfor
-
-do-install-DOCS-on:
- ${MKDIR} ${STAGEDIR}${DOCSDIR}
- ${INSTALL_DATA} ${FILESDIR}/README.txt ${STAGEDIR}${DOCSDIR}/
-
-install-ports:
- -${MKDIR} ${PORTSDIR}/local/update/data
- ${LN} -s ${FILESDIR}/README.txt ${PORTSDIR}/local/update/
- ${LN} -s ${FILESDIR}/pkg_update ${PORTSDIR}/local/update/
- ${LN} -s ${FILESDIR}/pkg_jail ${PORTSDIR}/local/update/
.include <bsd.port.mk>
diff --git a/ports-mgmt/pkg_jail/files/README.txt b/ports-mgmt/pkg_jail/files/README.txt
deleted file mode 100644
index 0b0e8770c863..000000000000
--- a/ports-mgmt/pkg_jail/files/README.txt
+++ /dev/null
@@ -1,190 +0,0 @@
-#
-# /usr/ports/local/update/
-#
-# Scripts reside here.
-# install then here with:
-# cd /usr/ports/ports-mgmt/pkg_jail && make install-ports
-# /usr/ports should be shared with buildjail and hosts.
-#
-#
-# Intended to run within a jailed build system:
-# ---------------------------------------------
-#
-#
-# pkg_update update-ports
-# Starts "make update" for the ports tree.
-#
-#
-# pkg_update update-pkg
-# force rebuild of pkg tools.
-#
-#
-# pkg_update repo
-# force rebuild of pkg repo.
-#
-#
-# pkg_update make-packages
-# Builds a port and its dependencies in a clean /usr/local.
-# You should not run this on a server with configuration.
-# Existing packages are used.
-# Extra files in "${PREFIX}" are detected and reported.
-# The default list of ports is "data/make-packages.${hostname}"
-#
-#
-# pkg_update clean-distfiles
-# Checks all distinfo files and moves the disfiles not found
-# to "/usr/ports/distfiles/Old/".
-#
-#
-# pkg_update merge-distfiles
-# Copy all disfiles found that do not yet exist on the master
-# directory "/media/ports/distfiles/".
-#
-#
-# pkg_update clean-packages
-# Synopsis:
-# Find obsolete packages and move them out of the way
-#
-# Problem:
-# Installation of a package with multiple dependencys.
-# pkg_add installs the depended package, and its requirements.
-# When the depended package has been updated,
-# The packages that require this are no longer up to date.
-#
-# Solution:
-# Use pkg_info on each package and compare the versions
-# with the new versions in the ports tree, if they don't
-# match report it, and move it out of the "All" directory
-# "/usr/ports/packages/All/" into a seperate directory
-# "/usr/ports/packages/Old/" for later cleanup.
-# Then remove all stale links to the moved packages.
-#
-# pkg_update clean-openssl-packages
-# Find packages that use openssl and move them out of the way
-#
-# pkg_update full-update-jail
-# do full update cycle
-# 1) "update-ports" to update the ports tree
-# 2) "clean-distfiles" to keep only current distfiles
-# 3) "clean-packages" to keep only good packages
-# 4) remove all old error logs
-# 5) "make-packages" to rebuild missing packages
-#
-# pkg_update full-update-jail retry
-# Skip "update-ports" and procced as above.
-#
-#
-# clean-usr-lib.sh:
-# Cleans the base system after installworld.
-# move old libs to comapt, so old applications keep running,
-# but new applications can only link to up-to-date libs.
-#
-#
-#
-# Intended to everywhere:
-# -----------------------
-#
-# pkg_update fetch-distfiles
-# Fetch distfiles for list of ports.
-#
-# pkg_update fetch-recursive-distfiles
-# Fetch distfiles for list of ports and their dependecies.
-#
-#
-#
-# Intended to run on a host:
-# --------------------------
-#
-# pkg_update fix-moved-ports
-# Check installed packages for moved ports. Then register
-# the new dir in the old installed package.
-#
-# pkg_update add-packages
-# Build a missing port and its missing dpendencies
-# /usr/local is not deleted, on success the port is installed.
-# Existing packages will be used.
-#
-# pkg_update list-installed-ports
-# List all installed ports.
-#
-# pkg_update show-version-list
-# List installed packages that are not in correct version
-#
-# pkg_update show-packages
-# List build packages or report missing for each port
-# recorded in "data/install-packages.${hostname}".
-#
-# pkg_update show-missing-installed
-# List build packages or report missing for each port
-# installed on this host.
-#
-# pkg_update check-installed-ports
-# Compare the list of installed ports with the list
-# recorded in data/install-packages.${hostname}".
-#
-# pkg_update check-update
-# pkg_update check-installed-ports
-# pkg_update show-missing-packages
-# pkg_update show-missing-installed
-#
-#
-#
-# Intended to update a host:
-# --------------------------
-#
-# pkg_update show-missing-packages
-# Warn if no package is found for each port
-# recorded in "data/install-packages.${hostname}"
-#
-# pkg_update clean
-# Clean all cached information.
-#
-# pkg_update make-version-list
-# Make new list of packages that are not in correct version
-#
-# pkg_update make-deinstall-list
-# Make new list of ports that are not in correct version
-# and create a script "deinstall.${hostname}" to deinstall
-# all the old ports and the dependend ports in order.
-#
-# pkg_update check-reinstall
-# For each package deleted by "make-deinstall-list" warn
-# if no new package is found.
-#
-# pkg_update reinstall
-# For each package deleted by "make-deinstall-list" try
-# to install the new package if it exists.
-#
-# pkg_update install-packages
-# For each port recorded in "data/install-packages.${hostname}"
-# try to to install the new package if it exists.
-#
-# pkg_update show-missing-reinstall
-# For each port recorded from "make-deinstall-list" warn
-# if no new package is found.
-#
-# pkg_update clean-reinstall
-# For each port recorded from "make-deinstall-list",
-# keep only the ports that have no package installed.
-#
-# pkg_update deinstall-packages
-# For each port recorded in "data/install-packages.${hostname}"
-# try to to deinstall the installed port.
-#
-#
-#
-# Files:
-# ------
-#
-#
-# /usr/ports/local/update/data/
-#
-# Configuration files reside here.
-# create your initial configuration for a build jail:
-# pkg_update list-installed-ports \
-# > /usr/ports/local/update/data/make-packages.jailname
-#
-# /usr/ports/local/update/log-${host}
-#
-# Buildlogs and errorlogs reside here.
-#
diff --git a/ports-mgmt/pkg_jail/files/pkg_jail b/ports-mgmt/pkg_jail/files/pkg_jail
deleted file mode 100644
index 94d07abe0e47..000000000000
--- a/ports-mgmt/pkg_jail/files/pkg_jail
+++ /dev/null
@@ -1,311 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-# Copyright (c) 2001-2017 by Dirk Meyer. All rights reserved.
-# Im Grund 4, 34317 Habichtswald, Germany
-# Email: dirk.meyer@dinoex.sub.org
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the author nor the names of any co-contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# -------------------------------------------------------------------------
-#
-. /etc/rc.subr
-#
-case "$0" in
-/etc/rc*)
- # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
- # so get the name of the script from $_file
- pkg_jail_script="$_file"
- ;;
-*)
- pkg_jail_script="$0"
- ;;
-esac
-pkg_jail_prefix="${pkg_jail_script%/*}"
-pkg_jail_config="${pkg_jail_prefix%/*}/etc/pkg_jail.conf"
-echo "${pkg_jail_config}"
-if test -s "${pkg_jail_config}"
-then
- . "${pkg_jail_config}"
-fi
-#
-name="pkg_jail"
-rcvar="pkg_jail_enable"
-init_cmd="pkg_jail_init"
-start_cmd="pkg_jail_start"
-shell_cmd="pkg_jail_shell"
-list_cmd="pkg_jail_list"
-stop_cmd="pkg_jail_stop"
-status_cmd="pkg_jail_status"
-extra_commands="status shell list init"
-# defaults
-: ${pkg_jail_enable="YES"}
-: ${pkg_jail_hostname="build.local"}
-: ${pkg_jail_short="${pkg_jail_hostname%%.*}"}
-: ${pkg_jail_ip="127.0.0.1"}
-: ${pkg_jail_dir="/usr/jail/mybuild"}
-: ${pkg_jail_rule="127"}
-#
-pkg_jail_setup()
-{
- if test ! -d "${pkg_jail_dir}"
- then
- mkdir -p "${pkg_jail_dir}"
- fi
- cd /usr/src
-# make buildworld
- make "DESTDIR=${pkg_jail_dir}" installworld
- make "DESTDIR=${D}" delete-old RM_I="-f -v"
- make "DESTDIR=${D}" delete-old-libs RM_I="-f -v"
- if test ! -f "${pkg_jail_dir}/etc/rc.conf"
- then
- if test ! -d "${pkg_jail_dir}/usr/ports"
- then
- mkdir "${pkg_jail_dir}/usr/ports"
- fi
- cd /usr/src/etc
- make "DESTDIR=${pkg_jail_dir}" distribution
- ln -sf dev/null "${pkg_jail_dir}/kernel"
- touch "${pkg_jail_dir}/etc/fstab"
- cp -pi /etc/localtime "${pkg_jail_dir}/etc/localtime"
- cp -pi /etc/resolv.conf "${pkg_jail_dir}/etc/resolv.conf"
- cp -pi /etc/make.conf "${pkg_jail_dir}/etc/make.conf"
- echo "hostname=\"${pkg_jail_hostname}\"" > "${pkg_jail_dir}/etc/rc.conf"
- cat >> "${pkg_jail_dir}/etc/rc.conf" << 'EOF'
-portmap_enable="NO"
-inetd_enable="NO"
-blanktime="NO"
-network_interfaces=""
-releaseName="none"
-sendmail_enable="NONE"
-syslogd_flags="-ss"
-entropy_file="NO"
-background_fsck="NO"
-EOF
- fi
-}
-pkg_jail_create_dev_rules()
-{
- # Standard Jail ruleset
- /sbin/devfs rule -s ${pkg_jail_rule} delset
- /sbin/devfs rule -s ${pkg_jail_rule} add 100 hide
- /sbin/devfs rule -s ${pkg_jail_rule} add 200 path ptyp* unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 300 path ttyp* unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 400 path null unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 500 path zero unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 510 path crypto unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 600 path random unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 610 path urandom unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 700 path fd unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 800 path fd/* unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 810 path mdctl unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 900 path stdin unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 910 path stdout unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 920 path stderr unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1000 path ptmx unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1010 path pts unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1020 path pts/* unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1030 path pty unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1040 path pty/* unhide
- /sbin/devfs rule -s ${pkg_jail_rule} add 1050 path tty* unhide
-}
-pkg_jail_create_dev_links()
-{
- local devdir="${1}"
- local source="${2}"
- local target="${3}"
- (cd ${devdir} && ln -sf ${source} ${target})
-}
-pkg_jail_create_devfs()
-{
- local jail_devdir="${pkg_jail_dir}/dev"
- local jail_devmount=`mount -t devfs | cut -d " " -f 3 | fgrep -x ${jail_devdir}`
- if test "${jail_devmount}" = ""
- then
- # create and mount devfs
- pkg_jail_create_dev_rules
- mount -t devfs dev ${jail_devdir}
- devfs -m ${jail_devdir} ruleset ${pkg_jail_rule}
- devfs -m ${jail_devdir} rule applyset
- fi
- if test ! -e "${jail_devdir}/console"
- then
- pkg_jail_create_dev_links ${jail_devdir} null console
- fi
- if test ! -e "${jail_devdir}/mem"
- then
- # for libkvm (ab)users
- pkg_jail_create_dev_links ${jail_devdir} null mem
- pkg_jail_create_dev_links ${jail_devdir} null kmem
- fi
- if test ! -e ${jail_devdir}/log
- then
- # Transitional symlink for old binaries
- pkg_jail_create_dev_links ${jail_devdir} ../var/run/log log
- fi
-}
-pkg_jail_create_jail_mount()
-{
- if test ! -d "${pkg_jail_dir}/procfs/1"
- then
- if test ! -d "${pkg_jail_dir}/procfs"
- then
- mkdir "${pkg_jail_dir}/procfs"
- fi
- mount -t procfs -o ro procfs "${pkg_jail_dir}/procfs"
- fi
- if test ! -f "${pkg_jail_dir}/usr/src/Makefile"
- then
- mount -t nullfs -o ro /usr/src "${pkg_jail_dir}/usr/src"
- fi
- if test ! -f "${pkg_jail_dir}/usr/ports/Makefile"
- then
- mount -t nullfs -o rw /usr/ports "${pkg_jail_dir}/usr/ports"
- fi
-}
-pkg_jail_start()
-{
- echo "Starting jail-${pkg_jail_hostname}-${pkg_jail_ip}"
- if test ! -d "${pkg_jail_dir}"
- then
- echo "${pkg_jail_dir}: Directory not found" >&2
- exit 1
- fi
- pkg_jail_create_devfs
- pkg_jail_create_jail_mount "${pkg_jail_dir}"
- sysctl security.jail.sysvipc_allowed=1
- /usr/sbin/jail -c name="${pkg_jail_short}" path="${pkg_jail_dir}" \
- host.hostname="${pkg_jail_hostname}" \
- allow.sysvipc allow.raw_sockets \
- ip4.addr="${pkg_jail_ip}"\
- command=/bin/sh /etc/rc
-}
-pkg_jail_status()
-{
- /usr/sbin/jls | grep "${pkg_jail_hostname}"
-}
-pkg_jail_free()
-{
- pkg_jail_status |
- while read jid dummy
- do
- if test "${jid}" -lt 1
- then
- continue
- fi
- echo "jail is already running" >&2
- pkg_jail_status >&2
- exit 69
- done
-}
-pkg_jail_umount()
-{
- for dir in \
- "${pkg_jail_dir}/usr/ports" \
- "${pkg_jail_dir}/usr/src" \
- "${pkg_jail_dir}/procfs" \
- "${pkg_jail_dir}/dev" \
-
- do
- fstab=`fgrep "${dir}" /etc/fstab`
- if test -n "${fstab}"
- then
- continue
- fi
- mount=`mount | fgrep "${dir}"`
- if test -n "${mount}"
- then
- umount "${dir}"
- fi
- done
-}
-pkg_jail_init()
-{
- if pkg_jail_free
- then
- pkg_jail_setup
- pkg_jail_create_devfs
- pkg_jail_create_jail_mount "${pkg_jail_dir}"
- /usr/sbin/jail -c name="${pkg_jail_short}" path="${pkg_jail_dir}" \
- host.hostname="${pkg_jail_hostname}" \
- allow.sysvipc allow.raw_sockets \
- ip4.addr="${pkg_jail_ip}"\
- command=/bin/sh -c "cd /usr/ports/ports-mgmt/pkg_jail && make install-ports"
- pkg_jail_umount
- fi
-}
-pkg_jail_shell()
-{
- if pkg_jail_free
- then
- echo "Shell in jail-${pkg_jail_hostname}-${pkg_jail_ip}"
- pkg_jail_create_devfs
- pkg_jail_create_jail_mount "${pkg_jail_dir}"
- /usr/sbin/jail -c name="${pkg_jail_short}" path="${pkg_jail_dir}" \
- host.hostname="${pkg_jail_hostname}" \
- allow.sysvipc allow.raw_sockets \
- ip4.addr="${pkg_jail_ip}"\
- command=/bin/csh
- pkg_jail_umount
- fi
-}
-pkg_jail_list()
-{
- /usr/sbin/jls | grep "${pkg_jail_hostname}" |
- while read jid dummy
- do
- if test "${jid}" -lt 1
- then
- continue
- fi
- ps -ax -o pid= -o jid= -o command= |
- while read pid pjid command
- do
- if test "${pjid}" != "${jid}"
- then
- continue
- fi
- echo "${pid} ${pjid} ${command}"
- done
- done
-}
-pkg_jail_stop()
-{
- /usr/sbin/jls | grep "${pkg_jail_hostname}" |
- while read jid dummy
- do
- if test "${jid}" -lt 1
- then
- continue
- fi
- killall -j "${jid}"
- done
- pkg_jail_umount
-}
-
-load_rc_config $name
-run_rc_command "$1"
-# eof
diff --git a/ports-mgmt/pkg_jail/files/pkg_jail.1 b/ports-mgmt/pkg_jail/files/pkg_jail.1
deleted file mode 100644
index 750c41af1c09..000000000000
--- a/ports-mgmt/pkg_jail/files/pkg_jail.1
+++ /dev/null
@@ -1,84 +0,0 @@
-.\" $Id: pkg_jail.1,v 1.1 2018/03/31 06:51:36 cvs Exp $
-.TH PKG_JAIL 1 "April 2010" "FreeBSD" "User Manuals"
-.SH NAME
-pkg_jail \- Easy handling of a jail for package-builds.
-.SH SYNOPSIS
-.TP
-.B pkg_jail [command]
-.SH DESCRIPTION
-.B pkg_jail
-is a script to handle an clean jail for package-builds.
-.SH ARGUMENTS
-.TP
-.B init
-Creates or updates a clean jail with "installworld" and populate /etc inside the jail.
-You need to have a sucessful "buildword" made in /usr/src before this.
-.TP
-.B start
-Start the jail as a guest server.
-You should have setup sshd inside the jail to login and maintain it with this option.
-.TP
-.B shell
-Start the jail and give a shell back. You can build packages now.
-.TP
-.B list
-Show processes running in the jail.
-You need to have /proc mounted (readonly) in the host.
-.TP
-.B stop
-Kill processes running in the jail.
-You need to have /proc mounted (readonly) in the host.
-.TP
-.B restart
-Same as "stop" and "start"
-.SH "IMPLEMENTATION NOTES"
-.TP
-.B /proc
-/proc will be mounted readonly via procfs inside the jail.
-.TP
-.B /usr/src
-if /usr/src/Makefile does not exists inside the jail,
-/usr/src will be mounted readonly via nullfs from the the host into the jail.
-.TP
-.B pkg_jail_hostname
-The hostname of the jail.
-.TP
-.B pkg_jail_short
-A short name for the jail.
-.TP
-.B pkg_jail_ip
-The ip-address for the jail.
-.TP
-.B pkg_jail_dir
-The new root for the jail.
-.TP
-.B pkg_jail_rule
-The rulset number the script uses for the devfs inside the jail.
-.SH RETURN VALUES
-undefined.
-.SH "FILES"
-The variables can be set in /etc/rc.conf or in $PREFIX/etc/pkg_jail.conf.
-.SH "EXAMPLES"
-.B Setting up the Jail Directory Tree
-.P
-Install all Files with the following comands on the host:
-.IP
-cd /usr/src && make buildworld
-.br
-pkg_jail init
-.TP
-.B Creating a Package
-.P
-Change to your management directory and execute pkg_upgrade:
-.IP
-cd /usr/ports/local/update
-.br
-sh pkg_update make-packages devel/gmake
-.SH "SEE ALSO"
-.TP
-.B pkg_update(1)
-The tool to create packages inside the jail.
-.SH "HISTORY"
-http://www.dinoex.net/training/package.html
-.SH "AUTHOR"
-Dirk Meyer, dinoex@FreeBSD.org
diff --git a/ports-mgmt/pkg_jail/files/pkg_update b/ports-mgmt/pkg_jail/files/pkg_update
deleted file mode 100644
index 00bdc0c1efbb..000000000000
--- a/ports-mgmt/pkg_jail/files/pkg_update
+++ /dev/null
@@ -1,2077 +0,0 @@
-#!/bin/sh
-# $Id: pkg_update,v 2.0 2018/03/25 16:55:32 cvs Exp $
-# $FreeBSD$
-#
-# Copyright (c) 2001-2018 by Dirk Meyer. All rights reserved.
-# Im Grund 4, 34317 Habichtswald, Germany
-# Email: dirk.meyer@dinoex.sub.org
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the author nor the names of any co-contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# -------------------------------------------------------------------------
-#
-#
-
-quiet_mkdir() {
- for dir in "${@}"
- do
- if test ! -d "${dir}"
- then
- mkdir "${dir}"
- fi
- done
-}
-#
-# clean all data that is listed in mtree
-# Usage: cleanmtree prefix local-temp-directory mtree-file
-cleanmtree() {
- prefix="${1}"
- tmplocal="${2}"
- mkdir "${tmplocal}"
- mtree -duqn -p "${tmplocal}" -f "${3}" >> /dev/null
- find -d "${tmplocal}" -type d |
- sed "s=${tmplocal}==" |
- while read name
- do
- rmdir "${tmplocal}/${name}"
- if test -d "${prefix}/${name}"
- then
- rmdir "${prefix}/${name}"
- fi
- done
-}
-
-# fiter stdin for dirs already in pkg-plist of a port
-plist_dir() {
- while read dir
- do
- dirrm="@dirrm ${dir}"
- if test -f pkg-plist
- then
- if fgrep -q -x "${dirrm}" pkg-plist
- then
- continue
- fi
- if fgrep -q -x "%%PORTDOCS%%${dirrm}" pkg-plist
- then
- continue
- fi
- fi
- echo "${dirrm}"
- done
-}
-
-# generate sed command file to reverse PLIST_SUB
-plist_sub() {
- subs="${1}"
- echo "s=$(make -V PREFIX)/==g" > "${subs}"
- make -V PLIST_SUB |
- awk -F = '
-END {
- for (I=0; I<COUNT; I++) {
- MAXL = 0
- MAXJ = 0
- for (J in LVAL) {
- TEST = length( LVAL[J] )
- if ( TEST > MAXL ) {
- MAXL = TEST
- MAXJ = J
- }
- }
- print "s=" LVAL[ MAXJ ] "=%%" LKEY[ MAXJ ] "%%=g"
- LVAL[MAXJ] = ""
- }
-}
-{
- QT = "\""
- LINE = $0
- gsub( "[ \t]$", "", LINE )
- while ( LINE != "" ) {
- gsub( "^[ \t]*", "", LINE )
- gsub( ":=", "=", LINE )
- if ( ! match( LINE, "^[A-Z][0-9A-Z_]*=" ) ) {
- print "error:" LINE
- break
- }
- KEY = substr( LINE, RSTART, RLENGTH - 1 )
- LINE = substr( LINE, RSTART + RLENGTH )
- if ( substr( LINE, 1, 1 ) == QT ) {
- LINE = substr( LINE, 2 )
- I = index( LINE, "\"" )
- VAL = substr( LINE, 1, I - 1 )
- LINE = substr( LINE, I + 1 )
- } else {
- I = index( LINE, " " )
- VAL = substr( LINE, 1, I - 1 )
- LINE = substr( LINE, I )
- }
- if ( KEY == "LIB32DIR" )
- continue
- if ( KEY == "XAWVER" )
- continue
- if ( VAL == "" )
- continue
- if ( VAL == "@comment " )
- continue
- if ( VAL == "%D" )
- continue
- gsub( "[.]", "[.]", VAL )
- LVAL[ COUNT ] = VAL
- LKEY[ COUNT ] = KEY
- COUNT++
- }
-}' >> "${subs}"
-}
-
-read_env_local() {
- local_env=""
- if test -f "${fulldir}/Env.local"
- then
- echo "=== Reading ${fulldir}/Env.local"
- local_env=`tr '\n' ' ' < "${fulldir}/Env.local"`
- fi
-}
-
-get_mflavor() {
- if test "${1}" != ""
- then
- echo "FLAVOR=${1}"
- fi
-}
-
-get_flavor_dir() {
- case "${1}" in
- *@*)
- echo "${1##*@}"
- ;;
- esac
-}
-
-add_flavor() {
- if test "${1}" != ""
- then
- echo "@${1}"
- fi
-}
-
-run_pkg_add() {
- env ${pkg_env} ${local_env} pkg add "${pkgfile}"
- installed=`pkg query -e "%o == ${dir}" '%o'`
- if test "${installed}" = "${dir}"
- then
- return 0
- fi
- return 1
-}
-
-run_pkg_installed() {
- # more then one Flavor can be installed
- installed=`pkg query -e "%o == ${dir}" '%o' | head -1`
- if test "${installed}" = "${dir}"
- then
- echo "#installed: ${pkgname} from ${dir}"
- return 0
- fi
- return 1
-}
-
-run_pkg_match() {
- pkgname=`run_pkg_info_installed "${origin}"`
- required_by=`pkg info --required-by "${pkgname}" | wc -l`
- if test "${required_by}" -gt 1
- then
-# echo "${origin} (dependency)"
- return 0
- fi
- echo "${origin}"
- return 0
-}
-
-run_pkg_add_missing() {
- pkgname=`make -V PKGNAME`
- pkgfile=`make -V PKGFILE`
- dir="${fulldir##${portsdir}/}"
- dir="${dir##${localdir}/}"
- installed=`pkg query -e "%o == ${dir}" '%o'`
- if test "${installed}" = "${dir}"
- then
- return 1
- fi
- if test ! -e "${pkgfile}"
- then
- return 0
- fi
- if run_pkg_add
- then
- return 1
- fi
- return 0
-}
-
-run_pkg_delete() {
- pkgname=`make -V PKGNAME`
- ${pkg} delete "${pkgname}"
-}
-
-run_pkg_delete_all() {
- installed=`pkg query -e '%p == /usr/local' '%o'; pkg query -e '%p == /compat/linux' '%o';`
- if test "${installed}" = ""
- then
- return
- fi
- ${pkg} delete -y -f ${installed}
- return
-}
-
-run_pkg_info_installed() {
- ${pkg} query -e "%o == ${1}" '%o'
-}
-
-run_pkg_info_origin_file() {
- pflavor=`${pkg} info -q --annotations -F "${1}" | grep "^flavor"`
- pflavor="${pflavor##flavor*: }"
- porigin=`${pkg} info -q -o -F "${1}"`
- if test "${pflavor}" = ""
- then
- echo "${porigin}"
- else
- echo "${porigin}@${pflavor}"
- fi
-}
-
-run_pkg_info_origin_name() {
- ${pkg} info -q -o "${1}"
-}
-
-run_pkg_info_origin_all() {
- ${pkg} query '%o'
-}
-
-run_pkg_info_dependecies() {
- ${pkg} info -q --dependencies -F "${1}"
-}
-
-run_pkg_info_list() {
- ${pkg} info
-}
-
-run_pkg_info_requiredby() {
- ${pkg} info -q -r "${1}"
-}
-
-dependency_is_good() {
- if test ! -d "${fulldir}"
- then
- echo "Directory not found: ${fulldir}"
- echo "Directory not found: ${fulldir}" >> ${tmpupdated}
- return 1
- fi
- dir="${fulldir##${portsdir}/}"
- dir="${dir##${localdir}/}"
- if test "${dir}" = ""
- then
- echo "Directory bad: ${fulldir}"
- echo "Directory bad: ${fulldir}" >> ${tmpupdated}
- return 1
- fi
- pkgname=`cd ${fulldir} && make -V PKGNAME`
- if run_pkg_installed
- then
- return 2
- fi
- pkgfile=`cd ${fulldir} && make -V PKGFILE`
- if test -e ${pkgfile}
- then
- return 0
- fi
- noinstall=`cd "${fulldir}" && make -V NO_INSTALL`
- case "${noinstall}" in
- yes|YES)
- return 2
- ;;
- esac
- echo "# missing package: ${pkgname} from ${dir}"
- echo "# missing package: ${pkgname} from ${dir}" >> ${tmpupdated}
- return 3
-}
-
-# check dependencies and decides if a ports needs to be rebuild
-# Usage: port_uptodate show
-# Usage: port_uptodate make
-port_uptodate() {
- tmpupdated="/tmp/port-updated.$$"
- tmpfailed="/tmp/port-failed.$$"
- mflavor=`get_mflavor "${2}"`
- add_flavor=`add_flavor ${2}`
- case "${1}" in
- show)
- rm -f "${logdir}/"show*
- ;;
- esac
- #
- case "${1}" in
- show*|make*)
- dir="$(make -V PKGORIGIN)"
- base="${portsdir}/${dir}"
- base1=`pwd`
- base2=`cd "${base}" && pwd`
- if test ! "${base1}" = "${base2}"
- then
- echo "# WARNING: PKGORIGIN=${base2} does not match ${base1}"
- echo "# WARNING: using ${base}"
- fi
- echo "## ${base}: port_uptodate ${1} ${2}"
- pkgname=`make -V PKGNAME ${mflavor}`
- pkgfile=`make -V PKGFILE ${mflavor}`
- mainpkg="${pkgname}"
- for=""
- found=""
- mainpkgfile=""
- rm -f "${tmpupdated}" "${tmpfailed}"
- if run_pkg_installed
- then
- found="1"
- else
- if test -e ${pkgfile}
- then
- echo "pkg_add ${pkgfile}"
- mainpkgfile="${pkgfile}"
- found="1"
- fi
- fi
- ;;
- *)
- echo "port_uptodate: bad arguments" >&2
- return 64
- ;;
- esac
- #
- # creates dependency
- env ${pkg_env} make checksum ${mflavor} >&2
- #
- if test ! -e "${depends}"
- then
- # create empy list
- touch "${depends}"
- fi
- #
- for depdir_flavors in `
- (
- env ${pkg_env} make build-depends-list ${mflavor}
- env ${pkg_env} make package-depends-list ${mflavor} | cut -d " " -f2
- ) |
- sed -f "${depends}"`
- do
- fulldir="${depdir_flavors%@*}"
- flavor=`get_flavor_dir "${depdir_flavors}"`
- dir=""
- pkgname=""
- pkgfile=""
- dependency_is_good "${1}"
- err="${?}"
- case "${err}" in
- 0) # exist
- echo "dependency_is_good"
- log=`echo "${dir}${add_flavor}" | sed -e 's=/=,=g'`
- case "${1}" in
- xshow*)
- if test ! -f "${logdir}/show,${log}"
- then
- # check dependend package is ok!
- ( cd ${fulldir} && port_uptodate ${1}+ ${flavor} )
- touch "${logdir}/show,${log}"
- fi
- ;;
- xmake*)
- if test ! -f "${logdir}/check,${log}"
- then
- # check dependend package is ok!
- ( cd ${fulldir} && port_uptodate ${1}+ ${flavor} )
- touch "${logdir}/check,${log}"
- if run_pkg_installed
- then
- continue
- fi
- fi
- ;;
- esac
-
- if test "${mainpkgfile}" != ""
- then
- if test "${pkgfile}" -nt "${mainpkgfile}"
- then
- echo "# dependend package newer: ${pkgfile} ${mainpkgfile}"
- echo "# dependend package newer: ${pkgfile} ${mainpkgfile}" >> ${tmpupdated}
- fi
- fi
- echo "#existing package: ${pkgname} from ${dir}${for}"
- echo "pkg_add ${pkgfile}"
- case "${1}" in
- make*)
- if run_pkg_add
- then
- continue
- fi
- echo "pkg_add ${pkgfile} failed, no ${pkgname}!"
- echo "=== dependend package failed to add: ${pkgfile} ${pkgname}" >&2
- echo "=== dependend package failed to add: ${pkgfile} ${pkgname}" >> ${tmpfailed}
- echo "=== dependend package failed to add: ${pkgfile} ${pkgname}" >> ${logdir}/err,${log}
- break
- ;;
- esac
- continue
- ;;
- 1) # abort
- break
- ;;
- 2) # installed
- continue
- ;;
- 3) # missing
- log=`echo "${dir}${add_flavor}" | sed -e 's=/=,=g'`
- case "${1}" in
- make*)
- echo "cd ${fulldir} && port_uptodate ${1}+ ${flavor}"
- ( cd ${fulldir} && port_uptodate ${1}+ ${flavor} )
- if run_pkg_installed
- then
- continue
- fi
- echo "=== package ${pkgname} error dependency" >&2
- echo "=== package ${pkgname} error dependency" >> ${tmpfailed}
- echo "=== package ${pkgname} error dependency" >> ${logdir}/err,${log}
- break
- ;;
- esac
- ;;
- esac
- done
- pkgname="${mainpkg}"
- mflavor=`get_mflavor "${2}"`
- if test -e "${tmpfailed}"
- then
- fulldir=`pwd`
- dir="${fulldir##${portsdir}/}"
- dir="${dir##${localdir}/}"
- echo "=====================================" >&2
- echo "=== package ${pkgname} missing dependency" >&2
- cat ${tmpfailed} >&2
- echo "=====================================" >&2
- if test "${dir}" != ""
- then
- log=`echo "${dir}${add_flavor}" | sed -e 's=/=,=g'`
- cat ${tmpfailed} >> ${logdir}/err,${log}
- fi
- rm -f "${tmpfailed}" "${tmpupdated}"
- return 1
- fi
- if test "${found}" = "" -o -e "${tmpupdated}"
- then
- rm -f "${tmpupdated}"
- dir="${base##${portsdir}/}"
- dir="${dir##${localdir}/}"
- log=`echo "${dir}${add_flavor}" | sed -e 's=/=,=g'`
- local_env=""
- if test -f "${base}/Env.local"
- then
- echo "=== Reading ${base}/Env.local"
- local_env=`tr '\n' ' ' < "${base}/Env.local"`
- fi
- prefix="/usr/local"
- if test ! -d "${prefix}"
- then
- mkdir -p "${prefix}"
- fi
- echo "cd ${base} && env ${pkg_env} ${local_env} make package ${mflavor} > ${logdir}/err,${log} 2>&1"
- case "${1}" in
- make*)
- ( cd "${base}" && env ${pkg_env} ${local_env} make package ${mflavor} </dev/null >> "${logdir}/err,${log}" 2>&1 )
- pkgfile=`cd "${base}" && make -V PKGFILE`
- if test -e "${pkgfile}"
- then
- if test -f "${logdir}/build,${log}"
- then
- mv -f "${logdir}/build,${log}" "${logdir}/last,${log}"
- fi
- ( cd ${base} && env ${pkg_env} make stage-qa check-orphans check-sanity </dev/null >> "${logdir}/err,${log}" 2>&1 )
- mv -f "${logdir}/err,${log}" "${logdir}/build,${log}"
- ( cd ${base} && env ${pkg_env} make clean NOCLEANDEPENDS=yes ${mflavor} )
- if run_pkg_installed
- then
- return 0
- fi
- noinstall=`cd "${base}" && make -V NO_INSTALL`
- case "${noinstall}" in
- yes|YES)
- return 0
- ;;
- esac
- nostage=`cd "${base}" && make -V NO_STAGE`
- case "${nostage}" in
- yes|YES)
- echo "=====================================" >&2
- echo "=== package ${pkgname} was not installed" >&2
- echo "=====================================" >&2
- echo "=== package ${pkgname} was not installed" \
- >> ${logdir}/err,${log}
- return 2
- ;;
- *)
- # install staged package
- pkgfile=`cd "${base}" && make -V PKGFILE`
- if run_pkg_add
- then
- return 0
- fi
- echo "=====================================" >&2
- echo "=== pkg_add ${pkgfile}, no ${pkgname}!" >&2
- echo "=====================================" >&2
- echo "=== package ${pkgname} can not be installed" \
- >> ${logdir}/err,${log}
- return 2
- esac
- fi
- pkgfile=`cd "${base}" && make -V PKGFILE`
- if test -e "${pkgfile}"
- then
- if test -f "${logdir}/build,${log}"
- then
- mv -f "${logdir}/build,${log}" "${logdir}/last,${log}"
- fi
- mv -f "${logdir}/err,${log}" "${logdir}/build,${log}"
- ( cd ${base} && env ${pkg_env} make clean NOCLEANDEPENDS=yes )
- return 0
- else
- echo "=====================================" >&2
- echo "=== package ${pkgname} was not build" >&2
- echo "=====================================" >&2
- echo "=== package ${pkgname} was not build" \
- >> ${logdir}/err,${log}
- return 2
- fi
- ;;
- show*)
- echo "if test ! -e \"${pkg_dbdir}/${mainpkg}/+CONTENTS\""
- echo "then"
- echo " echo \"=====================================\" >&2"
- echo " echo \"=== package ${pkgname} was not build\" >&2"
- echo " echo \"=====================================\" >&2"
- echo " exit 2"
- echo "fi"
- echo "mv -f \"${logdir}/err,${log}\" \"${logdir}/build,${log}\""
- return 1
- ;;
- esac
- else
- rm -f "${tmpupdated}"
- if test "${found}" = "1"
- then
- echo "#ok"
- return 0
- fi
- echo "#not made"
- return 1
- fi
-}
-
-# make all packages to build a port in a clean jail
-# Usage: make_packages_in_dir directory
-make_packages_in_dir() {
- tmpshow="/tmp/check-package.$$"
- dir="${1%@*}"
- main_flavor=`get_flavor_dir "${1}"`
- if test "${dir}" = ""
- then
- return
- fi
- if test ! -d "${dir}"
- then
- dir="${portsdir}/${dir}"
- fi
- if test -d "${dir}"
- then
- (
- echo ""
- echo "# checking: ${dir} ${main_flavor}"
- cd "${dir}" || return 69
-
- wrkdir=`make -V WRKDIRPREFIX`
- prefix="/usr/local"
- if ! test "${wrkdir}" = ""
- then
- rm -rf "${wrkdir}"/*
- run_pkg_delete_all
- rm -rf "${prefix}"/*
- fi
-
- port_uptodate show ${main_flavor} > "${tmpshow}"
- err="${?}"
-
- case "${err}" in
- 1)
- port_uptodate make ${main_flavor}
- err="${?}"
- if test "${err}" != "0"
- then
- echo "port_uptodate: aborted!"
- return
- fi
-
- env ${pkg_env} make deinstall
- run_pkg_delete_all
- if test -f ${localdir}/data/badfiles
- then
- grep -v "^#" ${localdir}/data/badfiles |
- while read bad
- do
- if test -f "${bad}"
- then
- rm -f "${bad}"
- fi
- if test -L "${bad}"
- then
- rm -f "${bad}"
- fi
- done
- fi
- if test -f ${localdir}/data/baddirs
- then
- grep -v "^#" ${localdir}/data/baddirs |
- while read bad
- do
- if test -d "${bad}"
- then
- rmdir "${bad}"
- fi
- done
- fi
- plistlog="${logdir}/plist,$(make -V PKGORIGIN | sed -e 's=/=,=')${add_flavor}"
- subs="${plistlog}.sed"
- plist_sub "${subs}"
- echo -n "" > "${plistlog}"
- if test -d /root/GNUstep
- then
- find -d /root/GNUstep -type f >> "${plistlog}"
- find -d /root/GNUstep -type d |
- sed -e 's=^=@dirrm =' >> "${plistlog}"
- rm -rf /root/GNUstep
- fi
- if test -d "${prefix}"
- then
- find -d "${prefix}" -type f -or -type l |
- sort |
- sed -f "${subs}" >> "${plistlog}"
- if test -f "${portsdir}/Templates/BSD.local.dist"
- then
- cleanmtree "${prefix}" /tmp/local \
- "${portsdir}/Templates/BSD.local.dist"
- else
- cleanmtree "${prefix}" /tmp/local \
- "/etc/mtree/BSD.local.dist"
- fi
- if test -d "${prefix}"
- then
- find -d "${prefix}" -type d |
- sort -r |
- sed -f "${subs}" |
- plist_dir >> "${plistlog}"
- fi
- fi
- rm -f "${subs}"
- if test ! -s "${plistlog}"
- then
- rm -f "${plistlog}"
- fi
- ;;
- esac
- rm -f "${tmpshow}"
- )
- else
- case "${dir}" in
- '')
- ;;
- *nonexistent)
- ;;
- *)
- echo "## dir does not exist: ${dir}"
- echo "## dir does not exist: ${dir}" \
- >> ${localdir}/make-packages.errlog
- ;;
- esac
- fi
-}
-#
-# make all packages to build and install a port to a host
-# Usage: add_packages_in_dir directory
-add_packages_in_dir() {
- tmpshow="/tmp/check-package.$$"
- fulldir="${1%@*}"
- main_flavor=`get_flavor_dir "${1}"`
- if test "${fulldir}" = ""
- then
- return
- fi
- case "${fulldir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${fulldir}"
- then
- xdir="${portsdir}/${dir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${fulldir}"
- return
- fi
- fulldir="${xdir}"
- fi
-
- (
- echo "# checking: ${fulldir}"
- cd "${fulldir}" || return 69
-
- port_uptodate show ${main_flavor} > "${tmpshow}"
- err="${?}"
- case "${err}" in
- 0)
- if run_pkg_add_missing
- then
- exit 1
- fi
- ;;
- 1)
- port_uptodate make ${main_flavor}
- ;;
- esac
- rm -f "${tmpshow}"
- )
-}
-#
-# install the existing packages from a port to a host
-# Usage: install_packages_in_dir directory
-install_packages_in_dir() {
- fulldir="${1%@*}"
- main_flavor=`get_flavor_dir "${1}"`
- if test "${fulldir}" = ""
- then
- return
- fi
- case "${fulldir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${fulldir}"
- then
- xdir="${portsdir}/${fulldir}"
- if test ! -d "${xdir}"
- then
- movedto=`get_new_origin "${fulldir}"`
- if test "${movedto}" = "nonexistent"
- then
- echo "## port removed: ${fulldir}"
- return
- fi
- if test "${movedto}" = "${dir}"
- then
- echo "## dir does not exist: ${fulldir}"
- return
- fi
- echo "## dir moved: ${dir} -> ${movedto}"
- xdir="${portsdir}/${movedto}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${movedto}"
- return
- fi
- fi
- fulldir="${xdir}"
- fi
-
-# echo "# checking: ${dir}"
- (
- cd "${fulldir}" || return 69
- if run_pkg_add_missing
- then
- echo "## package does not exist: ${pkgfile}"
- echo "(cd ${fulldir} && make package ${main_flavor})"
- fi
- )
-}
-#
-# show the existing packages from a port to a host
-# Usage: show_packages_in_dir directory
-show_packages_in_dir() {
- fulldir="${1%@*}"
- main_flavor=`get_flavor_dir "${1}"`
- if test "${fulldir}" = ""
- then
- return
- fi
- case "${fulldir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${fulldir}"
- then
- xdir="${portsdir}/${dir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${fulldir}"
- return
- fi
- fulldir="${xdir}"
- fi
-
- (
-# echo "# checking: ${fulldir}"
- cd "${fulldir}" || return 69
- if run_pkg_add_missing
- then
- echo "## package does not exist: ${pkgfile}"
- echo "(cd ${dir} && make package ${main_flavor})"
- fi
- )
-}
-#
-# delete the existing packages on this host
-# Usage: deinstall_packages_in_dir directory
-deinstall_packages_in_dir() {
- fulldir="${1}"
- if test "${fulldir}" = ""
- then
- return
- fi
- case "${fulldir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${fulldir}"
- then
- xdir="${portsdir}/${fulldir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${dir}"
- return
- fi
- fulldir="${xdir}"
- fi
-
- (
-# echo "# checking: ${fulldir}"
- cd "${fulldir}" || return 69
- run_pkg_delete "${pkgname}"
- )
-}
-#
-#
-# show the existing packages from a port to a host
-# Usage: show_missing_packages_in_dir directory
-show_missing_packages_in_dir() {
- dir="${1}"
- if test "${dir}" = ""
- then
- return
- fi
- case "${dir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${dir}"
- then
- xdir="${portsdir}/${dir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${dir}"
- return
- fi
- dir="${xdir}"
- fi
-
- (
-# echo "# checking: ${dir}"
- cd "${dir}" || return 69
- pkgfile=`make -V PKGFILE`
- if test -f "${pkgfile}"
- then
- return
- fi
- echo "## package does not exist: ${pkgfile}"
- echo "(cd ${dir} && make package)"
- )
-}
-#
-# fetch the distfiles for a port
-# Usage: fetch_distfiles_in_dir directory
-fetch_distfiles_in_dir() {
- dir="${1}"
- if test "${dir}" = ""
- then
- return
- fi
- case "${dir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${dir}"
- then
- xdir="${portsdir}/${dir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${dir}"
- return
- fi
- dir="${xdir}"
- fi
-
- (
- echo "# checking: ${dir}"
- cd "${dir}" || return 69
-
- make fetch
- )
-}
-#
-# fetch the distfiles for a port
-# Usage: fetch_recursive_distfiles_in_dir directory
-fetch_recursive_distfiles_in_dir() {
- dir="${1}"
- if test "${dir}" = ""
- then
- return
- fi
- case "${dir}" in
- *nonexistent)
- return
- ;;
- esac
- if test ! -d "${dir}"
- then
- xdir="${portsdir}/${dir}"
- if test ! -d "${xdir}"
- then
- echo "## dir does not exist: ${dir}"
- return
- fi
- dir="${xdir}"
- fi
-
- (
- echo "# checking: ${dir}"
- cd "${dir}" || return 69
-
- make fetch-recursive
- )
-}
-#
-#
-#
-move_dependent_away() {
- local incache
- grep -l -r "^${1}"'$' "${pkginfo_cache}/" |
- while read incache
- do
- file="${incache#${pkginfo_cache}/}"
- move_away "${file}"
- if test -f "${incache}"
- then
- # obsolte cache file
- rm -f "${incache}"
- fi
- done
-}
-#
-# move outdated package int seperate dir for cleanup
-# usage: move_away package
-move_away() {
- if test -d "${pkgold}" -a -f "${1}"
- then
- # move it if the "Old" directory exists.
- mv -f "${1}" "${pkgold}/${1}"
- file="${1##*/}"
- saved="${pkginfo_cache}/${file}"
- if test -f "${saved}"
- then
- rm -f "${saved}"
- fi
- move_dependent_away "${file%${ext}}"
- fi
-}
-#
-# cache pkg_info -r
-# usage: pkg_info_dependecies package
-pkg_info_dependecies()
-{
- file="${1##*/}"
- saved="${pkginfo_cache}/${file}"
- if test "${saved}" -nt "${1}"
- then
- cat "${saved}"
- return
- fi
- run_pkg_info_dependecies "${1}" |
- tee "${saved}"
-}
-
-#
-# check all packages in ${PACKAGES}/All/
-# Usage: clean_package_all
-clean_package_all() {
- (
- cd ${pkgall} || exit 69
- for i in *
- do
- # is the package already moved away?
- if test ! -f "${i}"
- then
- continue
- fi
- case "${i}" in
- digests.txz|meta.txz|packagesite.txz)
- continue
- ;;
- esac
- # ist this package up to date?
- origin_flavors=`run_pkg_info_origin_file "${i}"`
- origin="${origin_flavors%@*}"
- flavor=`get_flavor_dir "${origin_flavors}"`
- mflavor=`get_mflavor "${flavor}"`
- if test "${origin}" = ""
- then
- echo "${i}: missing origin"
- move_away ${i}
- continue
- fi
- depdir="${portsdir}/${origin}"
- if test ! -d "${depdir}"
- then
- echo "${i}: missing ports dir => ${depdir}"
- move_away ${i}
- continue
- fi
- pnew=`cd "${depdir}" && make -V PKGFILE ${mflavor}`
- if test ! "${pnew}" = "${pkgall}/${i}"
- then
- if test ! "${pnew}" = ""
- then
- echo "${i}: is obsolete => ${pnew}"
- else
- echo "${i}: missing or defunt Makefile in dir => ${depdir}"
- fi
- move_away ${i}
- continue
- fi
- ptarget="${pnew}"
- #
- # check each depended package
- pkg_info_dependecies "${ptarget}" |
- while read dep
- do
- pmade="${dep}${ext}"
- if test -f "${pkgall}/${pmade}"
- then
- #
- # find matching port directory (origin)
- origin_flavors=`run_pkg_info_origin_file "${pmade}"`
- origin="${origin_flavors%@*}"
- flavor=`get_flavor_dir "${origin_flavors}"`
- mflavor=`get_mflavor "${flavor}"`
- if test "${origin}" = ""
- then
- echo "${i}: missing origin"
- move_away ${i}
- break
- fi
- depdir="${portsdir}/${origin}"
- if test ! -d "${depdir}"
- then
- echo "${i}: dependency ${pmade} missing ports dir => ${depdir}"
- move_away ${i}
- break
- fi
- pnew=`cd "${depdir}" && make -V PKGFILE ${mflavor}`
- if test "${pnew}" = "${pkgall}/${pmade}"
- then
- if test "${pmade}" -nt "${ptarget}"
- then
- echo "${i}: dependend package ${pmade} newer"
- move_away ${i}
- break
- fi
- #
- # up to date
- continue
- fi
- echo "${i}: dependency ${pmade} is obsolete => ${pnew}"
- move_away ${i}
- break
- else
-# noinstall=`cd "${depdir}" && make -V NO_INSTALL`
-# case "${noinstall}" in
-# yes|YES)
-# continue
-# ;;
-# esac
- echo "${i}: dependency ${pmade} missing!"
- move_away ${i}
- break
- fi
- done
- done
- )
-}
-#
-# check all packages in ${PACKAGES}/All/ and move if port uses openssl
-# Usage: clean_package_openssl
-clean_package_openssl() {
- (
- cd ${pkgall} || exit 69
- for i in *
- do
- origin_flavors=`run_pkg_info_origin_file "${i}"`
- origin="${origin_flavors%@*}"
- flavor=`get_flavor_dir "${origin_flavors}"`
- mflavor=`get_mflavor "${flavor}"`
- if test "${origin}" = ""
- then
- continue
- fi
- depdir="${portsdir}/${origin}"
- if test ! -d "${depdir}"
- then
- continue
- fi
- openssl=`cd "${depdir}" && make -V USE_OPENSSL ${mflavor}`
- if test "${openssl}" = ""
- then
- continue
- fi
- echo "${i}: depends on openssl!"
- move_away ${i}
- done
- )
-}
-#
-# check all links in ${PACKAGES}/
-# Usage: clean_package_links
-clean_package_links() {
- #
- # find all links
- find ${packages} -type l |
- while read link
- do
- if test -s "${link}"
- then
- #
- # it results in a real file
- continue
- fi
- #
- # remove stale link
- rm -f "${link}"
- done
-}
-#
-# check fort obsolte distfiles
-# Usage: clean_distfiles
-clean_distfiles() {
- tmp1="/tmp/all-distinfo"
- tmp2="/tmp/all-distfiles"
- rm -f "${tmp2}"
- find "${tmp1}" -type f -mtime +6h -exec rm -f {} \;
- if ! test -f "${tmp1}"
- then
- echo "Processing ... distinfo"
- find ${portsdir}/ -type f -name "distinfo*" -exec \
- cut -d " " -f2 "{}" ";" |
- tr -d '()' |
- sort -u > "${tmp1}"
- fi
- if ! test -f "${tmp2}"
- then
- echo "Processing ... distfiles"
- find ${distdir}/ -type f |
- grep -v "${old}/" |
- sed -e "s=${distdir}/==" |
- sort -u > "${tmp2}"
- fi
- echo "Processing ... differences"
- comm -13 "${tmp1}" "${tmp2}" |
- while read name
- do
- dir="/${name}"
- dir="${dir%/*}"
- echo "${dir}" "${name}"
- if test ! -d "${old}${dir}"
- then
- echo \
- mkdir -p "${old}${dir}"
- mkdir -p "${old}${dir}"
- fi
- if test -f "${old}/${name}"
- then
- if ! diff -qs "${distdir}/${name}" "${old}/${name}"
- then
- for i in `jot 99`
- do
- if test -f "${old}/${name}.${i}"
- then
- continue
- fi
- echo \
- mv -i "${distdir}/${name}" "${old}/${name}.${i}"
- mv -i "${distdir}/${name}" "${old}/${name}.${i}"
- break
- done
- if test -f "${distdir}/${name}"
- then
- echo "ignored: ${distdir}/${name}"
- fi
- continue
- fi
- echo \
- rm -f "${distdir}/${name}"
- rm -f "${distdir}/${name}"
- continue
- fi
- echo \
- mv -i "${distdir}/${name}" "${old}/${name}"
- mv -i "${distdir}/${name}" "${old}/${name}"
- done
-}
-#
-# Sync distfiles with a mirror
-# Usage: merge_distfiles
-merge_distfiles() {
- if test ! -d "${mergedistdir}"
- then
- echo "${mergedistdir}: no such Directory" >&2
- return
- fi
- find "${distdir}" -type f |
- sort > /tmp/distfiles.1
- find "${mergedistdir}" -type f |
- sed -e "s=${mergedistdir}=${distdir}=" |
- sort > /tmp/distfiles.2
- #diff -u /tmp/distfiles.2 /tmp/distfiles.1
- comm -23 /tmp/distfiles.1 /tmp/distfiles.2 |
- while read name
- do
- dir="${name%/*}"
- xfile="${name##*/}"
- dir="${dir#${distdir}}"
- if test -f "${mergedistdir}/${dir}${xfile}"
- then
- continue
- fi
- case "${dir}" in
- /Old/*)
- echo "${mergedistdir}${dir#/Old}${xfile}"
- if test -f "${mergedistdir}${dir#/Old}${xfile}"
- then
- continue
- fi
- ;;
- *)
- echo "${mergedistdir}/Old${dir}${xfile}"
- if test -f "${mergedistdir}/Old${dir}${xfile}"
- then
- continue
- fi
- ;;
- esac
- if test ! -d "${mergedistdir}${dir}"
- then
- echo \
- mkdir -p "${mergedistdir}${dir}"
- mkdir -p "${mergedistdir}${dir}"
- fi
- echo \
- cp -pi "${name}" "${mergedistdir}${dir}/"
- cp -pi "${name}" "${mergedistdir}${dir}/"
- done
-}
-#
-# update origin ins installed package when ports has been moved
-# Usage: update_origin installed origin
-update_origin() {
- installed="${1}"
- origin="${2}"
- echo "${installed} ${origin}"
- if ! fgrep -q "${origin}|" "${portsdir}/MOVED"
- then
- fgrep "${origin}" "${cache}"
- return
- fi
- movedto=`fgrep "${origin}|" "${portsdir}/MOVED" |
- tail -1 |
- cut -d "|" -f2`
- if test "${origin}" = "${movedto}"
- then
- return
- fi
- echo "Updating: ${origin} -> ${movedto}"
- ${pkg} set -o "${origin}:${movedto}"
-}
-#
-# write new package state
-make_version_list() {
- if test ! -s "${cache}"
- then
- echo "pkg_version -v -L ="
- ${pkg} version -v -L = | grep -v bsdpan- > "${cache}"
- fi
-}
-#
-# update origin ins installed package when ports has been moved
-# Usage: fix_moved_ports
-fix_moved_ports() {
- make_version_list
- if grep -q "orphaned" "${cache}"
- then
- grep "orphaned" "${cache}" |
- while read installed flag status origin
- do
- update_origin "${installed}" "${origin}"
- done
- fi
- if egrep -q "Comparison failed" "${cache}"
- then
- egrep "Comparison failed" "${cache}" |
- while read installed flag status failed
- do
- origin=`run_pkg_info_origin_name "${installed}"`
- if test "${origin}" = ""
- then
- continue
- fi
- update_origin "${installed}" "${origin}"
- done
- fi
-}
-#
-# check recursive for deinstall
-delete_dependent_package() {
- local installed
- installed="${1}"
- run_pkg_info_requiredby "${installed}" |
- while read requiredby
- do
- delete_dependent_package "${requiredby}"
- done
- seenflag="${seen}/${installed}"
- if test -e "${seenflag}"
- then
- return
- fi
- origin=`run_pkg_info_origin_name "${installed}"`
- echo "pkg delete ${installed}"
- add_to_file "${todolist}" "${origin}" quiet
- touch "${seenflag}"
-}
-#
-# generate orderd list to deinstall all old packages on a host
-make_deinstall_list() {
- quiet_mkdir "${seen}"
- rm -f "${seen}/"*
- (
- echo "#!/bin/sh"
- cat "${cache}" |
- while read installed flag status origin
- do
- case "${flag}" in
- '<')
- delete_dependent_package "${installed}"
- ;;
- esac
- done
- ) > "${deinstall}"
- rm -f "${seen}/"*
-}
-#
-# remove_from_file file line quiet
-remove_from_file( ) {
- edit="${1}"
- pattern="${2}"
- if test ! -e "${edit}"
- then
- return
- fi
- if test `fgrep -x "${pattern}" "${edit}" | wc -l` -ge 1
- then
- if test "${quiet}" = ""
- then
- echo "remove: ${pattern} from ${edit}"
- fi
- cp -p "${edit}" "${edit}.bak"
- fgrep -v -x "${pattern}" "${edit}.bak" > "${edit}"
- rm -f "${edit}.bak"
- fi
-}
-#
-# add_to_file file line quiet
-add_to_file( ) {
- edit="${1}"
- pattern="${2}"
- if test -e "${edit}"
- then
- if test `fgrep -x "${pattern}" "${edit}" | wc -l` -gt 1
- then
- remove_from_file "${edit}" "${pattern}"
- fi
- else
- touch "${edit}"
- fi
- if ! fgrep -q -x "${pattern}" "${edit}"
- then
- if test "${quiet}" = ""
- then
- echo "register: ${pattern} in ${edit}"
- fi
- echo "${pattern}" >> "${edit}"
- fi
-}
-#
-# get_moved_origin origin
-get_new_origin() {
- local origin
- origin="${1}"
- if test -d "${portsdir}/${origin}"
- then
- echo "${origin}"
- return
- fi
- movedto=`fgrep "${origin}|" "${portsdir}/MOVED" |
- tail -1 |
- cut -d "|" -f2`
- if test "${movedto}" = ""
- then
- echo "nonexistent"
- return
- fi
- echo "${movedto}"
-}
-#
-# parse_default $#
-# global: defaultdata
-# global: target
-parse_default() {
- if test "${1}" -lt 1
- then
- if test ! -f "${defaultdata}"
- then
- usage
- fi
- exec /bin/sh "${0}" "${target}" "${defaultdata}"
- echo "error in path: ${0}" >&2
- exit 64
- fi
-}
-#
-next_target() {
- if test "${#}" -lt 2
- then
- return
- fi
- shift
- exec /bin/sh "${0}" "${@}"
-}
-#
-# make sure /etc/make.conf is set up
-validate_make_conf() {
-
- use_packges=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V USE_PACKAGE_DEPENDS`
- if test "${use_packges}" = ""
- then
- echo "### Please add to your /etc/make.conf ####" >&2
- echo "USE_PACKAGE_DEPENDS=yes" >&2
- exit 65
- fi
-
- depends_target=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V DEPENDS_TARGET`
- case "${depends_target}" in
- 'package install')
- ;;
- *)
- echo "### Please add to your /etc/make.conf ####" >&2
- echo "DEPENDS_TARGET=package install" >&2
- exit 65
- ;;
- esac
-}
-#
-# update pkg tools
-update_pkg() {
- if test -f "${pkg}"
- then
- ${pkg} delete -y -a -f
- env "PKG_DBDIR=/var/db/pkgng" ${pkg} delete -y -a -f
- fi
- /etc/rc.d/ldconfig start
- ( cd "${portsdir}/ports-mgmt/pkg" && env "FORCE_PKG_REGISTER=yes" "PKG_DBDIR=/var/db/pkgng" make clean deinstall PREFIX=/usr/pkgng PKGNAMESUFFIX=-pkgng package install )
- if test ! -L /usr/sbin/pkg
- then
- mv -f /usr/sbin/pkg /usr/sbin/pkg.orig
- ln -s "${pkg}" /usr/sbin/pkg
- fi
- ( cd "${portsdir}/ports-mgmt/pkg" && env "FORCE_PKG_REGISTER=yes" make clean package install )
- ${pkg} delete -y -f pkg
-}
-#
-#
-# update if pkg tools have changed
-check_update_pkg() {
- defaultdata="${localdir}/data/make-packages.${hostname}"
- if test ! -f "${defaultdata}"
- then
- return
- fi
- if test -f "${pkg}"
- then
- old=`env "PKG_DBDIR=/var/db/pkgng" ${pkg} query -e '%p == /usr/pkgng' %n-%v`
- pkgname=`cd "${portsdir}/ports-mgmt/pkg" && make PKGNAMESUFFIX=-pkgng -V PKGNAME`
- if test "${old}" = "${pkgname}"
- then
- if test ! -L /usr/sbin/pkg
- then
- mv -f /usr/sbin/pkg /usr/sbin/pkg.orig
- ln -s "${pkg}" /usr/sbin/pkg
- fi
- return
- fi
- fi
- update_pkg
-}
-#
-# check if we run in build jail
-check_buildjail() {
- defaultdata="${localdir}/data/make-packages.${hostname}"
- if test ! -f "${defaultdata}"
- then
- echo "${defaultdata}: no such file, aborted." >&2
- echo "!!WARNNING!! Such a file should only exist for your build jail" >&2
- echo "!!WARNNING!! This will uninstall all packages." >&2
- echo "!!WARNNING!! This will delete your config in /usr/local." >&2
- exit 64
- fi
-}
-#
-# inform usage
-usage() {
- echo "Usage:" >&2
- echo " ${0##*/} update-pkg" >&2
- echo " ${0##*/} repo" >&2
- echo " ${0##*/} make-packages [port] [...]" >&2
- echo " ${0##*/} add-packages [port] [...]" >&2
- echo " ${0##*/} install-packages [port] [...]" >&2
- echo " ${0##*/} show-packages [port] [...]" >&2
- echo " ${0##*/} show-missing-packages [port] [...]" >&2
- echo " ${0##*/} clean-packages ..." >&2
- echo " ${0##*/} clean-openssl-packages ..." >&2
- echo " ${0##*/} clean-distfiles ..." >&2
- echo " ${0##*/} merge-distfiles ..." >&2
- echo " ${0##*/} fetch-distfiles [port] [...]" >&2
- echo " ${0##*/} fetch-recursive-distfiles [port] [...]" >&2
- echo " ${0##*/} fix-moved-ports ..." >&2
- echo " ${0##*/} list-installed-ports" >&2
- echo " ${0##*/} make-version-list ..." >&2
- echo " ${0##*/} show-version-list ..." >&2
- echo " ${0##*/} make-deinstall-list ..." >&2
- echo " ${0##*/} show-missing-reinstall" >&2
- echo " ${0##*/} show-missing-installed" >&2
- echo " ${0##*/} check-reinstall" >&2
- echo " ${0##*/} reinstall" >&2
- echo " ${0##*/} clean-reinstall" >&2
- echo " ${0##*/} clean ..." >&2
- echo " ${0##*/} check-installed-ports [port]" >&2
- echo " ${0##*/} update-ports ..." >&2
- echo " ${0##*/} full-update-jail [retry] ..." >&2
- echo " ${0##*/} check-update ..." >&2
- exit 64
-}
-#
-# check empty call
-if test $# -lt 1
-then
- usage
-fi
-#
-hostnames=`hostname -s`
-localdir="${PKG_UPDATE_DIR:-/usr/ports/local/update}"
-logdir="${PKG_UPDATE_LOGDIR:-${localdir}/log-${hostnames}}"
-hostname=`hostname`
-depends="${localdir}/data/depends.${hostname}"
-cache="${localdir}/version-list.${hostname}"
-deinstall="${localdir}/deinstall.${hostname}"
-todolist="${localdir}/data/todo.${hostname}"
-seen="/tmp/deinstall-seen"
-required="/tmp/required-seen"
-inrequired="/tmp/inrequired-seen"
-pkginfo_cache="/var/tmp/pkginfo_cache"
-pkg_prefix="/usr/pkgng"
-pkg_env="PKG_DEPENDS= PKG_PREFIX=${pkg_prefix} PKG_BIN=${pkg_prefix}/sbin/pkg-static"
-pkg_env="${pkg_env} DEPENDS_SHOW_FLAVOR="
-#
-# get all path information from /etc/make.conf
-nowarn="COMMENT=0 CATEGORIES=0 PORTVERSION=0"
-portsdir=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V PORTSDIR`
-pkg_dbdir=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V PKG_DBDIR`
-packages=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V PACKAGES`
-defaultdata="${localdir}/data/make-packages.${hostname}"
-if test ! -f "${defaultdata}"
-then
- pkg="pkg"
-else
- pkg="${pkg_prefix}/sbin/pkg"
-fi
-quiet_mkdir "${pkginfo_cache}"
-#
-target="${1}"
-case "${target}" in
-update-pkg)
- check_buildjail
- update_pkg
- ;;
-repo)
- shift
- mv "${packages}/Old" "${packages}-Old"
- ${pkg} repo "${packages}"
- mv "${packages}-Old" "${packages}/Old"
- next_target "${@}"
- ;;
-make-packages)
- shift
- check_buildjail
- validate_make_conf
- check_update_pkg
- parse_default "${#}"
- quiet_mkdir "${localdir}/data" "${logdir}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- make_packages_in_dir "${dir}"
- done
- else
- make_packages_in_dir "${i}"
- fi
- done
- next_target dummy repo
- ;;
-add-packages)
- shift
- defaultdata="${localdir}/data/install-packages.${hostname}"
- parse_default "${#}"
- quiet_mkdir "${localdir}/data" "${logdir}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- add_packages_in_dir "${dir}"
- done
- else
- add_packages_in_dir "${i}"
- fi
- done
- ;;
-install-packages)
- shift
- defaultdata="${localdir}/data/install-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- install_packages_in_dir "${dir}"
- done
- else
- install_packages_in_dir "${i}"
- fi
- done
- ;;
-show-packages)
- shift
- defaultdata="${localdir}/data/install-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- show_packages_in_dir "${dir}"
- done
- else
- show_packages_in_dir "${i}"
- fi
- done
- ;;
-deinstall-packages)
- shift
- defaultdata="${localdir}/data/install-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- deinstall_packages_in_dir "${dir}"
- done
- else
- deinstall_packages_in_dir "${i}"
- fi
- done
- ;;
-show-missing-packages)
- shift
- defaultdata="${localdir}/data/install-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- show_missing_packages_in_dir "${dir}"
- done
- else
- show_missing_packages_in_dir "${i}"
- fi
- done
- ;;
-fetch-distfiles)
- shift
- defaultdata="${localdir}/data/make-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- fetch_distfiles_in_dir "${dir}"
- done
- else
- fetch_distfiles_in_dir "${i}"
- fi
- done
- ;;
-fetch-recursive-distfiles)
- shift
- defaultdata="${localdir}/data/make-packages.${hostname}"
- parse_default "${#}"
- for i in "${@}"
- do
- if test -f "${i}"
- then
- for dir in `grep -v "^#" "${i}"`
- do
- fetch_recursive_distfiles_in_dir "${dir}"
- done
- else
- fetch_recursive_distfiles_in_dir "${i}"
- fi
- done
- ;;
-clean-packages)
- ext=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V PKG_SUFX`
- pkgall="${packages}/All"
- pkgold="${packages}/Old"
- quiet_mkdir "${pkgold}"
- check_update_pkg
- #
- # save pwd
- (
- clean_package_all
- clean_package_links
- )
- next_target dummy repo
- next_target "${@}"
- ;;
-clean-openssl-packages)
- pkgall="${packages}/All"
- pkgold="${packages}/Old"
- quiet_mkdir "${pkgold}"
- check_update_pkg
- #
- # save pwd
- (
- clean_package_openssl
- clean_package_links
- )
- next_target dummy repo
- next_target "${@}"
- ;;
-clean-distfiles)
- distdir=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V DISTDIR`
- old="${distdir}/Old"
- quiet_mkdir "${old}"
- #
- clean_distfiles
- next_target "${@}"
- ;;
-merge-distfiles)
- distdir=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V DISTDIR`
- mergedistdir="${MERGEDISTDIR-/media/distfiles}"
- old="${distdir}/Old"
- #
- merge_distfiles
- next_target "${@}"
- ;;
-fix-moved-ports)
- fix_moved_ports
- next_target "${@}"
- ;;
-list-installed-ports)
- run_pkg_info_origin_all
- next_target "${@}"
- ;;
-show-version-list)
- make_version_list
- cat "${cache}"
- next_target "${@}"
- ;;
-make-version-list)
- rm -f "${cache}"
- make_version_list
- next_target "${@}"
- ;;
-make-deinstall-list)
- make_version_list
- quiet="1"
- make_deinstall_list
- next_target "${@}"
- ;;
-show-missing-reinstall)
- grep -v '^#' "${todolist}" |
- while read origin dummy
- do
- movedto=`get_new_origin "${origin}"`
- if test ! -d "${portsdir}/${movedto}"
- then
- echo "error ${package} has lost portsdir ${movedto}"
- continue
- fi
- pkgfile=`cd "${portsdir}/${movedto}" && make -V PKGFILE`
- if test ! -f "${pkgfile}"
- then
- echo " ${movedto} no new package"
- continue
- fi
- pkgname=`cd "${portsdir}/${movedto}" && make -V PKGNAME`
- if test -d "${pkg_dbdir}/${pkgname}"
- then
- echo "new ${pkgname} installed"
- continue
- fi
- installed=`run_pkg_info_installed "${origin}"`
- if test "${installed}" != ""
- then
- echo "old ${origin} installed"
- continue
- fi
- installed=`run_pkg_info_installed "${movedto}"`
- if test "${installed}" != ""
- then
- echo "old ${movedto} installed"
- continue
- fi
- echo " ${movedto} package not installed"
- done
- ;;
-check-reinstall)
- grep -v '^#' "${todolist}" |
- while read origin dummy
- do
- movedto=`get_new_origin "${origin}"`
- if test ! -d "${portsdir}/${movedto}"
- then
- echo "error ${package} has lost portsdir ${movedto}"
- continue
- fi
- pkgfile=`cd "${portsdir}/${movedto}" && make -V PKGFILE`
- if test ! -f "${pkgfile}"
- then
- echo " ${movedto} no new package"
- continue
- fi
- done
- ;;
-clean-reinstall)
- quiet="1"
- grep -v '^#' "${todolist}" |
- while read origin dummy
- do
- movedto=`get_new_origin "${origin}"`
- if test ! -d "${portsdir}/${movedto}"
- then
- echo "error ${origin} has lost portsdir ${movedto}"
- continue
- fi
- pkgname=`cd "${portsdir}/${movedto}" && make -V PKGNAME`
- if test -d "${pkg_dbdir}/${pkgname}"
- then
- remove_from_file "${todolist}" "${origin}"
- continue
- fi
- installed=`run_pkg_info_installed "${origin}"`
- if test "${installed}" != ""
- then
- remove_from_file "${todolist}" "${origin}"
- continue
- fi
- pkgfile=`cd "${portsdir}/${movedto}" && make -V PKGFILE`
- if test ! -f "${pkgfile}"
- then
- echo " ${movedto} no new package"
- continue
- fi
- echo " ${origin} package not installed"
- done
- ;;
-show-missing-installed)
- env ${pkg_env} ${local_env} pkg version -qo -Rl '?'
- ;;
-reinstall)
- exec /bin/sh "${0}" install-packages "${todolist}"
- echo "error in path: ${0}" >&2
- exit 64
- ;;
-clean)
- rm -f "${cache}" "${deinstall}"
- next_target "${@}"
- ;;
-check-installed-ports)
- shift
- tmp1="/tmp/check-listed.$$"
- tmp2="/tmp/check-installed.$$"
- quiet_mkdir "${localdir}/data"
- defaultdata="${localdir}/data/install-packages.${hostname}"
- if test ! -f "${defaultdata}"
- then
- /bin/sh "${0}" "list-installed-ports" | sort > "${defaultdata}"
- fi
- parse_default "${#}"
- (
- for i in "${@}"
- do
- if test -f "${i}"
- then
- grep -v "^#" "${i}"
- else
- echo "${i}"
- fi
- done
- ) |
- sed -e 's=^/usr/ports/==' |
- sort -u > "${tmp1}"
- run_pkg_info_origin_all |
- sort -u > "${tmp2}"
- obsolete=`comm -23 "${tmp1}" "${tmp2}"`
- if test "${obsolete}"
- then
- echo "# not installed, but listed:"
- echo "${obsolete}" |
- while read origin
- do
- if test ! -d "${portsdir}/${origin}"
- then
- echo "${origin} (no origin)"
- continue
- fi
- echo "${origin}"
- done
- echo ""
- fi
- obsolete=`comm -13 "${tmp1}" "${tmp2}"`
- if test "${obsolete}"
- then
- echo "# installed, but not listed:"
- echo "${obsolete}" |
- while read origin
- do
- if test ! -d "${portsdir}/${origin}"
- then
- echo "${origin} (no origin)"
- continue
- fi
- pkgname=`cd "${portsdir}/${origin}" && make -V PKGNAME 2>/dev/null`
- run_pkg_match
- done
- echo ""
- fi
- rm -f "${tmp1}" "${tmp2}"
- ;;
-update-ports)
- (cd ${portsdir} && make update)
- next_target "${@}"
- ;;
-full-update-jail)
- cd ${localdir} || exit 69
- defaultdata="${localdir}/data/make-packages.${hostname}"
- #
- shift
- case "${1}" in
- retry)
- shift
- ;;
- *)
- /bin/sh "${0}" update-ports
- ;;
- esac
- /bin/sh "${0}" clean-distfiles
- /bin/sh "${0}" clean-packages
- rm -f "${logdir}/"err,*
- /bin/sh "${0}" make-packages
- next_target "${@}"
- ;;
-check-update)
- /bin/sh "${0}" check-installed-ports
- /bin/sh "${0}" show-missing-packages
- /bin/sh "${0}" show-missing-installed
- next_target "${@}"
- ;;
-diff)
- diff -u "${portsdir}/ports-mgmt/pkg_jail/files/pkg_update" "${0}"
- ;;
-*)
- usage
-esac
-#
-exit 0
-#
-# eof
diff --git a/ports-mgmt/pkg_jail/files/pkg_update.1 b/ports-mgmt/pkg_jail/files/pkg_update.1
deleted file mode 100644
index e7ab4ae8f447..000000000000
--- a/ports-mgmt/pkg_jail/files/pkg_update.1
+++ /dev/null
@@ -1,155 +0,0 @@
-.\" $Id: pkg_update.1,v 2.0 2018/03/31 06:54:50 cvs Exp $
-.TH PKG_UPDATE 1 "April 2017" "FreeBSD" "User Manuals"
-.SH NAME
-pkg_update \- Easy handling of jailed packages builds.
-.SH SYNOPSIS
-.TP
-.B pkg_update [command] ...
-.SH DESCRIPTION
-.B pkg_update
-is a script to handle an clean jail for package-builds.
-.SH ARGUMENTS
-.TP
-.B update-ports
-Start "make update" for the ports tree.
-.TP
-.B update-pkg
-Force rebuild of pkg tools.
-.TP
-.B repo
-Force rebuild of pkg repo.
-.TP
-.B make-packages
-Builds a port and its dependencies in a clean /usr/local.
-You should not run this on a server with configuration.
-Existing packages are used.
-Extra files in "${PREFIX}" are detected and reported.
-The default list of ports is "data/make-packages.${hostname}"
-.TP
-.B clean-distfiles
-Checks all distinfo files and moves the disfiles not found
-to "/usr/ports/distfiles/Old/".
-.TP
-.B merge-distfiles
-Copy all disfiles found that do not yet exist on the master
-directory "/media/ports/distfiles/".
-.TP
-.B clean-packages
-Find obsolete packages and move them out of the way.
-.TP
-.B pkg_update clean-openssl-packages
-Find packages that use openssl and move them out of the way
-.TP
-.B full-update-jail
-Do full update cycle:
-1. "update-ports" to update the ports tree
-2. "clean-packages" to keep only good packages
-3. remove all old error logs
-4. "make-packages" to rebuild missing packages
-.TP
-.B full-update-jail retry
-Skip "update-ports" and procced as above.
-.TP
-.B fetch-distfiles
-Fetch distfiles for list of ports.
-.TP
-.B fetch-recursive-distfiles
-Fetch distfiles for list of ports and their dependecies.
-.TP
-.B fix-moved-ports
-Check installed packages for moved ports.
-Then register the new dir in the old installed package.
-.TP
-.B add-packages
-Build a missing port and its missing dpendencies
-/usr/local is not deleted, on success the port is installed.
-Existing packages will be used.
-.TP
-.B list-installed-ports
-List all installed ports.
-.TP
-.B show-version-list
-List installed packages that are not in correct version.
-.TP
-.B show-packages
-List build packages or report missing for each port
-recorded in "data/install-packages.${hostname}".
-.TP
-.B check-installed-ports
-Compare the list of installed ports with the list
-recorded in data/install-packages.${hostname}".
-.TP
-.B show-missing-packages
-Warn if no package is found for each port
-recorded in "data/install-packages.${hostname}"
-.TP
-.B show-missing-installed
-List build packages or report missing for each port
-installed on this host.
-.TP
-.B check-update
-1. check-installed-ports
-2. show-missing-packages
-3. show-missing-installed
-.TP
-.B clean
-Clean all cached information.
-.TP
-.B make-version-list
-Make new list of packages that are not in correct version.
-.TP
-.B make-deinstall-list
-Make new list of ports that are not in correct version
-and create a script "deinstall.${hostname}" to deinstall
-all the old ports and the dependend ports in order.
-.TP
-.B check-reinstall
-For each package deleted by "make-deinstall-list" warn
-if no new package is found.
-.TP
-.B reinstall
-For each package deleted by "make-deinstall-list" try
-to install the new package if it exists.
-.TP
-.B install-packages
-For each port recorded in "data/install-packages.${hostname}"
-try to to install the new package if it exists.
-.TP
-.B show-missing-reinstall
-For each port recorded from "make-deinstall-list" warn
-if no new package is found.
-.TP
-.B clean-reinstall
-For each port recorded from "make-deinstall-list",
-keep only the ports that have no package installed.
-.TP
-.B deinstall-packages
-For each port recorded in "data/install-packages.${hostname}"
-try to to deinstall the installed port.
-.SH "IMPLEMENTATION NOTES"
-This script uses only /bin/sh and it does not need an INDEX file.
-.SH RETURN VALUES
-undefined.
-.SH "FILES"
-.TP
-.B /usr/ports/local/update/data/
-Default location for configuration and varaible data.
-
-.TP
-.B /usr/ports/local/update/log-${hostname}
-Default location for logsfiles.
-.TP
-.B /media/ports/distfiles/
-Optional location lor a central hostng of distfiles.
-.SH "EXAMPLES"
-.B pkg_update full-update-jail clean-distfiles
-.SH "SEE ALSO"
-.TP
-.B pkg_jail(1)
-The tool to create and run the jail.
-.SH "HISTORY"
-http://www.dinoex.net/training/package.html
-.TP
-http://www.dinoex.net/training/package2.html
-.SH "AUTHOR"
-Dirk Meyer, dinoex@FreeBSD.org