Commit c9fa54c4 authored by Heinz N. Gies's avatar Heinz N. Gies

Fix scripts for os jails

parent 52acf099
Pipeline #12343651 passed with stage
in 3 minutes and 49 seconds
[root]
name = "vmadm"
version = "0.2.2"
version = "0.3.0"
dependencies = [
"aud 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bzip2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
......
......@@ -2,12 +2,13 @@
# Note this gets executed INSIDE the outer jail not on the host!
# include shared utility functions
. ../shared/utils.sh
brand_root="$1"
uuid="$2"
hostname="$3"
uuid="$1"
hostname="$2"
# include shared utility functions
. ${brand_root}/../shared/utils.sh
# create
jail -c persist \
......
......@@ -14,25 +14,25 @@ modname="jail"
# install is executed after cloning
[install]
cmd="{brand_root}/install"
args=["{jail_root}", "{brand_root}"]
args=["{brand_root}", "{jail_root}"]
# installed before booting (on the host)
[init]
cmd="{brand_root}/init"
args=["{jail_root}", "{brand_root}"]
args=["{brand_root}", "{jail_root}"]
# executed after booting the outer zone to
# boot the inner zone
[boot]
cmd="{brand_root}/boot"
args=["{jail_uuid}", "{hostname}"]
args=["{brand_root}", "{jail_uuid}", "{hostname}"]
# Halt the jail executed on the host before
# rctl and interfaces are torn down, the outer
# jail is then shut down
[halt]
cmd="{brand_root}/halt"
args=["{jail_root}", "{inner_id}"]
args=["{brand_root}", "{jail_root}", "{inner_id}"]
[login]
cmd="/usr/sbin/jexec"
......
#!/bin/sh
# include shared utility functions
. ../shared/utils.sh
jail_root="$1"
inner_id="$2"
brand_root="$1"
jail_root="$2"
inner_id="$3"
. ${brand_root}/../shared/utils.sh
validate_root "${jail_root}"
......
#!/bin/sh
brand_root="$1"
jail_root="$2"
# include shared utility functions
. ../shared/utils.sh
jail_root="$1"
brand_root="$2"
. ${brand_root}/../shared/utils.sh
validate_root "${jail_root}"
......
#!/bin/sh
brand_root="$1"
jail_root="$2"
# include shared utility functions
. ../shared/utils.sh
. ${brand_root}/../shared/utils.sh
jail_root="$1"
brand_root="$2"
validate_root "${jail_root}"
......@@ -21,9 +22,9 @@ find x/${jail_root}/root \
dirs="bin dev mnt proc tmp etc/defaults"
for dir in ${dirs}
do
echo mkdir -p ${jail_root}/root/${dir}
echo chown root:wheel ${jail_root}/root/${dir}
echo chmod 775 ${jail_root}/root/${dir}
mkdir -p ${jail_root}/root/${dir}
chown root:wheel ${jail_root}/root/${dir}
chmod 775 ${jail_root}/root/${dir}
done
## required files:
......@@ -39,14 +40,17 @@ done
## copy the files in the zone root
for file in ${files}
do
echo mkdir -p ${jail_root}/root$(dirname ${file})
echo cp ${file} ${jail_root}/root${file}
mkdir -p ${jail_root}/root$(dirname ${file})
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})
mkdir -p ${jail_root}/root$(dirname ${brand_root})
cp -r ${brand_root} ${jail_root}/root$(dirname ${brand_root})
mkdir -p ${jail_root}/root$(dirname ${brand_root})/../shared
cp -r ${brand_root} ${jail_root}/root$(dirname ${brand_root})/../shared
#TODO: network config:
# * get resolvers and set them resolvers
......
......@@ -7,6 +7,10 @@ validate_root () {
exit 1
fi
if echo "$1" | fgrep '..' > /dev/null
then
echo "invalid path: $1"
exit 1
fi
if [ ! -d "$1" ]
then
echo "relative path not allowed: $1"
......
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