diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2012-06-30 07:28:16 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2012-06-30 07:28:16 +0000 |
commit | e002e5fc00791e26bcd2890b84b2f68e4273c764 (patch) | |
tree | 02bc1f4472c60bb8a4fc06fde14d0a91f7ab233d /ports-mgmt/pkg_jail | |
parent | 10d9e7caf3fe8f9d6acb95a45bcb47b3429d84fb (diff) | |
download | ports-e002e5fc00791e26bcd2890b84b2f68e4273c764.tar.gz ports-e002e5fc00791e26bcd2890b84b2f68e4273c764.zip |
Notes
Diffstat (limited to 'ports-mgmt/pkg_jail')
-rw-r--r-- | ports-mgmt/pkg_jail/Makefile | 4 | ||||
-rw-r--r-- | ports-mgmt/pkg_jail/files/README | 4 | ||||
-rw-r--r-- | ports-mgmt/pkg_jail/files/pkg_jail | 28 | ||||
-rw-r--r-- | ports-mgmt/pkg_jail/files/pkg_jail.1 | 24 | ||||
-rw-r--r-- | ports-mgmt/pkg_jail/files/pkg_update | 4 |
5 files changed, 51 insertions, 13 deletions
diff --git a/ports-mgmt/pkg_jail/Makefile b/ports-mgmt/pkg_jail/Makefile index 3c3d5ab1640c..028f9153c156 100644 --- a/ports-mgmt/pkg_jail/Makefile +++ b/ports-mgmt/pkg_jail/Makefile @@ -6,7 +6,7 @@ # PORTNAME= pkg_jail -PORTVERSION= 1.70 +PORTVERSION= 1.71 CATEGORIES= ports-mgmt MASTER_SITES= # empty DISTFILES= # empty @@ -29,7 +29,7 @@ do-install: .endif install-ports: - -${MKDIR} ${PORTSDIR}/local/update + -${MKDIR} ${PORTSDIR}/local/update/data ${LN} -s ${FILESDIR}/README ${PORTSDIR}/local/update/ ${LN} -s ${FILESDIR}/pkg_update ${PORTSDIR}/local/update/ ${LN} -s ${FILESDIR}/pkg_jail ${PORTSDIR}/local/update/ diff --git a/ports-mgmt/pkg_jail/files/README b/ports-mgmt/pkg_jail/files/README index 1b4c02a9bea5..3956c48bec0f 100644 --- a/ports-mgmt/pkg_jail/files/README +++ b/ports-mgmt/pkg_jail/files/README @@ -2,7 +2,9 @@ # /usr/ports/local/update/ # # Scripts reside here. -# fetch them from http://people.freebsd.org/~dinoex/batch/ +# 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 System: diff --git a/ports-mgmt/pkg_jail/files/pkg_jail b/ports-mgmt/pkg_jail/files/pkg_jail index 4e289d113377..e5595aa0960b 100644 --- a/ports-mgmt/pkg_jail/files/pkg_jail +++ b/ports-mgmt/pkg_jail/files/pkg_jail @@ -39,7 +39,7 @@ extra_commands="status shell list init" : ${pkg_jail_dir="/usr/jail/mybuild"} : ${pkg_jail_rule="127"} # -pkg_jail_init() +pkg_jail_setup() { if test ! -d "${pkg_jail_dir}" then @@ -52,6 +52,10 @@ pkg_jail_init() 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" @@ -108,7 +112,8 @@ pkg_jail_create_dev_links() pkg_jail_create_devfs() { local jail_devdir="${pkg_jail_dir}/dev" - if test ! -e "${jail_devdir}/null" + 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 @@ -116,7 +121,7 @@ pkg_jail_create_devfs() devfs -m ${jail_devdir} ruleset ${pkg_jail_rule} devfs -m ${jail_devdir} rule applyset fi - if test ! -L "${jail_devdir}/console" + if test ! -e "${jail_devdir}/console" then pkg_jail_create_dev_links ${jail_devdir} null console fi @@ -159,6 +164,11 @@ pkg_jail_create_jail_mount() 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 @@ -203,6 +213,18 @@ pkg_jail_umount() 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 -n "${pkg_jail_short}" "${pkg_jail_dir}" "${pkg_jail_hostname}" "${pkg_jail_ip}" \ + /bin/sh -c "/usr/ports/ports-mgmt/pkg_jail && make install-ports" + pkg_jail_umount + fi +} pkg_jail_shell() { if pkg_jail_free diff --git a/ports-mgmt/pkg_jail/files/pkg_jail.1 b/ports-mgmt/pkg_jail/files/pkg_jail.1 index 1b468c48e3ba..b8527415ca09 100644 --- a/ports-mgmt/pkg_jail/files/pkg_jail.1 +++ b/ports-mgmt/pkg_jail/files/pkg_jail.1 @@ -12,13 +12,14 @@ is a script to handle an clean jail for package-builds. .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. +Start the jail and give a shell back. You can build packages now. .TP .B list Show processes running in the jail. @@ -52,14 +53,27 @@ The ip-address for the jail. The new root for the jail. .TP .B pkg_jail_rule -The rulset number the script uses for the devfs isnide the jail. +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. +The variables can be set in /etc/rc.conf or in $PREFIX/etc/pkg_jail.conf. .SH "EXAMPLES" -.B pkg_jail -shell +.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) diff --git a/ports-mgmt/pkg_jail/files/pkg_update b/ports-mgmt/pkg_jail/files/pkg_update index 31ab3853e04c..4a56c8f050d7 100644 --- a/ports-mgmt/pkg_jail/files/pkg_update +++ b/ports-mgmt/pkg_jail/files/pkg_update @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: pkg_update,v 1.69 2010/06/24 15:56:40 cvs Exp $ +# $Id: pkg_update,v 1.70 2012/01/15 10:55:12 cvs Exp $ # $FreeBSD$ # # Copyright (c) 2001-2006 @@ -2022,7 +2022,7 @@ clean-distfiles) ;; merge-distfiles) distdir=`make -f /usr/share/mk/bsd.port.mk ${nowarn} -V DISTDIR` - mergedistdir="${MERGEDISTDIR-/media/ports/distfiles}" + mergedistdir="${MERGEDISTDIR-/media/distfiles}" old="${distdir}/Old" # merge_distfiles |