8 if [ "$(id -u)" -ne 0 ]
10 echo "E: need root privileges"
14 # Searching extlinux directory
15 echo -n "P: Searching for EXTLINUX directory..."
17 for LOCATION
in /boot
/extlinux
/boot
/boot
/exlinux
/extlinux
19 if [ -e "${LOCATION}" ]
21 DIRECTORY
="${LOCATION}"
23 echo " found: ${DIRECTORY}"
28 if [ -z "${DIRECTORY}" ]
32 echo "E: To create a template run 'mkdir /boot/extlinux' first."
33 echo "E: To install extlinux, do it manually or try the 'extlinux-install' command."
34 echo "E: Warning, extlinux-install is used to change your MBR."
39 if [ ! -e /etc
/default
/extlinux
]
41 EXTLINUX_UPDATE
="true"
42 EXTLINUX_ALTERNATIVES
="default recovery"
45 if [ -x "$(which lsb_release 2>/dev/null)" ]
47 EXTLINUX_MENU_LABEL
="$(lsb_release -i -s) GNU/Linux, kernel"
49 EXTLINUX_MENU_LABEL
="Debian GNU/Linux, kernel"
52 EXTLINUX_PARAMETERS
="ro quiet"
58 read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
<< EOF
62 if [ "${fs_spec}" != "#" ] && [ "${fs_file}" = "/" ]
64 EXTLINUX_ROOT
="root=${fs_spec}"
69 if [ -e /usr
/share
/syslinux
/themes
/debian
/extlinux
]
78 cat > "/etc/default/extlinux" << EOF
79 ## /etc/default/extlinux
81 EXTLINUX_UPDATE="${EXTLINUX_UPDATE}"
83 EXTLINUX_ALTERNATIVES="${EXTLINUX_ALTERNATIVES}"
84 EXTLINUX_DEFAULT="${EXTLINUX_DEFAULT}"
85 EXTLINUX_MENU_LABEL="${EXTLINUX_MENU_LABEL}"
86 EXTLINUX_PARAMETERS="${EXTLINUX_PARAMETERS}"
87 EXTLINUX_ROOT="${EXTLINUX_ROOT}"
88 EXTLINUX_THEME="${EXTLINUX_THEME}"
89 EXTLINUX_TIMEOUT="${EXTLINUX_TIMEOUT}"
93 .
/etc
/default
/extlinux
96 if [ "${EXTLINUX_UPDATE}" != "true" ]
98 echo "P: extlinux-update is disabled in /etc/default/extlinux."
104 cat > "${DIRECTORY}/linux.cfg" << EOF
105 ## ${DIRECTORY}/linux.cfg
109 ## The configuration of this file is generated automatically.
110 ## Do not edit this file manually, use: update-extlinux
114 # Find linux versions
115 VERSIONS
="$(cd /boot && ls vmlinuz-* | sed -e 's|vmlinuz-||g' | sort -r)"
117 if [ "$(stat --printf %d /)" = "$(stat --printf %d /boot)" ]
119 # / and /boot are on the same filesystem
122 # / and /boot are not on the same filesystem
126 for VERSION
in ${VERSIONS}
128 echo "P: Writing config for /boot/vmlinuz-${VERSION}..."
130 NUMBER
="${NUMBER:-0}"
132 if [ -e /boot
/initrd.img-
${VERSION} ]
134 INITRD
="initrd=${BOOT}/initrd.img-${VERSION}"
139 if echo ${EXTLINUX_ALTERNATIVES} |
grep -q default
142 # Writing default entry
143 cat >> "${DIRECTORY}/linux.cfg" << EOF
146 menu label ${EXTLINUX_MENU_LABEL} ${VERSION}
148 kernel ${BOOT}/vmlinuz-${VERSION}
149 append ${INITRD} ${EXTLINUX_ROOT} ${EXTLINUX_PARAMETERS}
154 if echo ${EXTLINUX_ALTERNATIVES} |
grep -q live
158 cat >> "${DIRECTORY}/linux.cfg" << EOF
161 menu label ${EXTLINUX_MENU_LABEL} ${VERSION} (live mode)
163 kernel ${BOOT}/vmlinuz-${VERSION}
164 append ${INITRD} ${EXTLINUX_ROOT} ${EXTLINUX_PARAMETERS} boot=live plainroot
166 This option boots the system into live mode (non-persistent)
172 if echo ${EXTLINUX_ALTERNATIVES} |
grep -q recovery
175 # Writing recovery entry
176 cat >> "${DIRECTORY}/linux.cfg" << EOF
179 menu label ${EXTLINUX_MENU_LABEL} ${VERSION} (recovery mode)
181 kernel ${BOOT}/vmlinuz-${VERSION}
182 append ${INITRD} ${EXTLINUX_ROOT} ${EXTLINUX_PARAMETERS} single
184 This option boots the system into recovery mode (single-user)
190 NUMBER
="$((${NUMBER} + 1))"
193 cat > "${DIRECTORY}/extlinux.conf" << EOF
194 ## ${DIRECTORY}/extlinux.conf
198 ## The configuration of this file is generated automatically.
199 ## Do not edit this file manually, use: update-extlinux
202 default ${EXTLINUX_DEFAULT}
204 timeout ${EXTLINUX_TIMEOUT}
207 if [ -n "${EXTLINUX_THEME}" ]
209 if [ ! -e "/usr/share/syslinux/themes/${EXTLINUX_THEME}/extlinux" ]
211 echo "E: /usr/share/syslinux/${EXTLINUX_THEME}/extlinux: No such file or directory"
214 echo -n "P: Installing ${EXTLINUX_THEME} theme..."
215 rm -rf "${DIRECTORY}/themes/${EXTLINUX_THEME}"
217 mkdir
-p "${DIRECTORY}/themes"
218 cp -aL "/usr/share/syslinux/themes/${EXTLINUX_THEME}/extlinux" "${DIRECTORY}/themes/${EXTLINUX_THEME}"
222 cat >> "${DIRECTORY}/extlinux.conf" << EOF
224 include themes/${EXTLINUX_THEME}/theme.cfg
229 cat >> "${DIRECTORY}/extlinux.conf" << EOF
235 if [ ! -e "${DIRECTORY}/boot.txt" ]
237 echo "Wait 5 seconds or press ENTER to " > "${DIRECTORY}/boot.txt"