summaryrefslogtreecommitdiffstats
path: root/mkinitcpio
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2006-10-17 00:42:18 +0200
committerThomas Bächler <thomas@archlinux.org>2006-10-17 00:42:18 +0200
commitda24b3230234a6d73a7ea1d52422245522201d26 (patch)
tree8d91dad66a9184446fb9cafca381d26790707c34 /mkinitcpio
parent3ac39b71e7a0a6d04a34f5f52b0b11493fc9bd65 (diff)
downloadmkinitcpio-da24b3230234a6d73a7ea1d52422245522201d26.tar.gz
mkinitcpio-da24b3230234a6d73a7ea1d52422245522201d26.tar.xz
added initial preset support
git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@178 880c04e9-e011-0410-abf7-b926e227c9cd
Diffstat (limited to 'mkinitcpio')
-rw-r--r--mkinitcpio28
1 files changed, 27 insertions, 1 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 330faf2..5084c2b 100644
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -25,6 +25,8 @@ MODULE_FILE=""
SAVELIST=""
GENIMG=""
APPEND=""
+PRESET=""
+PRESETDIR="mkinitcpio.d"
QUIET="y"
SHOW_AUTOMODS="n"
@@ -39,6 +41,7 @@ usage ()
echo " -b BASEDIR Use BASEDIR. default: /"
echo " -g IMAGE Generate a cpio image as IMAGE. default: no"
echo " -a NAME Append to an existing filelist. default: no"
+ echo " -p PRESET Build specified preset."
echo " -v Verbose output. Default: no"
echo " -M Display modules found via autodetection."
echo " -L List all available hooks."
@@ -47,7 +50,7 @@ usage ()
exit 1
}
-while getopts ':c:k:s:b:g:a:vH:LMh' arg; do
+while getopts ':c:k:s:b:g:a:p:vH:LMh' arg; do
if [ "${OPTARG:0:1}" = "-" ]; then
echo "error: optional argument to '-$arg' begins with a '-'"
echo " you probably don't want this....aborting."
@@ -60,6 +63,7 @@ while getopts ':c:k:s:b:g:a:vH:LMh' arg; do
b) BASEDIR="$OPTARG" ;;
g) GENIMG="$OPTARG" ;;
a) APPEND="y"; SAVELIST="y"; FILELIST="$OPTARG" ;;
+ p) PRESET="$OPTARG" ;;
v) QUIET="n" ;;
H) source "${INSTDIR}/${OPTARG}";
echo "Help for hook '${OPTARG}':"
@@ -78,6 +82,28 @@ while getopts ':c:k:s:b:g:a:vH:LMh' arg; do
done
shift $(($OPTIND - 1))
+# use preset $PRESET
+if [ -n "${PRESET}" -a -f "${PRESETDIR}/${PRESET}.preset" ]; then
+ # Use -b and -v options specified earlier
+ PRESET_MKOPTS=""
+ [ -n "${BASEDIR}" ] && PRESET_MKOPTS="${PRESET_MKOPTS} -b ${BASEDIR}"
+ [ "${QUIET}" = "n" ] && PRESET_MKOPTS="${PRESET_MKOPTS} -v"
+ # Build all images
+ source ${PRESETDIR}/${PRESET}.preset
+ for ((i=0; i<${PRESET_N}; ++i)); do
+ [ -z "${PRESET_NAME[${i}]}" -o -z "${PRESET_KVER[${i}]}" -o -z "${PRESET_CONFIG[${i}]}" -o -z "${PRESET_IMAGE[${i}]}" ] && continue
+ echo "==> Building image \"${PRESET_NAME[${i}]}\""
+ PRESET_CMD="${0} -c ${PRESET_CONFIG[${i}]} -k ${PRESET_KVER[${i}]} -g ${PRESET_IMAGE[${i}]} ${PRESET_MKOPTS}"
+ echo "==> Running command: ${PRESET_CMD}"
+ if ${PRESET_CMD}; then
+ echo "==> SUCCESS"
+ else
+ echo "==> FAIL"
+ fi
+ done
+ exit 0
+fi
+
# append a trailing / if needed
if [ "${BASEDIR:${#BASEDIR}}" == "/" ]; then
BASEDIR="${BASEDIR:0:${#BASEDIR}-1}"