mkjail.sh

Check-in [0f6d6be7c1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Centralize uid check into mkjail itself
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | combined
Files: files | file ages | folders
SHA3-256:0f6d6be7c10eba8f4d94368a9144b32a72ec576ea37642515e01c7c82aafdacf
User & Date: feld 2018-09-27 19:13:52
Context
2018-10-02
20:46
Standardize variables Introduce config file Architecture is now possible to override via an option flag check-in: cc5b2533c3 user: feld tags: combined
2018-09-27
19:13
Centralize uid check into mkjail itself check-in: 0f6d6be7c1 user: feld tags: combined
19:11
Fix arg processing for create, too check-in: 13b05e96bf user: feld tags: combined
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/bin/mkjail.

20
21
22
23
24
25
26





27
28
29
30
31
32
33
# 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.






show_help() {
cat <<HELP
usage: mkjail command [options]

Commands:
    create      -- Create jail







>
>
>
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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.

if [ $(id -u) -ne 0 ]; then
    echo "Error: must run as root or with sudo."
    exit 1
fi

show_help() {
cat <<HELP
usage: mkjail command [options]

Commands:
    create      -- Create jail

Changes to src/share/mkjail/update.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

export JAILROOT=/jails
export PAGER=cat
export JAILNAME=${@}
export MIRROR=update5.freebsd.org

if [ $(id -u) -ne 0 ]; then
    echo "Error: must run as root or with sudo."
    exit 1
fi

_alljails()
{
    echo "Updating all jails..."
    echo ""
    for i in $(jls -q name); do
      echo "Updating ${i} jail..."
      echo ""







<
<
<
<
<







1
2
3
4
5
6
7





8
9
10
11
12
13
14
#!/bin/sh

export JAILROOT=/jails
export PAGER=cat
export JAILNAME=${@}
export MIRROR=update5.freebsd.org






_alljails()
{
    echo "Updating all jails..."
    echo ""
    for i in $(jls -q name); do
      echo "Updating ${i} jail..."
      echo ""

Changes to src/share/mkjail/upgrade.sh.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export JAILROOT=/jails
export PAGER=cat
export MIRROR=update5.freebsd.org
export SNAPNAME="mkjail-$(date '+%Y%m%d%H%M')"
aflag=0
jflag=0

if [ $(id -u) -ne 0 ]; then
    echo "Error: must run as root or with sudo."
    exit 1
fi

_upgradejail()
{
    _validate
    _snapshot
    echo "Updating ${JAILNAME} jail..."
    echo ""
    export UNAME_r=${MKJAILVER}







<
<
<
<
<







6
7
8
9
10
11
12





13
14
15
16
17
18
19
export JAILROOT=/jails
export PAGER=cat
export MIRROR=update5.freebsd.org
export SNAPNAME="mkjail-$(date '+%Y%m%d%H%M')"
aflag=0
jflag=0






_upgradejail()
{
    _validate
    _snapshot
    echo "Updating ${JAILNAME} jail..."
    echo ""
    export UNAME_r=${MKJAILVER}