-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo-kernel-install.sh
More file actions
executable file
·78 lines (63 loc) · 2.27 KB
/
do-kernel-install.sh
File metadata and controls
executable file
·78 lines (63 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
. do-config.sh
case "$ARCH" in
"arm")
echo "Extract the kernel bzImage"
extract_kernel_from_deb \
"${KERNEL_ARCHIVES_DIR}/${IMAGE_DEB}" \
"./boot/${KERNEL_VMLINUZ}" \
"${KERNEL_ARCHIVES_DIR}/${KERNEL_VMLINUZ}.${ARCH}"
;;
"i386")
;;
"amd64")
;;
*)
;;
esac
#set -x
start_vm
echo "See if we need to reboot to the base kernel..."
current_kernel=`ssh -t ${TEST_HOST_IP} sudo "uname -r"`
if [ "${KERNEL_VERSION}-${VERSION}" == "${current_kernel%%?}" ]; then
echo "Reboot to base kernel..."
ssh -t ${TEST_HOST_IP} sudo "grub-reboot \"${QEMU_DEFAULT_KERNEL_ENTRY}\""
stop_vm
start_vm
fi
echo "Do some cleanup..."
echo "Remove all previously upload deb files..."
ssh -t ${TEST_HOST_IP} sudo "rm -f ${KERNEL_ARCHIVES_DIR}/*.deb"
echo "Remove previously installed mach-o kernel..."
#ssh ${TEST_HOST_IP} sudo "sh -c \"yes n | apt-get remove --purge --force-yes --yes ${IMAGE} ${HEADER}\""
ssh -t ${TEST_HOST_IP} sudo "sh -c \"yes n | apt-get remove --purge --force-yes --yes '.*macho.*'\""
ssh -t ${TEST_HOST_IP} sudo "rm -Rf /lib/modules/*macho*"
echo "Upload the new kernel..."
ssh -t ${TEST_HOST_IP} mkdir -p ${KERNEL_ARCHIVES_DIR}
scp ${KERNEL_ARCHIVES_DIR}/${HEADER_DEB} \
${KERNEL_ARCHIVES_DIR}/${IMAGE_DEB} \
${TEST_HOST_IP}:${KERNEL_ARCHIVES_DIR}
echo "Install the new kernel..."
ssh -t ${TEST_HOST_IP} sudo "sh -c \"yes n | dpkg -i ${KERNEL_ARCHIVES_DIR}/${HEADER_DEB}\""
ssh -t ${TEST_HOST_IP} sudo "sh -c \"yes n | dpkg -i ${KERNEL_ARCHIVES_DIR}/${IMAGE_DEB}\""
echo "Remove the deb files..."
ssh -t ${TEST_HOST_IP} sudo "rm -f ${KERNEL_ARCHIVES_DIR}/${HEADER_DEB} ${KERNEL_ARCHIVES_DIR}/${IMAGE_DEB}"
# Before halting the VM
case "$ARCH" in
"i386"|"amd64")
# FIXME
ssh -t ${TEST_HOST_IP} "sudo update-initramfs -c -k ${KERNEL_VERSION}-${VERSION} "
ssh -t ${TEST_HOST_IP} "sudo grub-set-default \"Ubuntu, with Linux ${KERNEL_VERSION}-${VERSION}\""
ssh -t ${TEST_HOST_IP} "sudo update-grub"
;;
"arm")
ssh -t ${TEST_HOST_IP} "sudo update-initramfs -c -k ${KERNEL_VERSION}-${VERSION} "
ssh -t ${TEST_HOST_IP} "ls -l /boot"
scp ${TEST_HOST_IP}:/boot/${KERNEL_VMLINUZ} ${KERNEL_ARCHIVES_DIR}/${KERNEL_VMLINUZ}.${ARCH}
scp ${TEST_HOST_IP}:/boot/${KERNEL_INITRD} ${KERNEL_ARCHIVES_DIR}/${KERNEL_INITRD}.${ARCH}
;;
*)
;;
esac
stop_vm
exit_ok $0