Date: Thu, 25 Oct 2012 17:07:41 GMT From: Yamagi Burmeister <yamagi@yamagi.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/173076: New Port: sysutils/jail another rc-script for jails, this time for jail.conf jails Message-ID: <201210251707.q9PH7fjF072675@red.freebsd.org> Resent-Message-ID: <201210251710.q9PHA0nm084326@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 173076 >Category: misc >Synopsis: New Port: sysutils/jail another rc-script for jails, this time for jail.conf jails >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Oct 25 17:10:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Yamagi Burmeister >Release: 9.1-RC2 >Organization: >Environment: >Description: New Port: sysutils/jail another rc-script for jails, this time for jail.conf jails. jail2 is an alternative rc script for jails, relying on jail.conf instead of rc.conf variables. Additionally, ZFS integration is provided. In contrast to the default jail rc script this one can run inside jails, allowing the configuration of hierarchical jails. I renamed the jail2.shar to jail.txt so satisfy the send-pr web interface. >How-To-Repeat: >Fix: Patch attached with submission follows: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # jail2 # jail2/.git # jail2/.git/hooks # jail2/.git/hooks/update.sample # jail2/.git/hooks/commit-msg.sample # jail2/.git/hooks/post-update.sample # jail2/.git/hooks/pre-applypatch.sample # jail2/.git/hooks/pre-commit.sample # jail2/.git/hooks/pre-rebase.sample # jail2/.git/hooks/prepare-commit-msg.sample # jail2/.git/hooks/applypatch-msg.sample # jail2/.git/info # jail2/.git/info/exclude # jail2/.git/logs # jail2/.git/logs/refs # jail2/.git/logs/refs/remotes # jail2/.git/logs/refs/remotes/origin # jail2/.git/logs/refs/remotes/origin/HEAD # jail2/.git/logs/refs/remotes/origin/master # jail2/.git/logs/refs/heads # jail2/.git/logs/refs/heads/master # jail2/.git/logs/HEAD # jail2/.git/branches # jail2/.git/objects # jail2/.git/objects/pack # jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.pack # jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.idx # jail2/.git/objects/info # jail2/.git/objects/5d # jail2/.git/objects/5d/d1146e284b86df36411f920a77a2118567d858 # jail2/.git/objects/4c # jail2/.git/objects/4c/8ccf0e95ac97b822e7a2fee262ea4516e13257 # jail2/.git/objects/2a # jail2/.git/objects/2a/25ccf1329b3c135d994bee6bb70ff84ae7c187 # jail2/.git/refs # jail2/.git/refs/heads # jail2/.git/refs/heads/master # jail2/.git/refs/tags # jail2/.git/refs/remotes # jail2/.git/refs/remotes/origin # jail2/.git/refs/remotes/origin/HEAD # jail2/.git/refs/remotes/origin/master # jail2/.git/COMMIT_EDITMSG # jail2/.git/description # jail2/.git/HEAD # jail2/.git/config # jail2/.git/packed-refs # jail2/.git/index # jail2/files # jail2/files/jail2.in # jail2/Makefile # jail2/pkg-descr # echo c - jail2 mkdir -p jail2 > /dev/null 2>&1 echo c - jail2/.git mkdir -p jail2/.git > /dev/null 2>&1 echo c - jail2/.git/hooks mkdir -p jail2/.git/hooks > /dev/null 2>&1 echo x - jail2/.git/hooks/update.sample sed 's/^X//' >jail2/.git/hooks/update.sample << '933fb41b8c3ce7ee7f2c9c71ebdc2196' X#!/bin/sh X# X# An example hook script to blocks unannotated tags from entering. X# Called by "git receive-pack" with arguments: refname sha1-old sha1-new X# X# To enable this hook, rename this file to "update". X# X# Config X# ------ X# hooks.allowunannotated X# This boolean sets whether unannotated tags will be allowed into the X# repository. By default they won't be. X# hooks.allowdeletetag X# This boolean sets whether deleting tags will be allowed in the X# repository. By default they won't be. X# hooks.allowmodifytag X# This boolean sets whether a tag may be modified after creation. By default X# it won't be. X# hooks.allowdeletebranch X# This boolean sets whether deleting branches will be allowed in the X# repository. By default they won't be. X# hooks.denycreatebranch X# This boolean sets whether remotely creating branches will be denied X# in the repository. By default this is allowed. X# X X# --- Command line Xrefname="$1" Xoldrev="$2" Xnewrev="$3" X X# --- Safety check Xif [ -z "$GIT_DIR" ]; then X echo "Don't run this script from the command line." >&2 X echo " (if you want, you could supply GIT_DIR then run" >&2 X echo " $0 <ref> <oldrev> <newrev>)" >&2 X exit 1 Xfi X Xif [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then X echo "Usage: $0 <ref> <oldrev> <newrev>" >&2 X exit 1 Xfi X X# --- Config Xallowunannotated=$(git config --bool hooks.allowunannotated) Xallowdeletebranch=$(git config --bool hooks.allowdeletebranch) Xdenycreatebranch=$(git config --bool hooks.denycreatebranch) Xallowdeletetag=$(git config --bool hooks.allowdeletetag) Xallowmodifytag=$(git config --bool hooks.allowmodifytag) X X# check for no description Xprojectdesc=$(sed -e '1q' "$GIT_DIR/description") Xcase "$projectdesc" in X"Unnamed repository"* | "") X echo "*** Project description file hasn't been set" >&2 X exit 1 X ;; Xesac X X# --- Check types X# if $newrev is 0000...0000, it's a commit to delete a ref. Xzero="0000000000000000000000000000000000000000" Xif [ "$newrev" = "$zero" ]; then X newrev_type=delete Xelse X newrev_type=$(git cat-file -t $newrev) Xfi X Xcase "$refname","$newrev_type" in X refs/tags/*,commit) X # un-annotated tag X short_refname=${refname##refs/tags/} X if [ "$allowunannotated" != "true" ]; then X echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 X echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 X exit 1 X fi X ;; X refs/tags/*,delete) X # delete tag X if [ "$allowdeletetag" != "true" ]; then X echo "*** Deleting a tag is not allowed in this repository" >&2 X exit 1 X fi X ;; X refs/tags/*,tag) X # annotated tag X if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 X then X echo "*** Tag '$refname' already exists." >&2 X echo "*** Modifying a tag is not allowed in this repository." >&2 X exit 1 X fi X ;; X refs/heads/*,commit) X # branch X if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then X echo "*** Creating a branch is not allowed in this repository" >&2 X exit 1 X fi X ;; X refs/heads/*,delete) X # delete branch X if [ "$allowdeletebranch" != "true" ]; then X echo "*** Deleting a branch is not allowed in this repository" >&2 X exit 1 X fi X ;; X refs/remotes/*,commit) X # tracking branch X ;; X refs/remotes/*,delete) X # delete tracking branch X if [ "$allowdeletebranch" != "true" ]; then X echo "*** Deleting a tracking branch is not allowed in this repository" >&2 X exit 1 X fi X ;; X *) X # Anything else (is there anything else?) X echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 X exit 1 X ;; Xesac X X# --- Finished Xexit 0 933fb41b8c3ce7ee7f2c9c71ebdc2196 echo x - jail2/.git/hooks/commit-msg.sample sed 's/^X//' >jail2/.git/hooks/commit-msg.sample << '3dd49bbdea72287c06b4178399fb4f11' X#!/bin/sh X# X# An example hook script to check the commit log message. X# Called by "git commit" with one argument, the name of the file X# that has the commit message. The hook should exit with non-zero X# status after issuing an appropriate message if it wants to stop the X# commit. The hook is allowed to edit the commit message file. X# X# To enable this hook, rename this file to "commit-msg". X X# Uncomment the below to add a Signed-off-by line to the message. X# Doing this in a hook is a bad idea in general, but the prepare-commit-msg X# hook is more suited to it. X# X# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') X# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" X X# This example catches duplicate Signed-off-by lines. X Xtest "" = "$(grep '^Signed-off-by: ' "$1" | X sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { X echo >&2 Duplicate Signed-off-by lines. X exit 1 X} 3dd49bbdea72287c06b4178399fb4f11 echo x - jail2/.git/hooks/post-update.sample sed 's/^X//' >jail2/.git/hooks/post-update.sample << '0e938b49de2fa0292ca4826c01106596' X#!/bin/sh X# X# An example hook script to prepare a packed repository for use over X# dumb transports. X# X# To enable this hook, rename this file to "post-update". X Xexec git update-server-info 0e938b49de2fa0292ca4826c01106596 echo x - jail2/.git/hooks/pre-applypatch.sample sed 's/^X//' >jail2/.git/hooks/pre-applypatch.sample << '40653eb6b72d2037ce808382ed3ed9da' X#!/bin/sh X# X# An example hook script to verify what is about to be committed X# by applypatch from an e-mail message. X# X# The hook should exit with non-zero status after issuing an X# appropriate message if it wants to stop the commit. X# X# To enable this hook, rename this file to "pre-applypatch". X X. git-sh-setup Xtest -x "$GIT_DIR/hooks/pre-commit" && X exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} X: 40653eb6b72d2037ce808382ed3ed9da echo x - jail2/.git/hooks/pre-commit.sample sed 's/^X//' >jail2/.git/hooks/pre-commit.sample << '3b7e82b1799db0121e67b6e670cd56d5' X#!/bin/sh X# X# An example hook script to verify what is about to be committed. X# Called by "git commit" with no arguments. The hook should X# exit with non-zero status after issuing an appropriate message if X# it wants to stop the commit. X# X# To enable this hook, rename this file to "pre-commit". X Xif git rev-parse --verify HEAD >/dev/null 2>&1 Xthen X against=HEAD Xelse X # Initial commit: diff against an empty tree object X against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 Xfi X X# If you want to allow non-ascii filenames set this variable to true. Xallownonascii=$(git config hooks.allownonascii) X X# Redirect output to stderr. Xexec 1>&2 X X# Cross platform projects tend to avoid non-ascii filenames; prevent X# them from being added to the repository. We exploit the fact that the X# printable range starts at the space character and ends with tilde. Xif [ "$allownonascii" != "true" ] && X # Note that the use of brackets around a tr range is ok here, (it's X # even required, for portability to Solaris 10's /usr/bin/tr), since X # the square bracket bytes happen to fall in the designated range. X test $(git diff --cached --name-only --diff-filter=A -z $against | X LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 Xthen X echo "Error: Attempt to add a non-ascii file name." X echo X echo "This can cause problems if you want to work" X echo "with people on other platforms." X echo X echo "To be portable it is advisable to rename the file ..." X echo X echo "If you know what you are doing you can disable this" X echo "check using:" X echo X echo " git config hooks.allownonascii true" X echo X exit 1 Xfi X X# If there are whitespace errors, print the offending file names and fail. Xexec git diff-index --check --cached $against -- 3b7e82b1799db0121e67b6e670cd56d5 echo x - jail2/.git/hooks/pre-rebase.sample sed 's/^X//' >jail2/.git/hooks/pre-rebase.sample << 'd815038dead41cc3bc6c2ed6a6735589' X#!/bin/sh X# X# Copyright (c) 2006, 2008 Junio C Hamano X# X# The "pre-rebase" hook is run just before "git rebase" starts doing X# its job, and can prevent the command from running by exiting with X# non-zero status. X# X# The hook is called with the following parameters: X# X# $1 -- the upstream the series was forked from. X# $2 -- the branch being rebased (or empty when rebasing the current branch). X# X# This sample shows how to prevent topic branches that are already X# merged to 'next' branch from getting rebased, because allowing it X# would result in rebasing already published history. X Xpublish=next Xbasebranch="$1" Xif test "$#" = 2 Xthen X topic="refs/heads/$2" Xelse X topic=`git symbolic-ref HEAD` || X exit 0 ;# we do not interrupt rebasing detached HEAD Xfi X Xcase "$topic" in Xrefs/heads/??/*) X ;; X*) X exit 0 ;# we do not interrupt others. X ;; Xesac X X# Now we are dealing with a topic branch being rebased X# on top of master. Is it OK to rebase it? X X# Does the topic really exist? Xgit show-ref -q "$topic" || { X echo >&2 "No such branch $topic" X exit 1 X} X X# Is topic fully merged to master? Xnot_in_master=`git rev-list --pretty=oneline ^master "$topic"` Xif test -z "$not_in_master" Xthen X echo >&2 "$topic is fully merged to master; better remove it." X exit 1 ;# we could allow it, but there is no point. Xfi X X# Is topic ever merged to next? If so you should not be rebasing it. Xonly_next_1=`git rev-list ^master "^$topic" ${publish} | sort` Xonly_next_2=`git rev-list ^master ${publish} | sort` Xif test "$only_next_1" = "$only_next_2" Xthen X not_in_topic=`git rev-list "^$topic" master` X if test -z "$not_in_topic" X then X echo >&2 "$topic is already up-to-date with master" X exit 1 ;# we could allow it, but there is no point. X else X exit 0 X fi Xelse X not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` X /usr/local/bin/perl -e ' X my $topic = $ARGV[0]; X my $msg = "* $topic has commits already merged to public branch:\n"; X my (%not_in_next) = map { X /^([0-9a-f]+) /; X ($1 => 1); X } split(/\n/, $ARGV[1]); X for my $elem (map { X /^([0-9a-f]+) (.*)$/; X [$1 => $2]; X } split(/\n/, $ARGV[2])) { X if (!exists $not_in_next{$elem->[0]}) { X if ($msg) { X print STDERR $msg; X undef $msg; X } X print STDERR " $elem->[1]\n"; X } X } X ' "$topic" "$not_in_next" "$not_in_master" X exit 1 Xfi X Xexit 0 X X################################################################ X XThis sample hook safeguards topic branches that have been Xpublished from being rewound. X XThe workflow assumed here is: X X * Once a topic branch forks from "master", "master" is never X merged into it again (either directly or indirectly). X X * Once a topic branch is fully cooked and merged into "master", X it is deleted. If you need to build on top of it to correct X earlier mistakes, a new topic branch is created by forking at X the tip of the "master". This is not strictly necessary, but X it makes it easier to keep your history simple. X X * Whenever you need to test or publish your changes to topic X branches, merge them into "next" branch. X XThe script, being an example, hardcodes the publish branch name Xto be "next", but it is trivial to make it configurable via X$GIT_DIR/config mechanism. X XWith this workflow, you would want to know: X X(1) ... if a topic branch has ever been merged to "next". Young X topic branches can have stupid mistakes you would rather X clean up before publishing, and things that have not been X merged into other branches can be easily rebased without X affecting other people. But once it is published, you would X not want to rewind it. X X(2) ... if a topic branch has been fully merged to "master". X Then you can delete it. More importantly, you should not X build on top of it -- other people may already want to X change things related to the topic as patches against your X "master", so if you need further changes, it is better to X fork the topic (perhaps with the same name) afresh from the X tip of "master". X XLet's look at this example: X X o---o---o---o---o---o---o---o---o---o "next" X / / / / X / a---a---b A / / X / / / / X / / c---c---c---c B / X / / / \ / X / / / b---b C \ / X / / / / \ / X ---o---o---o---o---o---o---o---o---o---o---o "master" X X XA, B and C are topic branches. X X * A has one fix since it was merged up to "next". X X * B has finished. It has been fully merged up to "master" and "next", X and is ready to be deleted. X X * C has not merged to "next" at all. X XWe would want to allow C to be rebased, refuse A, and encourage XB to be deleted. X XTo compute (1): X X git rev-list ^master ^topic next X git rev-list ^master next X X if these match, topic has not merged in next at all. X XTo compute (2): X X git rev-list master..topic X X if this is empty, it is fully merged to "master". d815038dead41cc3bc6c2ed6a6735589 echo x - jail2/.git/hooks/prepare-commit-msg.sample sed 's/^X//' >jail2/.git/hooks/prepare-commit-msg.sample << '8cfbdbef001ffae80ed6d98f9467e63e' X#!/bin/sh X# X# An example hook script to prepare the commit log message. X# Called by "git commit" with the name of the file that has the X# commit message, followed by the description of the commit X# message's source. The hook's purpose is to edit the commit X# message file. If the hook fails with a non-zero status, X# the commit is aborted. X# X# To enable this hook, rename this file to "prepare-commit-msg". X X# This hook includes three examples. The first comments out the X# "Conflicts:" part of a merge commit. X# X# The second includes the output of "git diff --name-status -r" X# into the message, just before the "git status" output. It is X# commented because it doesn't cope with --amend or with squashed X# commits. X# X# The third example adds a Signed-off-by line to the message, that can X# still be edited. This is rarely a good idea. X Xcase "$2,$3" in X merge,) X /usr/local/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; X X# ,|template,) X# /usr/local/bin/perl -i.bak -pe ' X# print "\n" . `git diff --cached --name-status -r` X# if /^#/ && $first++ == 0' "$1" ;; X X *) ;; Xesac X X# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') X# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 8cfbdbef001ffae80ed6d98f9467e63e echo x - jail2/.git/hooks/applypatch-msg.sample sed 's/^X//' >jail2/.git/hooks/applypatch-msg.sample << '909b537bc52c83db111e95cd3d12404f' X#!/bin/sh X# X# An example hook script to check the commit log message taken by X# applypatch from an e-mail message. X# X# The hook should exit with non-zero status after issuing an X# appropriate message if it wants to stop the commit. The hook is X# allowed to edit the commit message file. X# X# To enable this hook, rename this file to "applypatch-msg". X X. git-sh-setup Xtest -x "$GIT_DIR/hooks/commit-msg" && X exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} X: 909b537bc52c83db111e95cd3d12404f echo c - jail2/.git/info mkdir -p jail2/.git/info > /dev/null 2>&1 echo x - jail2/.git/info/exclude sed 's/^X//' >jail2/.git/info/exclude << 'ca6750a708f2960fadec8867c3c11bc4' X# git ls-files --others --exclude-from=.git/info/exclude X# Lines that start with '#' are comments. X# For a project mostly in C, the following would be a good set of X# exclude patterns (uncomment them if you want to use them): X# *.[oa] X# *~ ca6750a708f2960fadec8867c3c11bc4 echo c - jail2/.git/logs mkdir -p jail2/.git/logs > /dev/null 2>&1 echo c - jail2/.git/logs/refs mkdir -p jail2/.git/logs/refs > /dev/null 2>&1 echo c - jail2/.git/logs/refs/remotes mkdir -p jail2/.git/logs/refs/remotes > /dev/null 2>&1 echo c - jail2/.git/logs/refs/remotes/origin mkdir -p jail2/.git/logs/refs/remotes/origin > /dev/null 2>&1 echo x - jail2/.git/logs/refs/remotes/origin/HEAD sed 's/^X//' >jail2/.git/logs/refs/remotes/origin/HEAD << 'a648ebe99bb3445b1bd59bb584a79336' X0000000000000000000000000000000000000000 d60d0f4a3ec05fe097e2a1edede9017234a2a814 Yamagi Burmeister <yamagi@yamagi.org> 1350845188 +0200 clone: from git@github.com:Yamagi/jail2.git a648ebe99bb3445b1bd59bb584a79336 echo x - jail2/.git/logs/refs/remotes/origin/master sed 's/^X//' >jail2/.git/logs/refs/remotes/origin/master << 'c1930642cb683a733c67b40a2f771777' Xd60d0f4a3ec05fe097e2a1edede9017234a2a814 2a25ccf1329b3c135d994bee6bb70ff84ae7c187 Yamagi Burmeister <yamagi@yamagi.org> 1350847242 +0200 update by push c1930642cb683a733c67b40a2f771777 echo c - jail2/.git/logs/refs/heads mkdir -p jail2/.git/logs/refs/heads > /dev/null 2>&1 echo x - jail2/.git/logs/refs/heads/master sed 's/^X//' >jail2/.git/logs/refs/heads/master << '9dd03c6623d2c8dc57345ac9eb319ac5' X0000000000000000000000000000000000000000 d60d0f4a3ec05fe097e2a1edede9017234a2a814 Yamagi Burmeister <yamagi@yamagi.org> 1350845188 +0200 clone: from git@github.com:Yamagi/jail2.git Xd60d0f4a3ec05fe097e2a1edede9017234a2a814 2a25ccf1329b3c135d994bee6bb70ff84ae7c187 Yamagi Burmeister <yamagi@yamagi.org> 1350847209 +0200 commit: There are no docs to install 9dd03c6623d2c8dc57345ac9eb319ac5 echo x - jail2/.git/logs/HEAD sed 's/^X//' >jail2/.git/logs/HEAD << '363bf101e72088621f2267a3cd702937' X0000000000000000000000000000000000000000 d60d0f4a3ec05fe097e2a1edede9017234a2a814 Yamagi Burmeister <yamagi@yamagi.org> 1350845188 +0200 clone: from git@github.com:Yamagi/jail2.git Xd60d0f4a3ec05fe097e2a1edede9017234a2a814 2a25ccf1329b3c135d994bee6bb70ff84ae7c187 Yamagi Burmeister <yamagi@yamagi.org> 1350847209 +0200 commit: There are no docs to install 363bf101e72088621f2267a3cd702937 echo c - jail2/.git/branches mkdir -p jail2/.git/branches > /dev/null 2>&1 echo c - jail2/.git/objects mkdir -p jail2/.git/objects > /dev/null 2>&1 echo c - jail2/.git/objects/pack mkdir -p jail2/.git/objects/pack > /dev/null 2>&1 echo x - jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.pack sed 's/^X//' >jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.pack << '74f77cc15077989d1db9e36d5b75f972' XPACKX09$H/t:.bKLު7p^-"gYv!)1-95SGC&z.>IlPTJn#K2>ؽTn{alk<l *rg@P 87 TǕIΞx;0b{$/Pp*lRGSp{܀ꍞF*3h=h)遢e"V{W~6@L"E0.)90iFk&ngܸٖz*#F#%l%}?ݑn4ں7vIxI X1XPR9.XمM4>d:yn\9rX (:k'백M)wfI/!Z^wMWQ3"W/[SkJ˰SVĮ Xe0yiA v4)NQcṃBi@v*Vڇ5%>}pAIR3Y?Y3*R},_iuP|O߀Ax*UzD$zD!ml]s*@$<UJVb@kڛ8 WAA[#""#Q`6l()hl<~gcS&Ʌ8#J8=O?>O;>WPJ<<҆We6RE<picy7#i?ș+m!Ƣr&ר"8|7l眱-wْTYY7f"S2Mgq!HZβbBK#d XXi5&\Kbשvx{.@}EznѰFXsqVB!{q;TiP!ٻO/p X)S-gSatM$"<t:n,>Fl͞C XTն3/<Yb2[S T<Qa#gҚc[m|f?緰Y|]oۛMZ~~[sd_gft;ڭ117\m,\YWMO,^}jߌbo6dXx340075UJ1+`NņQږentEoP74f77cc15077989d1db9e36d5b75f972 echo x - jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.idx sed 's/^X//' >jail2/.git/objects/pack/pack-8b239e91828f6617545f847ddca8096d8bd61ae0.idx << '121fd672375242b376f5b6d89dc418c8' XtOcXXXXX121fd672375242b376f5b6d89dc418c8 echo c - jail2/.git/objects/info mkdir -p jail2/.git/objects/info > /dev/null 2>&1 echo c - jail2/.git/objects/5d mkdir -p jail2/.git/objects/5d > /dev/null 2>&1 echo x - jail2/.git/objects/5d/d1146e284b86df36411f920a77a2118567d858 sed 's/^X//' >jail2/.git/objects/5d/d1146e284b86df36411f920a77a2118567d858 << '95835a9f45b2690c8f1ecaa2d8c9c576' XxeN0O1Rzm"iRd.SmM8U=6a4fDOw.dZA#5Ncpr|U[#J3h$3895835a9f45b2690c8f1ecaa2d8c9c576 echo c - jail2/.git/objects/4c mkdir -p jail2/.git/objects/4c > /dev/null 2>&1 echo x - jail2/.git/objects/4c/8ccf0e95ac97b822e7a2fee262ea4516e13257 sed 's/^X//' >jail2/.git/objects/4c/8ccf0e95ac97b822e7a2fee262ea4516e13257 << '47ad8bb178ce7f504ef28c738b695c88' Xx+)JMU040e040031QMNMIe(vQ~W"&@XuSRnױ>zi/K]SY47ad8bb178ce7f504ef28c738b695c88 echo c - jail2/.git/objects/2a mkdir -p jail2/.git/objects/2a > /dev/null 2>&1 echo x - jail2/.git/objects/2a/25ccf1329b3c135d994bee6bb70ff84ae7c187 sed 's/^X//' >jail2/.git/objects/2a/25ccf1329b3c135d994bee6bb70ff84ae7c187 << '2607320f4d4981b44907f1c5b2b76fb0' Xx X0=).f4N`Id<Mc%vU@.u)5pDT@Z:o[F|0w-+-<8m jѿiv}k.tI/#e¸T>W\.;Hkfs4gsZff^?(QP 2607320f4d4981b44907f1c5b2b76fb0 echo c - jail2/.git/refs mkdir -p jail2/.git/refs > /dev/null 2>&1 echo c - jail2/.git/refs/heads mkdir -p jail2/.git/refs/heads > /dev/null 2>&1 echo x - jail2/.git/refs/heads/master sed 's/^X//' >jail2/.git/refs/heads/master << '6b3379a1137a8db63e54b9c503d537f3' X2a25ccf1329b3c135d994bee6bb70ff84ae7c187 6b3379a1137a8db63e54b9c503d537f3 echo c - jail2/.git/refs/tags mkdir -p jail2/.git/refs/tags > /dev/null 2>&1 echo c - jail2/.git/refs/remotes mkdir -p jail2/.git/refs/remotes > /dev/null 2>&1 echo c - jail2/.git/refs/remotes/origin mkdir -p jail2/.git/refs/remotes/origin > /dev/null 2>&1 echo x - jail2/.git/refs/remotes/origin/HEAD sed 's/^X//' >jail2/.git/refs/remotes/origin/HEAD << 'ff2c213f44d0798573aeb48f93f692db' Xref: refs/remotes/origin/master ff2c213f44d0798573aeb48f93f692db echo x - jail2/.git/refs/remotes/origin/master sed 's/^X//' >jail2/.git/refs/remotes/origin/master << 'ae059ffab81ef8154eeb96a780423ad2' X2a25ccf1329b3c135d994bee6bb70ff84ae7c187 ae059ffab81ef8154eeb96a780423ad2 echo x - jail2/.git/COMMIT_EDITMSG sed 's/^X//' >jail2/.git/COMMIT_EDITMSG << '2235a3e7f7dc23fce0c1e2dff6bd5327' XThere are no docs to install X# Bitte gebe eine Versionsbeschreibung für deine Änderungen ein. Zeilen, X# die mit '#' beginnen, werden ignoriert, und eine leere Versionsbeschreibung X# bricht die Eintragung ab. X# Auf Zweig master X# zum Eintragen bereitgestellte Änderungen: X# (benutze "git reset HEAD <Datei>..." zum Herausnehmen aus der Bereitstellung) X# X# geändert: Makefile X# 2235a3e7f7dc23fce0c1e2dff6bd5327 echo x - jail2/.git/description sed 's/^X//' >jail2/.git/description << '56908a494c29c0badc3e77c5fcc4944d' XUnnamed repository; edit this file 'description' to name the repository. 56908a494c29c0badc3e77c5fcc4944d echo x - jail2/.git/HEAD sed 's/^X//' >jail2/.git/HEAD << 'e81d8c50c35f2b58fdee931d69103440' Xref: refs/heads/master e81d8c50c35f2b58fdee931d69103440 echo x - jail2/.git/config sed 's/^X//' >jail2/.git/config << 'f0c09bf7947f1ac1431159a65adc82c5' X[core] X repositoryformatversion = 0 X filemode = true X bare = false X logallrefupdates = true X[remote "origin"] X url = git@github.com:Yamagi/jail2.git X fetch = +refs/heads/*:refs/remotes/origin/* X[branch "master"] X remote = origin X merge = refs/heads/master f0c09bf7947f1ac1431159a65adc82c5 echo x - jail2/.git/packed-refs sed 's/^X//' >jail2/.git/packed-refs << '32a21652a5afb5b28f607d251c8ffa05' X# pack-refs with: peeled Xd60d0f4a3ec05fe097e2a1edede9017234a2a814 refs/remotes/origin/master 32a21652a5afb5b28f607d251c8ffa05 echo x - jail2/.git/index sed 's/^X//' >jail2/.git/index << '9e89c20992b55345f9824e67a20f4585' XDIRCXwgX9e89c20992b55345f9824e67a20f4585 echo c - jail2/files mkdir -p jail2/files > /dev/null 2>&1 echo x - jail2/files/jail2.in sed 's/^X//' >jail2/files/jail2.in << '16a6c5557e83ea0912b4b8ab95367891' X#!/bin/sh X X# Alternative rc script for jails. This script relies on X# /etc/jail.conf instead of rc.conf variables. Usage: X# X# jail2_enable -> Enables the script X# jail2_list -> List of jails to be started. The names X# must match the names in /etc/jail.conf X# jail2_$name_zfs -> List of ZFS datasets to connect to the X# jail $name. X# X# To manage ZFS datasets within a jail the dataset must have X# set the parameter "jailed" to 1. Additionally the jail must X# have set the proberties "allow.mount", "allow.mount.zfs" X# and "enforce_statfs" to value lesser than 2. X X# PROVIDE: jail X# REQUIRE: LOGIN cleanvar X# BEFORE: securelevel X# KEYWORD: shutdown X X. /etc/rc.subr X Xname="jail2" Xrcvar=jail2_enable X Xstart_cmd="jail2_start" Xstop_cmd="jail2_stop" X Xjail2_start() X{ X echo -n "Starting jails: " X X for _j in ${jail2_list}; do X echo -n "${_j} " X X if [ -e /var/run/jail_${_j}.id ]; then X echo "${_j} already exists" X continue X fi X X jail -c -i -J /var/run/jail_${_j}.id ${_j} > /dev/null 2>&1 X X eval _zfs=\"\${jail2_${_j}_zfs:-}\" X _jid=`jls -j ${_j} jid 2>/dev/null` X X if [ -n "${_zfs}" ]; then X for _ds in ${_zfs}; do X _jailed=`zfs get -H jailed ${_ds} 2>/dev/null | awk '{ print $3 }'` X if [ "${_jailed}" = "on" ]; then X echo "zfs jail "${_jid}" ${_ds} 2>/dev/null" X zfs jail "${_jid}" ${_ds} 2>/dev/null X fi X done X fi X done X X echo X} X Xjail2_stop() X{ X echo -n "Stopping jails: " X X for _j in ${jail2_list}; do X echo -n "${_j} " X X if [ ! -e /var/run/jail_${_j}.id ]; then X echo "${_j} doesn't exists" X continue X fi X X eval _zfs=\"\${jail2_${_j}_zfs:-}\" X _jid=`jls -j ${_j} jid 2>/dev/null` X X jail -r -q ${_j} > /dev/null 2>&1 X rm /var/run/jail_${_j}.id X X if [ -n "${_zfs}" ]; then X for _ds in ${_zfs}; do X _jailed=`zfs get -H jailed ${_ds} 2>/dev/null | awk '{ print $3 }'` X if [ "${_jailed}" = "on" ]; then X echo "zfs unjail "${_jid}" ${_ds} 2>/dev/null" X zfs unjail "${_jid}" ${_ds} 2>/dev/null X fi X done X fi X done X X echo X} X Xload_rc_config $name X: ${jail2_enable="NO"} X Xcmd="$1" Xif [ $# -gt 0 ]; then X shift Xfi Xif [ -n "$*" ]; then X jail2_list="$*" Xfi X Xrun_rc_command "${cmd}" 16a6c5557e83ea0912b4b8ab95367891 echo x - jail2/Makefile sed 's/^X//' >jail2/Makefile << '244169e487ff8dd224c47b19f508f4f0' X# New ports collection makefile for: jail2 X# Date created: 21 October 2012 X# Whom: Yamagi Burmeister <yamagi@yamagi.org> X# X# $FreeBSD$ X# X XPORTNAME= jail2 XPORTVERSION= 1.0 XCATEGORIES= sysutils XMASTER_SITES= # XDISTFILES= # X XMAINTAINER= yamagi@yamagi.org XCOMMENT= Jail startup/shutdown script with jail.conf support X XNO_BUILD= yes XNO_INSTALL= yes X XUSE_RC_SUBR= jail2 X X.include <bsd.port.mk> 244169e487ff8dd224c47b19f508f4f0 echo x - jail2/pkg-descr sed 's/^X//' >jail2/pkg-descr << 'ed4ba63968e8f4533a155b7c0e7567d1' Xjail2 is an alternative rc script for jails, relying on jail.conf Xinstead of rc.conf variables. Additionally, ZFS integration is provided. XIn contrast to the default jail rc script this one can run inside jails, Xallowing the configuration of hierarchical jails. ed4ba63968e8f4533a155b7c0e7567d1 exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210251707.q9PH7fjF072675>