Commit 5aa647b9 authored by hark's avatar hark
Browse files

kernel name

parent 1335d7b1
......@@ -10,8 +10,16 @@ KEEP=1
init
get_kernel
#stable_or_mainline_or_repo
download_and_unpack
build_kernel
if ! check_if_build
then
echo "kernel not build yet, building it"
get_kernel
#stable_or_mainline_or_repo
download_and_unpack
build_kernel
fi
create_links
......@@ -19,6 +19,8 @@ function init() {
[[ -z "$KERNELDIR" ]] && { echo "KERNELDIR is empty" ; exit 1; }
[[ -z "$KERNELCONFIG" ]] && { echo "KERNELDIR is empty" ; exit 1; }
[[ -z "$KERNELVERSION" ]] && { echo "KERNELDIR is empty" ; exit 1; }
[[ -z "$KERNELNAME" ]] && { echo "KERNELNAME is empty" ; exit 1; }
[[ -z "$WORKDIR" ]] && { echo "KERNELDIR is empty" ; exit 1; }
......@@ -31,6 +33,8 @@ function init() {
current_dir=$(pwd)
# working_dir=$(mktemp -d)
working_dir=$WORKDIR
kernelname=$KERNELNAME
# mkdir -p $working_dir
cd "${working_dir}" || exit
......@@ -144,6 +148,18 @@ function build_kernel() {
}
function create_links() {
echo "creating links with kernel nickname"
if [ -f "$kerneldir/$kernelname.vmlinuz" ]
then
rm "$kerneldir/$kernelname.vmlinuz.old" && true
mv "$kerneldir/$kernelname.vmlinuz" "$kerneldir/$kernelname.vmlinuz.old" && true
fi
ln -s "$kerneldir/$imagename" "$kerneldir/$kernelname.vmlinuz"
}
function check_if_build() {
if [ -f "$kerneldir/$imagename" ]
then
......
......@@ -3,6 +3,8 @@ define buildkernel::kernel (
String $kernel_workdir = '/root/kernelbuilder',
String $kernel_kerneldir = '/etc/xen/boot',
String $config_version = 'latest',
String $kernel_name = $title,
) {
......@@ -35,6 +37,8 @@ define buildkernel::kernel (
"KERNELVERSION=${kernel_version}",
"KERNELCONFIG=${kernel_workdir}/config_${kernel_version}.kconf",
"KERNELDIR=${kernel_kerneldir}"],
"KERNELNAME=${kernel_name}"],
timeout => 0,
}
......@@ -48,13 +52,18 @@ define buildkernel::kernel (
File[$kernel_workdir],
File[$kernel_kerneldir],
File["$kernel_workdir/config_$kernel_version.kconf"],
],
subscribe => File["$kernel_workdir/config_$kernel_version.kconf"],
refreshonly => true,
unless => "/usr/local/bin/check_kernel.sh",
# onlyif => "/usr/local/bin/check_kernel.sh",
environment => ["WORKDIR=${kernel_workdir}",
"KERNELVERSION=${kernel_version}",
"KERNELCONFIG=${kernel_workdir}/config_${kernel_version}.kconf",
"KERNELDIR=${kernel_kerneldir}"],
"KERNELNAME=${kernel_name}"],
timeout => 0,
}
......
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