Make linux optional as all other configs.
[syslinux-debian/hramrach.git] / debian / local / extlinux.d / 0010-linux
blob90c39aeab6dad973be826f758385a432e2a72360
1 #!/bin/sh
3 ## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
4 ##
5 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
6 ## This is free software, and you are welcome to redistribute it
7 ## under certain conditions; see COPYING for details.
10 set -e
12 . /usr/share/extlinux/extlinux-update.sh
14 if [ "${EXTLINUX_LINUX}" != "true" ]
15 then
16 echo "I: linux disabled in /etc/default/extlinux: Skipping ${_EXTLINUX_DIRECTORY}/linux.cfg"
17 exit 0
20 if ! ls /boot/vmlinuz* 2>&1
21 then
22 echo "I: /boot/vmlinuz* - No such files: Skipping ${_EXTLINUX_DIRECTORY}/linux.cfg"
23 exit 0
26 # Create linux.cfg
27 _CONFIG="\
28 ## ${_EXTLINUX_DIRECTORY}/linux.cfg
30 ## IMPORTANT WARNING
32 ## The configuration of this file is generated automatically.
33 ## Do not edit this file manually, use: extlinux-update
38 # Find linux versions
39 _VERSIONS="$(cd /boot && ls vmlinuz-* | grep -v .dpkg-tmp | sed -e 's|vmlinuz-||g' | sort -Vr)"
42 for _VERSION in ${_VERSIONS}
44 echo "P: Writing config for /boot/vmlinuz-${_VERSION}..."
46 _NUMBER="${_NUMBER:-0}"
47 _ENTRY="${_ENTRY:-1}"
49 if [ -e /boot/initrd.img-${_VERSION} ]
50 then
51 _INITRD="initrd=${_BOOT_DIRECTORY}/initrd.img-${_VERSION}"
52 else
53 _INITRD=""
56 if echo ${EXTLINUX_ALTERNATIVES} | grep -q default
57 then
58 # Writing default entry
59 _CONFIG="${_CONFIG}
61 label l${_NUMBER}
62 menu label ${EXTLINUX_MENU_LABEL} ${_VERSION}"
64 if [ "${EXTLINUX_DEFAULT}" = "l${_NUMBER}" ]
65 then
66 _CONFIG="${_CONFIG}
67 menu default"
70 _CONFIG="${_CONFIG}
71 linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
72 append ${_INITRD} ${EXTLINUX_ROOT} ${EXTLINUX_PARAMETERS}"
75 if echo ${EXTLINUX_ALTERNATIVES} | grep -q live
76 then
77 # Writing live entry
78 _CONFIG="${_CONFIG}
80 label l${_NUMBER}l
81 menu label ${EXTLINUX_MENU_LABEL} ${_VERSION} (live mode)"
83 if [ "${EXTLINUX_DEFAULT}" = "l${_NUMBER}l" ]
84 then
85 _CONFIG="${_CONFIG}
86 menu default"
89 _CONFIG="${_CONFIG}
90 linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
91 append ${_INITRD} ${EXTLINUX_ROOT} ${EXTLINUX_PARAMETERS} boot=live plainroot
92 text help
93 This option boots the system into live mode (non-persistent)
94 endtext"
97 if echo ${EXTLINUX_ALTERNATIVES} | grep -q recovery
98 then
99 # Writing recovery entry
100 _CONFIG="${_CONFIG}
102 label l${_NUMBER}r
103 menu label ${EXTLINUX_MENU_LABEL} ${_VERSION} (recovery mode)"
105 if [ "${EXTLINUX_DEFAULT}" = "l${_NUMBER}r" ]
106 then
107 _CONFIG="${_CONFIG}
108 menu default"
111 _CONFIG="${_CONFIG}
112 linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
113 append ${_INITRD} ${EXTLINUX_ROOT} $(echo ${EXTLINUX_PARAMETERS} | sed -e 's| quiet||') single
114 text help
115 This option boots the system into recovery mode (single-user)
116 endtext"
119 _NUMBER="$((${_NUMBER} + 1))"
121 if [ "${EXTLINUX_ENTRIES}" = "${_ENTRY}" ]
122 then
123 break
125 done
127 _NUMBER=""
129 Update "${_EXTLINUX_DIRECTORY}/linux.cfg" "${_CONFIG}"