39 |
local i |
local i |
40 |
local rootfs |
local rootfs |
41 |
local grubroot |
local grubroot |
42 |
|
local grubopts |
43 |
local OLD_IFS |
local OLD_IFS |
44 |
local grubconf="/boot/grub/grub.conf" |
local grubconf="/boot/grub/grub.conf" |
45 |
|
local pass |
46 |
|
|
47 |
KERNEL_IMAGE="$1" |
KERNEL_IMAGE="$1" |
48 |
KERNEL_DESCRIPTION="$2" |
KERNEL_DESCRIPTION="$2" |
79 |
done |
done |
80 |
IFS="${OLD_IFS}" |
IFS="${OLD_IFS}" |
81 |
|
|
82 |
|
# check for special hardware |
83 |
|
if [[ -x $(which hwinfo) ]] |
84 |
|
then |
85 |
|
# zotac devices |
86 |
|
if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] |
87 |
|
then |
88 |
|
grubopts="rootdelay=8" |
89 |
|
echo "Special device 'ZOTAC' detected!" |
90 |
|
fi |
91 |
|
fi |
92 |
|
|
93 |
# fix description |
# fix description |
94 |
: > ${grubconf} |
: > ${grubconf} |
95 |
echo "default 0" >> ${grubconf} |
echo "default 0" >> ${grubconf} |
96 |
echo "timeout 3" >> ${grubconf} |
echo "timeout 3" >> ${grubconf} |
97 |
# using roots current password |
# using roots current password if one was set |
98 |
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
pass="$(grep '^root:' /etc/shadow | cut -d: -f2)" |
99 |
|
if [[ -n ${pass} ]] |
100 |
|
then |
101 |
|
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
102 |
|
fi |
103 |
echo >> ${grubconf} |
echo >> ${grubconf} |
104 |
echo "# normal boot" >> ${grubconf} |
echo "# normal boot" >> ${grubconf} |
105 |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
106 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
107 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts}" >> ${grubconf} |
108 |
echo >> ${grubconf} |
echo >> ${grubconf} |
109 |
echo "# admin boots" >> ${grubconf} |
echo "# admin boots" >> ${grubconf} |
110 |
echo "title ${KERNEL_DESCRIPTION} - Re-run hardware-detection" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION} - Re-run hardware-detection" >> ${grubconf} |
111 |
echo "lock" >> ${grubconf} |
echo "lock" >> ${grubconf} |
112 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
113 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet hardware-auto-detection" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} hardware-auto-detection" >> ${grubconf} |
114 |
echo >> ${grubconf} |
echo >> ${grubconf} |
115 |
echo "title ${KERNEL_DESCRIPTION} - Reset *all* local settings" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION} - Reset *all* local settings" >> ${grubconf} |
116 |
echo "lock" >> ${grubconf} |
echo "lock" >> ${grubconf} |
117 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
118 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} alx-reset-settings" >> ${grubconf} |
119 |
} |
} |
120 |
|
|
121 |
## compat |
## compat |