Commit 8789199c authored by Heinz N. Gies's avatar Heinz N. Gies

Add init and halt scripts

parent 7d8199b6
......@@ -2,8 +2,8 @@
# All strings act as templates, possbile parameters
# are:
#
# {jexec} - the jexec binary
# {jail_id} - the jail_id (for running jails)
# {inner_id} - the jid of the inner jail (only halt, login)
# {ounter_id} - the jid of the outer jail (only halt, login)
# {jail_uuid} - uuid if the jail
# {jail_root} - root of the jail
# {brand_root} - root of this brand
......@@ -11,18 +11,28 @@
modname=jail
[init]
cmd="{brand_root}/init"
args=[]
[login]
cmd="{jexec}"
args=["{jail_id}", "/bin/csh"]
# install is executed after cloning
[install]
cmd="{brand_root}/install"
args=["{jail_root}"]
args=["{jail_root}", "{brand_root}"]
# installed before booting (on the host)
[init]
cmd="{brand_root}/init"
args=["{jail_root}", "{brand_root}"]
# executed after booting the outer zone to
# boot the inner zone
[boot]
cmd="{brand_root}/boot"
args=["{jail_uuid}" "{hostname}"]
# Halt the jail executed on the host before
# rctl and interfaces are torn down
[halt]
cmd="{brand_root}/halt"
args=["{jail_root}"]
args=["{jail_root}", "{inner_id}"]
[login]
cmd="/usr/sbin/jexec"
args=["{jail_id}", "/bin/csh"]
\ No newline at end of file
#!/bin/sh
# include shared utility functions
. ../shared/utils.sh
jail_root="$1"
inner_id="$2"
validate_root "${jail_root}"
# cleanly shut down the inner jail (should this be run inside the outer jail?)
if [ ! -z "${inner_id}" ]
then
jexec ${inner_id} /bin/sh /etc/rc.shutdown
fi
# outer jail
mount -t devfs devfs ${jail_root}/root/dev
# inner jail
mount -t devfs devfs ${jail_root}/root/jail/dev
#!/bin/sh
# include shared utility functions
. ../shared/utils.sh
jail_root="$1"
brand_root="$2"
validate_root "${jail_root}"
# delete the old brand
echo rm -r ${jail_root}/root$(dirname ${brand_root})
# create a new folder for the brand
echo mkdir -p ${jail_root}/root$(dirname ${brand_root})
# copy over our brand
echo cp -r ${brand_root} ${jail_root}/root$(dirname ${brand_root})
# mount devfs (not sure about this)
# outer jail
mount -t devfs devfs ${jail_root}/root/dev
# inner jail
mount -t devfs devfs ${jail_root}/root/jail/dev
......@@ -4,6 +4,7 @@
. ../shared/utils.sh
jail_root="$1"
brand_root="$2"
validate_root "${jail_root}"
......@@ -42,6 +43,11 @@ do
echo cp ${file} ${jail_root}/root${file}
done
# install the branch information
echo mkdir -p ${jail_root}/root$(dirname ${brand_root})
echo cp -r ${brand_root} ${jail_root}/root$(dirname ${brand_root})
#TODO: network config:
# * get resolvers and set them resolvers
# * routs? (do we need to set them?)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment