summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin55
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
4ezjail_prefix=EZJAIL_PREFIX
5
6if [ "0" != "`id -u`" ]; then
7 echo "Retry as root"; exit 1;
8fi
9
10exit
11if [ -f ${ezjail_prefix}/etc/ezjail.conf ]; then
12 . ${ezjail_prefix}/etc/ezjail.conf;
13fi
14
15if [ -z "$1" ];
16 then echo "Syntax: $0 [create|delete|list|update] {params}"; exit;
17fi
18
19case "$1" in
20create)
21 mkdir ${newjail_root} && cd ${ezjail_jailtemplate} \
22 && find * | cpio -p -v ${newjail_root}
23 ;;
24delete)
25
26 ;;
27list)
28
29 ;;
30update)
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 ;;
55esac