summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2008-03-15 22:31:36 +0100
committerThomas Bächler <thomas@archlinux.org>2008-03-15 22:31:36 +0100
commitdff86cf5af941ad1478e765641f8f05722b18ae3 (patch)
tree329172b35547b10fd18a5e4f743fd338e73fddf5
parent5ce327f59920366b4f43eec12becf484383643ca (diff)
downloadmkinitcpio-dff86cf5af941ad1478e765641f8f05722b18ae3.tar.gz
mkinitcpio-dff86cf5af941ad1478e765641f8f05722b18ae3.tar.xz
Make presets more powerful: a fallback image can be generated without a separate configuration file
-rwxr-xr-xmkinitcpio14
-rw-r--r--mkinitcpio.d/example.preset16
2 files changed, 22 insertions, 8 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 07fe7f7..1317ffd 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -119,29 +119,39 @@ if [ -n "${PRESET}" ]; then
for p in ${PRESETS[@]}; do
echo "==> Building image \"${p}\""
PRESET_CMD="${PRESET_MKOPTS}"
+
eval "PRESET_KVER=\"\${${p}_kver}\""
+ [ -z "${PRESET_KVER}" ] && PRESET_KVER="${ALL_kver}"
eval "PRESET_CONFIG=\"\${${p}_config}\""
+ [ -z "${PRESET_CONFIG}" ] && PRESET_CONFIG="${ALL_config}"
eval "PRESET_IMAGE=\"\${${p}_image}\""
+ eval "PRESET_OPTIONS=\"\${${p}_options}\""
+
if [ -n "${PRESET_KVER}" ]; then
PRESET_CMD="${PRESET_CMD} -k ${PRESET_KVER}"
- elif [ -n "${ALL_kver}" ]; then
- PRESET_CMD="${PRESET_CMD} -k ${ALL_kver}"
else
echo "==> No kernel version specified. Skipping image \"${p}\"."
continue
fi
+
if [ -n "${PRESET_CONFIG}" ]; then
PRESET_CMD="${PRESET_CMD} -c ${PRESET_CONFIG}"
else
echo "==> No configuration file specified. Skipping image \"${p}\"."
continue
fi
+
if [ -n "${PRESET_IMAGE}" ]; then
PRESET_CMD="${PRESET_CMD} -g ${PRESET_IMAGE}"
else
echo "==> No image file specified. Skipping image \"${p}\"."
continue
fi
+
+ if [ -n "${PRESET_OPTIONS}" ]; then
+ PRESET_CMD="${PRESET_CMD} ${PRESET_OPTIONS}"
+ fi
+
echo "==> Running command: ${PRESET_CMD}"
if eval ${PRESET_CMD}; then
echo "==> SUCCESS"
diff --git a/mkinitcpio.d/example.preset b/mkinitcpio.d/example.preset
index b283815..9ad53a3 100644
--- a/mkinitcpio.d/example.preset
+++ b/mkinitcpio.d/example.preset
@@ -7,16 +7,20 @@ PRESETS=('default' 'fallback')
# note for distribution kernels: this should be in a separate file
# and read like this:
# source /etc/mkinitcpio.d/exmaple.kver
-ALL_kver='2.6.18-ARCH'
+ALL_kver='2.6.24-ARCH'
+ALL_config='/etc/mkinitcpio.conf'
-# presetname_kver specifies the kernel version (omit if ALL_kver should be used)
-# presetname_config specifies the configuration file
-# presetname_image specifies the image to be generated
+# presetname_kver - the kernel version (omit if ALL_kver should be used)
+# presetname_config - the configuration file (omit if ALL_config should be used)
+# presetname_image - the filename of generated image
+# presetname_options - any extra options
#default_kver="2.6.18-ARCH"
-default_config="/etc/mkinitcpio.conf"
+#default_config="/etc/mkinitcpio.conf"
default_image="/tmp/kernel26.img"
+default_options=""
#fallback_kver="2.6.18-ARCH"
-fallback_config="/etc/mkinitcpio.d/mkinitcpio-kernel26-fallback.conf"
+#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/tmp/kernel26-fallback.img"
+fallback_options="-S autodetect"