3 |
- |
1 |
#!/bin/sh
|
|
|
2 |
|
|
|
3 |
###################################################
|
|
|
4 |
# Start by setting up the console to work as a user
|
|
|
5 |
# expects
|
|
|
6 |
###################################################
|
|
|
7 |
exec >/dev/console 2>&1
|
|
|
8 |
export TERM=linux
|
|
|
9 |
export PS1='initramfs-test:\w\$ '
|
|
|
10 |
stty sane
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
##################################################
|
|
|
14 |
# Start udev up
|
|
|
15 |
##################################################
|
|
|
16 |
start_udev
|
|
|
17 |
|
|
|
18 |
##################################################
|
|
|
19 |
# Load all the modules based on
|
|
|
20 |
# /etc/module_load_list
|
|
|
21 |
##################################################
|
|
|
22 |
load_modules
|
|
|
23 |
|
|
|
24 |
##################################################
|
|
|
25 |
# Assemble any existing lvm arrays
|
|
|
26 |
##################################################
|
|
|
27 |
assemble_lvm_array
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
##################################################
|
|
|
31 |
# Assemble any mdraid partitions that might exist
|
|
|
32 |
##################################################
|
|
|
33 |
#TODO - FILL ME IN
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
##################################################
|
|
|
37 |
# Mount the root file system
|
|
|
38 |
# Note that the sample manifest modified
|
|
|
39 |
# The /etc/fstab file to put the root file system
|
|
|
40 |
# under /mnt directly
|
|
|
41 |
##################################################
|
|
|
42 |
mount /mnt
|
|
|
43 |
if [ $? -ne 0]
|
|
|
44 |
echo "Failed to mount root fs for dump capture. rebooting"
|
|
|
45 |
reboot -f
|
|
|
46 |
fi
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
##################################################
|
|
|
50 |
# Now capture the core dump to the target fs
|
|
|
51 |
# Note we need to set the date here
|
|
|
52 |
##################################################
|
|
|
53 |
if [ -f /etc/clock ]
|
|
|
54 |
then
|
|
|
55 |
. /etc/clock
|
|
|
56 |
fi
|
|
|
57 |
if [ "$UTC" == "true" ]
|
|
|
58 |
then
|
|
|
59 |
TIME_FORMAT=-u
|
|
|
60 |
else
|
|
|
61 |
TIME_FORMAT=-l
|
|
|
62 |
fi
|
|
|
63 |
hwclock --hctosys $TIME_FORMAT
|
|
|
64 |
|
|
|
65 |
DATE=`date +%Y-%m-%d-%T`
|
|
|
66 |
|
|
|
67 |
cp /proc/vmcore /mnt/var/crash/$DATE/vmcore
|
|
|
68 |
|
|
|
69 |
##################################################
|
|
|
70 |
# Reboot the system to get back to production
|
|
|
71 |
##################################################
|
|
|
72 |
reboot -f
|