20 |
done |
done |
21 |
} |
} |
22 |
|
|
23 |
# updates /boot/grub/grub.conf with given params |
add_conf_prot_ignore() |
|
# example: alx_grub_update kernel-image-name description |
|
|
alx_grub_update() |
|
24 |
{ |
{ |
25 |
local KERNEL_IMAGE |
local i |
|
local KERNEL_DESCRIPTION |
|
|
local old_image |
|
|
|
|
|
KERNEL_IMAGE="$1" |
|
|
KERNEL_DESCRIPTION="$2" |
|
|
|
|
|
# some checks |
|
|
if [ -z "${KERNEL_IMAGE}" ] |
|
|
then |
|
|
echo "At least a kernel-image must be given" |
|
|
return 1 |
|
|
fi |
|
|
|
|
|
[ -z "${KERNEL_DESCRIPTION}" ] && KERNEL_DESCRIPTION="${KERNEL_IMAGE}" |
|
|
|
|
|
if [ ! -f /boot/grub/grub.conf ] |
|
|
then |
|
|
echo "/boot/grub/grub.conf not found" |
|
|
return 1 |
|
|
fi |
|
|
|
|
|
# fix description |
|
|
sed -i "s:^\(title=\).*:\1${KERNEL_DESCRIPTION}:" /boot/grub/grub.conf |
|
26 |
|
|
27 |
# fix kernel image |
for i in $@ |
28 |
old_image="$(basename $(cat /boot/grub/grub.conf|grep kernel |cut -d' ' -f2))" |
do |
29 |
sed -i "s:${old_image}:${KERNEL_IMAGE}:" /boot/grub/grub.conf |
export CONFIG_PROTECT_IGNORE="${CONFIG_PROTECT_IGNORE} ${i}" |
30 |
|
done |
31 |
} |
} |
32 |
|
|
33 |
# updates /boot/grub/grub.conf with given params |
# updates /boot/grub/grub.conf with given params |
34 |
# example: alx_grub_update kernel-image-name description |
# example: alx_grub_update kernel-image-name description |
35 |
alx_grub_update_new() |
alx_grub_update() |
36 |
{ |
{ |
37 |
local KERNEL_IMAGE |
local KERNEL_IMAGE |
38 |
local KERNEL_DESCRIPTION |
local KERNEL_DESCRIPTION |
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 |
|
|
78 |
done |
done |
79 |
IFS="${OLD_IFS}" |
IFS="${OLD_IFS}" |
80 |
|
|
81 |
|
# check for special hardware |
82 |
|
if [[ -x $(which hwinfo) ]] |
83 |
|
then |
84 |
|
# zotac devices |
85 |
|
if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] |
86 |
|
then |
87 |
|
grubopts="rootdelay=8" |
88 |
|
echo "Special device 'ZOTAC' detected!" |
89 |
|
fi |
90 |
|
fi |
91 |
|
|
92 |
# fix description |
# fix description |
93 |
: > ${grubconf} |
: > ${grubconf} |
94 |
echo "default 0" >> ${grubconf} |
echo "default 0" >> ${grubconf} |
96 |
# using roots current password |
# using roots current password |
97 |
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
98 |
echo >> ${grubconf} |
echo >> ${grubconf} |
99 |
acho "# normal boot" >> ${grubconf} |
echo "# normal boot" >> ${grubconf} |
100 |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
101 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
102 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts}" >> ${grubconf} |
103 |
echo >> ${grubconf} |
echo >> ${grubconf} |
104 |
echo "# admin boots" >> ${grubconf} |
echo "# admin boots" >> ${grubconf} |
105 |
echo "title ${KERNEL_DESCRIPTION} - Re-run hardware-detection" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION} - Re-run hardware-detection" >> ${grubconf} |
106 |
echo "lock" >> ${grubconf} |
echo "lock" >> ${grubconf} |
107 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
108 |
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} |
109 |
echo >> ${grubconf} |
echo >> ${grubconf} |
110 |
echo "title ${KERNEL_DESCRIPTION} - Reset *all* local settings" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION} - Reset *all* local settings" >> ${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 alx-reset-settings" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} alx-reset-settings" >> ${grubconf} |
|
} |
|
|
|
|
|
# checks if compilation should be against alx |
|
|
target_alx_dev() |
|
|
{ |
|
|
local i |
|
|
|
|
|
if [ -n "${MAGE_TARGETS}" ] |
|
|
then |
|
|
for i in ${MAGE_TARGETS} |
|
|
do |
|
|
[[ ${i} = -alx_dev ]] && return 0 |
|
|
|
|
|
# alx-dev will always build when building target alx, |
|
|
# so target alx ist also allowed to be alx-dev |
|
|
[[ ${i} = -alx ]] && return 0 |
|
|
done |
|
|
fi |
|
|
|
|
|
# nothing match, we are *not* on alx linux |
|
|
return 1 |
|
|
} |
|
|
|
|
|
# check if compilation should be against stripped down alx for livecds |
|
|
target_alx_livecd() |
|
|
{ |
|
|
if [ -n "${MAGE_TARGETS}" ] |
|
|
then |
|
|
for i in ${MAGE_TARGETS} |
|
|
do |
|
|
[[ ${i} = alx_livecd ]] && return 0 |
|
|
done |
|
|
fi |
|
|
|
|
|
# nothing match, we are *not* on alx linux |
|
|
return 1 |
|
114 |
} |
} |
115 |
|
|
116 |
# check if compilation should be against stripped down alx |
## compat |
117 |
target_alx() |
alx_grub_update_new() |
118 |
{ |
{ |
119 |
if [ -n "${MAGE_TARGETS}" ] |
echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" |
120 |
then |
alx_grub_update |
121 |
for i in ${MAGE_TARGETS} |
echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" |
|
do |
|
|
[[ ${i} = -alx ]] && return 0 |
|
|
done |
|
|
fi |
|
|
|
|
|
# nothing match, we are *not* on alx linux |
|
|
return 1 |
|
122 |
} |
} |