Add --jobs and --no-clean options to installation scripts
This commit is contained in:
parent
19c759be72
commit
a430f27040
@ -19,20 +19,30 @@ fi
|
|||||||
|
|
||||||
# support for NoPrompt allows non-interactive use of this script
|
# support for NoPrompt allows non-interactive use of this script
|
||||||
no_prompt=0
|
no_prompt=0
|
||||||
|
no_clean=0
|
||||||
|
make_opts=()
|
||||||
|
make_build_opts=()
|
||||||
|
|
||||||
# get the options
|
# get the options
|
||||||
for ((;$#;)) do
|
for ((;$#;)) do
|
||||||
case $1 in
|
case $1 in
|
||||||
NoPrompt)
|
-y|--no-prompt|NoPrompt)
|
||||||
no_prompt=1 ;;
|
no_prompt=1 ;;
|
||||||
|
-d|--dirty|--no-clean|NoClean)
|
||||||
|
no_clean=1 ;;
|
||||||
|
-j[0-9]*|--jobs|--jobs=*)
|
||||||
|
make_build_opts+=( "$1" ) ;;
|
||||||
|
-j)
|
||||||
|
make_build_opts+=( "${@:1:2}" ) ; shift ;; # include second arg if present
|
||||||
-h|--help|*)
|
-h|--help|*)
|
||||||
cat <<- EndOfHelp
|
cat <<- EndOfHelp
|
||||||
Usage: $0 [NoPrompt]
|
Usage: $0 [--no-prompt|-y] [--no-clean|-d] [--jobs[=N]|-jN]
|
||||||
$0 --help
|
$0 --help|-h
|
||||||
NoPrompt - noninteractive mode
|
--no-prompt non-interactive mode
|
||||||
-h|--help - Show help
|
--no-clean use existing built objects
|
||||||
|
--help show this message
|
||||||
EndOfHelp
|
EndOfHelp
|
||||||
[[ $1 = -h || $1 = --help ]] # don't use non-zero exit status when help requested
|
[[ $1 = -h || $1 = --help ]] # use zero exit status when help requested
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -57,9 +67,10 @@ printf 'Starting installation...\n'
|
|||||||
printf 'Copying options and blacklist files into /etc/modprobe.d\n'
|
printf 'Copying options and blacklist files into /etc/modprobe.d\n'
|
||||||
cp -fv "$options_file" "$blacklist_file" /etc/modprobe.d
|
cp -fv "$options_file" "$blacklist_file" /etc/modprobe.d
|
||||||
|
|
||||||
make clean
|
(( no_clean )) ||
|
||||||
|
make "${make_opts[@]}" clean
|
||||||
|
|
||||||
make || {
|
make "${make_opts[@]}" "${make_build_opts[@]}" || {
|
||||||
status=$?
|
status=$?
|
||||||
printf 'An error occurred. Error = %d\n' "$status"
|
printf 'An error occurred. Error = %d\n' "$status"
|
||||||
printf 'Please report this error.\n'
|
printf 'Please report this error.\n'
|
||||||
@ -69,7 +80,7 @@ make || {
|
|||||||
exit "$status"
|
exit "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
make install || {
|
make "${make_opts[@]}" install || {
|
||||||
status=$?
|
status=$?
|
||||||
printf 'An error occurred. Error = %d\n' "$status"
|
printf 'An error occurred. Error = %d\n' "$status"
|
||||||
printf 'Please report this error.\n'
|
printf 'Please report this error.\n'
|
||||||
|
|||||||
@ -14,24 +14,28 @@ drv_version=5.13.1
|
|||||||
|
|
||||||
drv_dir=$PWD
|
drv_dir=$PWD
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
# support for NoPrompt allows non-interactive use of this script
|
# support for NoPrompt allows non-interactive use of this script
|
||||||
no_prompt=0
|
no_prompt=0
|
||||||
|
no_clean=0
|
||||||
|
|
||||||
# get the options
|
# get the options
|
||||||
for ((;$#;)) do
|
for ((;$#;)) do
|
||||||
case $1 in
|
case $1 in
|
||||||
NoPrompt)
|
-y|--no-prompt|NoPrompt)
|
||||||
no_prompt=1 ;;
|
no_prompt=1 ;;
|
||||||
*h|*help|*)
|
-d|--dirty|--no-clean|NoClean)
|
||||||
|
no_clean=1 ;;
|
||||||
|
-j*)
|
||||||
|
printf '(dkms build ignores "%s" option)\n' "$1" ;;
|
||||||
|
-h|--help|*)
|
||||||
cat <<- EndOfHelp
|
cat <<- EndOfHelp
|
||||||
Usage: $0 [NoPrompt]
|
Usage: $0 [--no-prompt|-y] [--no-clean|-d]
|
||||||
$0 --help
|
$0 --help|-h
|
||||||
NoPrompt - noninteractive mode
|
--no-prompt non-interactive mode
|
||||||
-h|--help - Show help
|
--no-clean use existing built objects
|
||||||
|
--help show this message
|
||||||
EndOfHelp
|
EndOfHelp
|
||||||
[[ $1 = -h || $1 = --help ]] # don't use non-zero exit status when help requested
|
[[ $1 = -h || $1 = --help ]] # use zero exit status when help requested
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -57,6 +61,8 @@ fi
|
|||||||
|
|
||||||
# information that helps with bug reports
|
# information that helps with bug reports
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
# displays script name and version
|
# displays script name and version
|
||||||
printf 'Running %s version %s\n' "${0##*/}" "$SCRIPT_VERSION"
|
printf 'Running %s version %s\n' "${0##*/}" "$SCRIPT_VERSION"
|
||||||
|
|
||||||
@ -72,6 +78,9 @@ printf 'Starting installation...\n'
|
|||||||
printf 'Copying source files to: %s\n' "/usr/src/$drv_name-$drv_version"
|
printf 'Copying source files to: %s\n' "/usr/src/$drv_name-$drv_version"
|
||||||
cp -rf "$drv_dir" "/usr/src/$drv_name-$drv_version"
|
cp -rf "$drv_dir" "/usr/src/$drv_name-$drv_version"
|
||||||
|
|
||||||
|
(( no_clean )) ||
|
||||||
|
find "/usr/src/$drv_name-$drv_version" '(' -name '*.o' -o -name '*.ko' -o -name '*.o.cmd' ')' -delete
|
||||||
|
|
||||||
# sets module parameters (driver options)
|
# sets module parameters (driver options)
|
||||||
# blacklist the in-kernel module (driver) so that there is no conflict
|
# blacklist the in-kernel module (driver) so that there is no conflict
|
||||||
printf 'Copying options and blacklist files into: %s\n' "/etc/modprobe.d"
|
printf 'Copying options and blacklist files into: %s\n' "/etc/modprobe.d"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user