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 |
84 |
# using roots current password |
# using roots current password |
85 |
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} |
86 |
echo >> ${grubconf} |
echo >> ${grubconf} |
87 |
acho "# normal boot" >> ${grubconf} |
echo "# normal boot" >> ${grubconf} |
88 |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} |
89 |
echo "root ${grubroot}" >> ${grubconf} |
echo "root ${grubroot}" >> ${grubconf} |
90 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet" >> ${grubconf} |
101 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} |
102 |
} |
} |
103 |
|
|
104 |
# checks if compilation should be against alx |
## compat |
105 |
target_alx_dev() |
alx_grub_update_new() |
|
{ |
|
|
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 |
|
|
} |
|
|
|
|
|
# check if compilation should be against stripped down alx |
|
|
target_alx() |
|
106 |
{ |
{ |
107 |
if [ -n "${MAGE_TARGETS}" ] |
echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" |
108 |
then |
alx_grub_update |
109 |
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 |
|
110 |
} |
} |