diff options
Diffstat (limited to 'mkinitcpio')
-rw-r--r-- | mkinitcpio | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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}" |