Update
This commit is contained in:
parent
1960a080d7
commit
bcd97f4b5d
|
@ -80,61 +80,68 @@ fi
|
|||
|
||||
echo "Found $KERNEL_DIR"
|
||||
|
||||
theme=$(cat "${ESP}/EFI/refind/refind.conf" | grep themes | cut -d"/" -f2)
|
||||
theme=$(grep "themes" "/efi/EFI/refind/refind.conf" | cut -d"/" -f2)
|
||||
|
||||
if [ -d $KERNEL_DIR ]; then
|
||||
if [ -d "$KERNEL_DIR" ]; then
|
||||
|
||||
if [ -f "${ESP}/EFI/Linux/cmdline.txt" ]; then
|
||||
CMDLINE=$(sed -e 's/^[[:space:]]//g' -e 's/[[:space:]]$//g' "${ESP}/EFI/Linux/cmdline.txt")
|
||||
|
||||
elif [ -f "/etc/kernel/cmdline" ]; then
|
||||
CMDLINE=$(sed -e 's/^[[:space:]]//g' -e 's/[[:space:]]$//g' "/etc/kernel/cmdline")
|
||||
|
||||
elif [ -f "/boot/refind_linux.conf" ]; then
|
||||
CMDLINE=$(cat "/boot/refind_linux.conf" | head -n 1 | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
CMDLINE=$(head -n 1 < "/boot/refind_linux.conf" | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
|
||||
elif [ -f "/efi/refind_linux.conf" ]; then
|
||||
CMDLINE=$(cat "/efi/refind_linux.conf" | head -n 1 | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
elif [ -f "/boot//efi/refind_linux.conf" ]; then
|
||||
CMDLINE=$(cat "/boot/efi/refind_linux.conf" | head -n 1 | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
CMDLINE=$(head -n 1 < "/efi/refind_linux.conf" | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
|
||||
elif [ -f "/boot/efi/refind_linux.conf" ]; then
|
||||
CMDLINE=$(head -n 1 < "/boot/efi/refind_linux.conf" | sed -e 's|"Boot with standard options"||g' | awk '{$1=$1;print}' | sed -e 's/"//g')
|
||||
|
||||
else
|
||||
CMDLINE=$(sed -e 's/^[[:space:]]//g' -e 's/[[:space:]]$//g' -e 's/initrd.*$//g' "/proc/cmdline")
|
||||
fi
|
||||
|
||||
echo $CMDLINE
|
||||
echo "$CMDLINE"
|
||||
|
||||
manual_conf=$(mktemp)
|
||||
|
||||
template="/etc/refind-menu-generator/menu-template.txt"
|
||||
|
||||
for i in $(ls -1 "${ESP}/EFI/Linux/" | grep 'linu' | grep -v 'fallback' | grep '\.efi$');
|
||||
kernels_list=$(ls -1 "${ESP}/EFI/Linux/" | grep 'linu' | grep -v 'fallback' | grep '\.efi$')
|
||||
|
||||
for i in $kernels_list;
|
||||
do
|
||||
kernel=$(echo $i | sed 's/\.efi//g')
|
||||
kernel=$(echo "$i" | sed 's/\.efi//g')
|
||||
kernel_efi=$kernel
|
||||
kernel_vmlinuz="vmlinuz-$kernel"
|
||||
|
||||
osname=$(cat /etc/os-release | grep "^NAME=" | cut -d'=' -f2 | sed -e 's/"//g')
|
||||
icon=$(cat /etc/os-release | grep "^ID=" | cut -d'=' -f2 | sed -e 's/"//g')
|
||||
osname=$(grep "^NAME=" /etc/os-release | cut -d'=' -f2 | sed -e 's/"//g')
|
||||
icon=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | sed -e 's/"//g')
|
||||
|
||||
initramfs_tpl=$(echo "initramfs-$kernel" | sed "s/vmlinuz-//g")
|
||||
initramfs=$(echo "$initramfs_tpl.img")
|
||||
initramfs_fallback=$(echo "$initramfs_tpl-fallback.img")
|
||||
initramfs="$initramfs_tpl.img"
|
||||
initramfs_fallback="$initramfs_tpl-fallback.img"
|
||||
|
||||
echo "OSNAME: $osname; THEME: $theme; ICON: $icon; KERNEL: $kernel; KERNEL_EFI: $kernel_efi; KERNEL_VMLINUZ: $kernel_vmlinuz; INITRAMFS: $initramfs; INITRAMFS_FALLBACK: $initramfs_fallback; CMDLINE: $CMDLINE"
|
||||
sed -e "s|{OSNAME}|$osname|g" -e "s|{THEME}|$theme|g" -e "s|{ICON}|$icon|g" -e "s|{KERNEL}|$kernel|g" -e "s|{KERNEL_EFI}|$kernel_efi|g" -e "s|{KERNEL_VMLINUZ}|$kernel_vmlinuz|g" -e "s|{INITRAMFS}|$initramfs|g" -e "s|{INITRAMFS_FALLBACK}|$initramfs_fallback|g" -e "s|{CMDLINE}|$CMDLINE|g" $template >> $manual_conf
|
||||
sed -e "s|{OSNAME}|$osname|g" -e "s|{THEME}|$theme|g" -e "s|{ICON}|$icon|g" -e "s|{KERNEL}|$kernel|g" -e "s|{KERNEL_EFI}|$kernel_efi|g" -e "s|{KERNEL_VMLINUZ}|$kernel_vmlinuz|g" -e "s|{INITRAMFS}|$initramfs|g" -e "s|{INITRAMFS_FALLBACK}|$initramfs_fallback|g" -e "s|{CMDLINE}|$CMDLINE|g" "$template" >> "$manual_conf"
|
||||
done
|
||||
|
||||
manual_end_conf=$(mktemp)
|
||||
|
||||
template_end="/etc/refind-menu-generator/menu-end.txt"
|
||||
|
||||
sed -e "s/{THEME}/$theme/g" $template_end >> $manual_end_conf
|
||||
sed -e "s/{THEME}/$theme/g" "$template_end" >> "$manual_end_conf"
|
||||
|
||||
cat $manual_end_conf >> $manual_conf
|
||||
cat "$manual_end_conf" >> "$manual_conf"
|
||||
|
||||
cp -vf $manual_conf "${ESP}/EFI/refind/manual.conf"
|
||||
cp -vf "$manual_conf" "${ESP}/EFI/refind/manual.conf"
|
||||
|
||||
if [ -d "${ESP}/EFI/boot" ]; then
|
||||
cp -vf $manual_conf "${ESP}/EFI/boot/manual.conf"
|
||||
cp -vf "$manual_conf" "${ESP}/EFI/boot/manual.conf"
|
||||
fi
|
||||
|
||||
rm -f $manual_conf
|
||||
rm -f $manual_end_conf
|
||||
rm -f "$manual_conf"
|
||||
rm -f "$manual_end_conf"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue