26 |
{ |
{ |
27 |
local KERNEL_IMAGE |
local KERNEL_IMAGE |
28 |
local KERNEL_DESCRIPTION |
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 |
|
|
|
|
|
# fix kernel image |
|
|
old_image="$(basename $(cat /boot/grub/grub.conf|grep kernel |cut -d' ' -f2))" |
|
|
sed -i "s:${old_image}:${KERNEL_IMAGE}:" /boot/grub/grub.conf |
|
|
} |
|
|
|
|
|
# updates /boot/grub/grub.conf with given params |
|
|
# example: alx_grub_update kernel-image-name description |
|
|
alx_grub_update_new() |
|
|
{ |
|
|
local KERNEL_IMAGE |
|
|
local KERNEL_DESCRIPTION |
|
29 |
local i |
local i |
30 |
local rootfs |
local rootfs |
31 |
local grubroot |
local grubroot |
91 |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} |
echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} |
92 |
} |
} |
93 |
|
|
94 |
# checks if compilation should be against alx |
## compat |
95 |
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() |
|
96 |
{ |
{ |
97 |
if [ -n "${MAGE_TARGETS}" ] |
echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" |
98 |
then |
alx_grub_update |
99 |
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 |
|
100 |
} |
} |