mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Simplify ONE Context installation
This commit is contained in:
parent
7eaec5ec4d
commit
170e0d942d
3 changed files with 15 additions and 109 deletions
|
@ -1,5 +1,6 @@
|
||||||
|
import tasks
|
||||||
|
|
||||||
|
|
||||||
def resolve_tasks(taskset, manifest):
|
def resolve_tasks(taskset, manifest):
|
||||||
import tasks
|
taskset.add(tasks.AddONEContextPackage)
|
||||||
taskset.add(tasks.OpenNebulaContext)
|
taskset.add(tasks.OpenNebulaContext)
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# This file generates the old menu.lst configuration with grub2
|
|
||||||
# It was copied from tomheadys github repo:
|
|
||||||
# https://github.com/tomheady/ec2debian/blob/master/src/root/etc/grub.d/40_custom
|
|
||||||
|
|
||||||
prefix=/usr
|
|
||||||
exec_prefix=${prefix}
|
|
||||||
bindir=${exec_prefix}/bin
|
|
||||||
libdir=${exec_prefix}/lib
|
|
||||||
. ${libdir}/grub/grub-mkconfig_lib
|
|
||||||
|
|
||||||
export TEXTDOMAIN=grub
|
|
||||||
export TEXTDOMAINDIR=${prefix}/share/locale
|
|
||||||
|
|
||||||
GRUB_DEVICE=/dev/sda1
|
|
||||||
|
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
set default=${GRUB_DEFAULT}
|
|
||||||
set timeout=${GRUB_TIMEOUT}
|
|
||||||
insmod part_msdos
|
|
||||||
insmod ext2
|
|
||||||
insmod gettext
|
|
||||||
set menu_color_normal=cyan/blue
|
|
||||||
set menu_color_highlight=white/blue
|
|
||||||
set root='(hd0,msdos1)'
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if ${GRUB_HIDDEN_TIMEOUT:-false}; then
|
|
||||||
printf "hiddenmenu\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
linux_entry ()
|
|
||||||
{
|
|
||||||
os="$1"
|
|
||||||
version="$2"
|
|
||||||
args="$4"
|
|
||||||
|
|
||||||
title="$(gettext_quoted "%s, with Linux %s")"
|
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
menuentry 'Debian GNU/Linux for OpenNebula, ${version}' --class debian --class gnu-linux --class os {
|
|
||||||
insmod part_msdos
|
|
||||||
insmod ext2
|
|
||||||
set timeout=${GRUB_TIMEOUT}
|
|
||||||
set root='(hd0,msdos1)'
|
|
||||||
echo 'Loading Linux ${version}'
|
|
||||||
linux ${rel_dirname}/${basename} root=${GRUB_DEVICE} ro ${args}
|
|
||||||
echo 'Loading initial ramdisk ...'
|
|
||||||
initrd ${rel_dirname}/${initrd}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* ; do
|
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
|
||||||
done`
|
|
||||||
prepare_boot_cache=
|
|
||||||
|
|
||||||
while [ "x$list" != "x" ] ; do
|
|
||||||
linux=`version_find_latest $list`
|
|
||||||
basename=`basename $linux`
|
|
||||||
dirname=`dirname $linux`
|
|
||||||
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
|
||||||
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
|
|
||||||
alt_version=`echo $version | sed -e "s,\.old$,,g"`
|
|
||||||
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
|
|
||||||
|
|
||||||
initrd=
|
|
||||||
for i in "initrd.img-${version}" "initrd-${version}.img" \
|
|
||||||
"initrd-${version}" "initramfs-${version}.img" \
|
|
||||||
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
|
|
||||||
"initrd-${alt_version}" "initramfs-${alt_version}.img"; do
|
|
||||||
if test -e "${dirname}/${i}" ; then
|
|
||||||
initrd="$i"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
initramfs=
|
|
||||||
for i in "config-${version}" "config-${alt_version}"; do
|
|
||||||
if test -e "${dirname}/${i}" ; then
|
|
||||||
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${dirname}/${i}" | cut -f2 -d= | tr -d \"`
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
linux_entry "${OS}" "${version}" \
|
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
||||||
|
|
||||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
|
||||||
done
|
|
|
@ -5,34 +5,32 @@ import os
|
||||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||||
|
|
||||||
|
|
||||||
|
class AddONEContextPackage(Task):
|
||||||
|
description = 'Adding the OpenNebula context package'
|
||||||
|
phase = phases.preparation
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run(cls, info):
|
||||||
|
package = os.path.join(assets, 'one-context_3.8.1.deb')
|
||||||
|
info.packages.add_local(package)
|
||||||
|
|
||||||
|
|
||||||
class OpenNebulaContext(Task):
|
class OpenNebulaContext(Task):
|
||||||
description = 'Setup OpenNebula init context'
|
description = 'Setup OpenNebula init context'
|
||||||
phase = phases.system_modification
|
phase = phases.system_modification
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
import stat
|
|
||||||
rwxr_xr_x = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
|
|
||||||
stat.S_IRGRP | stat.S_IXGRP |
|
|
||||||
stat.S_IROTH | stat.S_IXOTH)
|
|
||||||
|
|
||||||
from shutil import copy
|
|
||||||
script_src = os.path.join(assets, 'one-context_3.8.1.deb')
|
|
||||||
script_dst = os.path.join(info.root, 'tmp/one-context_3.8.1.deb')
|
|
||||||
copy(script_src, script_dst)
|
|
||||||
os.chmod(script_dst, rwxr_xr_x)
|
|
||||||
|
|
||||||
from common.tools import log_check_call
|
|
||||||
log_check_call(['/usr/sbin/chroot', info.root,
|
|
||||||
'/usr/bin/dpkg', '--install', '/tmp/one-context_3.8.1.deb'])
|
|
||||||
# Fix start
|
# Fix start
|
||||||
from common.tools import sed_i
|
from common.tools import sed_i
|
||||||
vmcontext_def = os.path.join(info.root, 'etc/init.d/vmcontext')
|
vmcontext_def = os.path.join(info.root, 'etc/init.d/vmcontext')
|
||||||
sed_i(vmcontext_def, '# Default-Start:', '# Default-Start: 2 3 4 5')
|
sed_i(vmcontext_def, '# Default-Start:', '# Default-Start: 2 3 4 5')
|
||||||
os.chmod(vmcontext_def, rwxr_xr_x)
|
|
||||||
|
from common.tools import log_check_call
|
||||||
log_check_call(['/usr/sbin/chroot', info.root, 'update-rc.d', 'vmcontext', 'start',
|
log_check_call(['/usr/sbin/chroot', info.root, 'update-rc.d', 'vmcontext', 'start',
|
||||||
'90', '2', '3', '4', '5', 'stop', '90', '0', '6'])
|
'90', '2', '3', '4', '5', 'stop', '90', '0', '6'])
|
||||||
|
|
||||||
|
from shutil import copy
|
||||||
# Load all pubkeys in root authorized_keys
|
# Load all pubkeys in root authorized_keys
|
||||||
script_src = os.path.join(assets, 'one-pubkey.sh')
|
script_src = os.path.join(assets, 'one-pubkey.sh')
|
||||||
script_dst = os.path.join(info.root, 'etc/one-context.d/one-pubkey.sh')
|
script_dst = os.path.join(info.root, 'etc/one-context.d/one-pubkey.sh')
|
||||||
|
|
Loading…
Add table
Reference in a new issue