# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../syslinux/stone_mod_extlinux.sh # Copyright (C) 2006 - 2008 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # # More information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- # # [MAIN] 70 extlinux extlinux (syslinux) Boot Loader Setup # [SETUP] 90 extlinux create_kernel_list() { local label= first=1 initrd= first=1 for x in `(cd /boot/ ; ls vmlinuz_* ) | sort -r` ; do if [ $first = 1 ] ; then label=linux ; first=0 else label=linux-${x/vmlinuz_/} label=${label/-dist/} fi initrd=initrd-${x/vmlinuz_/}.img cat <<-EOT LABEL $label KERNEL /$x APPEND initrd=/$initrd root=$rootdev ro EOT done } create_extlinux_conf() { i=0 ; rootdev="`grep ' / ' /proc/mounts | tail -n 1 | \ awk '/\/dev\// { print $1; }'`" rootdev="$( cd ${rootdev%/*} ; pwd -P )/${rootdev##*/}" # TODO: readlink? //mnemoc while [ -L $rootdev ] ; do directory="$( cd `dirname $rootdev` ; pwd -P )" rootdev="$( ls -l $rootdev | sed 's,.* -> ,,' )" [ "${rootdev##/*}" ] && rootdev="$directory/$rootdev" i=$(( $i + 1 )) ; [ $i -gt 20 ] && rootdev="Not found!" done bootdev="`echo $rootdev | sed -e 's,[0-9]*$,,'`" mkdir -p /boot/extlinux cat <<-EOT > /boot/extlinux/extlinux.conf DEFAULT linux PROMPT 1 TIMEOUT 300 EOT create_kernel_list >> /boot/extlinux/extlinux.conf gui_message "This is the new /boot/extlinux/extlinux.conf file: $( cat /boot/extlinux/extlinux.conf )" } main() { while gui_menu extlinux 'Extlinux (syslinux) Boot Loader Setup' \ '(Re-)Create extlinux.conf with installed kernels' 'create_extlinux_conf' \ '(Re-)Install extlinux in /boot/extlinux' \ 'gui_cmd "Installing extlinux in /boot/extlinux" "mkdir -p /boot/extlinux; extlinux -i /boot/extlinux"' \ "Edit /boot/extlinux/extlinux.conf (recommended before installing extlinux)" \ "gui_edit 'Extlinux Config File' /boot/extlinux/extlinux.conf" do : ; done }