[arch-projects] [mkinitcpio][PATCH 1/4] move manpage to section 8
This is an admin command, not a config file. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- Makefile | 14 +++++++------- mkinitcpio.5.txt => mkinitcpio.8.txt | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename mkinitcpio.5.txt => mkinitcpio.8.txt (100%) diff --git a/Makefile b/Makefile index 1a3a815..6ddf2cb 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ DIRS = \ /lib/initcpio/hooks \ /lib/initcpio/install \ /lib/initcpio/udev \ - /usr/share/man/man5 + /usr/share/man/man8 DIST_EXTRA = \ - mkinitcpio.5 + mkinitcpio.8 all: doc @@ -43,20 +43,20 @@ install: all install -m644 -t ${DESTDIR}/lib/initcpio/install install/* install -m644 -t ${DESTDIR}/etc/mkinitcpio.d mkinitcpio.d/* - install -m644 mkinitcpio.5 ${DESTDIR}/usr/share/man/man5/mkinitcpio.5 + install -m644 mkinitcpio.8 ${DESTDIR}/usr/share/man/man8/mkinitcpio.8 install -m644 bash-completion ${DESTDIR}/etc/bash_completion.d/mkinitcpio -doc: mkinitcpio.5 -mkinitcpio.5: mkinitcpio.5.txt Makefile +doc: mkinitcpio.8 +mkinitcpio.8: mkinitcpio.8.txt Makefile a2x -d manpage \ -f manpage \ -a mansource=mkinitcpio \ -a manversion=${VERSION} \ - -a manmanual=mkinitcpio mkinitcpio.5.txt + -a manmanual=mkinitcpio mkinitcpio.8.txt clean: ${RM} -r build mkinitcpio-${VERSION} - ${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.5 mkinitcpio.5.gz + ${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.8 mkinitcpio.8.gz tarball: dist dist: clean doc diff --git a/mkinitcpio.5.txt b/mkinitcpio.8.txt similarity index 100% rename from mkinitcpio.5.txt rename to mkinitcpio.8.txt -- 1.7.7
cc36db45 was a bit too strict about localizing variables and blew out TMPDIR, which might be a legit variable sourced from the calling environment. Restore this behavior with a bit of refactoring, and additionally add in a check to make sure the temporary directory is writeable before proceeding. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/autodetect | 2 +- mkinitcpio | 23 +++++++++++++---------- mkinitcpio.8.txt | 3 ++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/install/autodetect b/install/autodetect index 4001977..35f1cb2 100644 --- a/install/autodetect +++ b/install/autodetect @@ -1,7 +1,7 @@ #!/bin/bash build() { - MODULE_FILE=$TMPDIR/autodetect_modules + MODULE_FILE=$workdir/autodetect_modules if [[ ! -d /sys/devices ]]; then error "/sys does not appear to be mounted. Unable to use autodetection" diff --git a/mkinitcpio b/mkinitcpio index d0ae08c..db62d92 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -21,7 +21,7 @@ INSTDIR=install PRESETDIR=mkinitcpio.d COMPRESSION=gzip -declare TMPDIR= BASEDIR= MODULE_FILE= GENIMG= PRESET= COMPRESSION_OPTIONS= BUILDROOT= +declare BASEDIR= MODULE_FILE= GENIMG= PRESET= COMPRESSION_OPTIONS= BUILDROOT= declare NC= BOLD= BLUE= GREEN= RED= YELLOW= declare -i QUIET=1 SHOW_AUTOMODS=0 SAVELIST=0 COLOR=1 declare -a SKIPHOOKS ADDED_MODULES MODPATHS @@ -52,7 +52,7 @@ usage: ${0##*/} [options] -p PRESET Build specified preset from /etc/mkinitcpio.d -S SKIPHOOKS Skip SKIPHOOKS (comma-separated) when building the image. -s Save build directory. default: no - -t TMPDIR Use TMPDIR as the temporary build directory. + -t DIR Use DIR as the temporary build directory. -v Verbose output. Default: no. -z COMPRESS Use COMPRESS on resulting image @@ -61,12 +61,12 @@ EOF } cleanup() { - if [[ $TMPDIR ]]; then + if [[ $workdir ]]; then # when PRESET is set, we're in the main loop, not a worker process if (( SAVELIST )) && [[ -z $PRESET ]]; then - msg "build directory saved in %s" "$TMPDIR" + msg "build directory saved in %s" "$workdir" else - rm -rf "$TMPDIR" + rm -rf "$workdir" fi fi @@ -182,15 +182,18 @@ fi if [[ $TMPDIR ]]; then if [[ ! -d $TMPDIR ]]; then error "Temporary directory does not exist or is not a directory: \`%s'" "$TMPDIR" - unset TMPDIR + cleanup 1 + fi + if [[ ! -w $TMPDIR ]]; then + error "Temporary directory is not writeable: \`%s'" "$TMPDIR" cleanup 1 fi fi -TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/mkinitcpio.XXXXXX") -declare BUILDROOT=$TMPDIR/root +workdir=$(TMPDIR=$TMPDIR mktemp -d --tmpdir mkinitcpio.XXXXXX) +BUILDROOT=$workdir/root # explicitly create the buildroot -mkdir "$TMPDIR/root" +mkdir "$BUILDROOT" # use preset $PRESET if [[ $PRESET ]]; then @@ -335,7 +338,7 @@ if (( ${#ADDED_MODULES[*]} )); then popd >/dev/null msg "Generating module dependencies" - /sbin/depmod -b "${TMPDIR}/root" "${KERNELVERSION}" + /sbin/depmod -b "$BUILDROOT" "${KERNELVERSION}" rm "$BUILDROOT/lib/modules/$KERNELVERSION"/modules.!(dep.bin|alias.bin|symbols.bin) fi diff --git a/mkinitcpio.8.txt b/mkinitcpio.8.txt index f963dac..79c4bb4 100644 --- a/mkinitcpio.8.txt +++ b/mkinitcpio.8.txt @@ -72,7 +72,8 @@ Options *-t* 'tmpdir':: Use 'tmpdir' as the temporary build directory instead of /tmp. 'tmpdir' - must exist. + must exist. The 'TMPDIR' environment variable is also honored to set this + location, but the command line option will take precedence. *-v*:: Verbose output. Outputs more information about what's happening during -- 1.7.7
- Always call this function. At worst, just return the current kver. - Do all our error reporting from within the function. - Add an additional check for existance prior to allow for a more appropriate error message when we encounter a situation such as /boot not being mounted. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index db62d92..8d3a67f 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -13,7 +13,6 @@ shopt -s extglob # Settings -KERNELVERSION=$(uname -r) FUNCTIONS=functions CONFIG=mkinitcpio.conf HOOKDIR=hooks @@ -45,7 +44,7 @@ usage: ${0##*/} [options] -g IMAGE Generate a cpio image as IMAGE. default: no -H HOOKNAME Output help for hook 'HOOKNAME'. -h Display this message. - -k KERNELVERSION Use KERNELVERSION. default: $KERNELVERSION + -k KERNELVERSION Use KERNELVERSION. default: $(uname -r) -L List all available hooks. -M Display modules found via autodetection. -n Disable colorized output messages. @@ -76,19 +75,30 @@ cleanup() { get_kernver() { local kernver= kernel=$1 - if [[ "${kernel:0:1}" != / ]]; then - echo $kernel + if [[ -z $kernel ]]; then + uname -r return 0 fi - [[ -r "$BASEDIR$kernel" ]] || return 1 + if [[ ${kernel:0:1} != / ]]; then + echo "$kernel" + return 0 + fi + + if [[ ! -e $BASEDIR$kernel ]]; then + error "Specified kernel image does not exist: \`%s'" "$BASEDIR$kernel" + return 1 + fi read _ kernver < <(file -b "$BASEDIR$kernel" | grep -o 'version [^ ]\+') - if [[ "$kernver" && -e "$BASEDIR/lib/modules/$kernver" ]]; then + if [[ $kernver && -e $BASEDIR/lib/modules/$kernver ]]; then echo "$kernver" return 0 fi + [[ ${optkver:0:1} == / ]] && optkver=$BASEDIR$optkver + error "invalid kernel specifier: \`%s'" "$optkver" + return 1 } @@ -172,12 +182,7 @@ if [[ $BASEDIR ]]; then popd &>/dev/null fi -if [[ $optkver ]]; then - if ! KERNELVERSION=$(get_kernver "$optkver"); then - [[ ${optkver:0:1} == / ]] && optkver=$BASEDIR$optkver - die "invalid kernel specifier: \`%s'" "$optkver" - fi -fi +KERNELVERSION=$(get_kernver "$optkver") || cleanup 1 if [[ $TMPDIR ]]; then if [[ ! -d $TMPDIR ]]; then -- 1.7.7
Fixes FS#26427. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/pcmcia | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/install/pcmcia b/install/pcmcia index 2e9ac9a..f51ed6e 100644 --- a/install/pcmcia +++ b/install/pcmcia @@ -4,7 +4,7 @@ build() { FILES="/etc/pcmcia/config.opts" MODULES=" $(checked_modules '/drivers/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')" - [[ $MODULES ]] MODULES+=" sd_mod?" + [[ $MODULES ]] && MODULES+=" sd_mod?" add_binary "/lib/udev/pcmcia-socket-startup" add_binary "/lib/udev/pcmcia-check-broken-cis" -- 1.7.7
participants (1)
-
Dave Reisner