diff options
author | erdgeist <erdgeist@erdgeist.org> | 2005-09-03 15:42:28 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2005-09-03 15:42:28 +0000 |
commit | bb046d1a21058af9e2077d6b4f0418667862d46e (patch) | |
tree | 8f04996481403386239a822c1aa09c5e669b072b /ezjail-admin |
Here we go
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-x | ezjail-admin | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ezjail-admin b/ezjail-admin new file mode 100755 index 0000000..e7fe216 --- /dev/null +++ b/ezjail-admin | |||
@@ -0,0 +1,55 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # ugly: this variable is set during port install time | ||
4 | ezjail_prefix=EZJAIL_PREFIX | ||
5 | |||
6 | if [ "0" != "`id -u`" ]; then | ||
7 | echo "Retry as root"; exit 1; | ||
8 | fi | ||
9 | |||
10 | exit | ||
11 | if [ -f ${ezjail_prefix}/etc/ezjail.conf ]; then | ||
12 | . ${ezjail_prefix}/etc/ezjail.conf; | ||
13 | fi | ||
14 | |||
15 | if [ -z "$1" ]; | ||
16 | then echo "Syntax: $0 [create|delete|list|update] {params}"; exit; | ||
17 | fi | ||
18 | |||
19 | case "$1" in | ||
20 | create) | ||
21 | mkdir ${newjail_root} && cd ${ezjail_jailtemplate} \ | ||
22 | && find * | cpio -p -v ${newjail_root} | ||
23 | ;; | ||
24 | delete) | ||
25 | |||
26 | ;; | ||
27 | list) | ||
28 | |||
29 | ;; | ||
30 | update) | ||
31 | |||
32 | if [ ! -d ${ezjail_sourcetree} ]; then | ||
33 | echo "Cannot find your copy of the FreeBSD source tree in $ezjail_sourcetree."; exit 1; | ||
34 | fi | ||
35 | |||
36 | cd ${ezjail_sourcetree} | ||
37 | rm -r ${ezjail_jailfull}; mkdir -p ${ezjail_jailfull} | ||
38 | make world DESTDIR=${ezjail_jailfull} | ||
39 | make distribution DESTDIR=${ezjail_jailfull} | ||
40 | |||
41 | cd ${ezjail_jailfull} | ||
42 | mkdir -p ${ezjail_jailbase} | ||
43 | for a in bin sbin usr/bin usr/include usr/lib usr/libexec usr/sbin usr/src usr/share; do | ||
44 | find ${a} | cpio -d -p -v ${ezjail_jailbase}; | ||
45 | chflags -R noschg ${a}; rm -r ${a}; ln -s /basejail/${a} ${a} | ||
46 | done | ||
47 | mkdir basejail | ||
48 | |||
49 | if [ -d ${ezjail_jailtemplate} ]; then | ||
50 | mv ${ezjail_jailtemplate} ${ezjail_jailtemplate}_old | ||
51 | fi | ||
52 | mv ${ezjail_jailfull} ${ezjail_jailtemplate} | ||
53 | |||
54 | ;; | ||
55 | esac | ||