Allow multiple modes

pull/197/head
Jan Houben 7 years ago
parent 1436d71e34
commit 63cc61f992
No known key found for this signature in database
GPG Key ID: B7C6B271DEB42D74
  1. 57
      build.sh
  2. 28
      lib.sh
  3. 12
      push.sh
  4. 14
      repo.sh

@ -285,12 +285,12 @@ for (( a = 0; a < $#; a++ )); do
usage
else
check_mode "${args[$a]}"
debug "have mode '${mode}'"
debug "have modes '${modes[*]}'"
fi
done
if [[ ${#commands[@]} -eq 0 || ${mode} == "" ]]; then
if [[ ${#commands[@]} -eq 0 || ${#modes[@]} -eq 0 ]]; then
echo
error "A build mode and command must be selected!"
usage
@ -307,11 +307,37 @@ fi
msg "$(date) :: ${script_name} started..."
if have_command "update_sums"; then
# Only the files in the zfs-utils package will be updated
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.bash-completion-r1"
azsha1=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_bash_completion_hash.*/zfs_bash_completion_hash=\"${azsha1}\"/g' -i ${script_dir}/conf.sh"
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.initcpio.hook"
azsha2=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_initcpio_hook_hash.*/zfs_initcpio_hook_hash=\"${azsha2}\"/g' -i ${script_dir}/conf.sh"
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.initcpio.install"
azsha3=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_initcpio_install_hash.*/zfs_initcpio_install_hash=\"${azsha3}\"/g' -i ${script_dir}/conf.sh"
source_safe "${script_dir}/conf.sh"
fi
if have_command "update_chroot"; then
msg "Updating the x86_64 clean chroot..."
run_cmd "ccm64 u"
fi
for (( i = 0; i < ${#modes[@]}; i++ )); do
mode=${modes[i]}
kernel_name=${kernel_names[i]}
get_conflicts
get_kernel_update_funcs
debug_print_default_vars
export script_dir mode kernel_name
source_safe "src/kernels/${kernel_name}.sh"
@ -336,30 +362,6 @@ if have_command "reset_pkgs"; then
fi
if have_command "update_sums"; then
# Only the files in the zfs-utils package will be updated
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.bash-completion-r1"
azsha1=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_bash_completion_hash.*/zfs_bash_completion_hash=\"${azsha1}\"/g' -i ${script_dir}/conf.sh"
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.initcpio.hook"
azsha2=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_initcpio_hook_hash.*/zfs_initcpio_hook_hash=\"${azsha2}\"/g' -i ${script_dir}/conf.sh"
run_cmd_show_and_capture_output "sha256sum ${script_dir}/src/zfs-utils/zfs-utils.initcpio.install"
azsha3=$(echo ${run_cmd_output} | awk '{ print $1 }')
run_cmd_no_output "sed -e 's/^zfs_initcpio_install_hash.*/zfs_initcpio_install_hash=\"${azsha3}\"/g' -i ${script_dir}/conf.sh"
source_safe "${script_dir}/conf.sh"
fi
if have_command "update_chroot"; then
msg "Updating the x86_64 clean chroot..."
run_cmd "ccm64 u"
fi
for func in "${update_funcs[@]}"; do
debug "Evaluating '${func}'"
"${func}"
@ -375,3 +377,4 @@ for func in "${update_funcs[@]}"; do
build_sources
fi
done
done

@ -6,9 +6,9 @@ shopt -s nullglob
dry_run=0
debug_flag=0
haz_error=0
mode=""
modes=()
test_mode=""
kernel_name="" # set by generate_mode_list
kernel_names=() # set by generate_mode_list
mode_list=() # set by generate_mode_list
test_commands_list=() # set by generate_test_commands_list
update_funcs=() # set by generate_mode_list
@ -397,6 +397,13 @@ kernel_version_full_no_hyphen() {
# from makepkg
source_safe() {
# reset variables
kernel_version_full_pkgver=""
kernel_version_full=""
kernel_version=""
zfs_pkgver=""
spl_pkgver=""
export script_dir mode kernel_name
shopt -u extglob
if ! source "$@"; then
@ -554,18 +561,14 @@ check_zol_version() {
check_mode() {
# $1 the mode to check for
debug "check_mode: checking '$1'"
for m in "${mode_list[@]}"; do
debug "check_mode: on '${m}'"
local moden=$(echo ${m} | cut -f2 -d:)
# debug "moden: ${moden}"
if [[ "${moden}" == "$1" ]]; then
if [[ ${mode} != "" ]]; then
error "Already have mode '${moden}', only one mode can be used at a time!"
usage
exit 155
fi
mode="$1"
kernel_name=$(echo ${m} | cut -f1 -d:)
modes+=("$1")
kernel_names+=("$(echo ${m} | cut -f1 -d:)")
return
fi
done
@ -687,6 +690,8 @@ generate_test_commands_list() {
get_kernel_update_funcs() {
update_funcs=()
for kernel in $(ls ${script_dir}/src/kernels); do
if [[ ${kernel%.*} != ${kernel_name} ]]; then
continue
@ -697,6 +702,11 @@ get_kernel_update_funcs() {
}
get_conflicts() {
zfs_headers_conflicts_all=()
spl_headers_conflicts_all=()
zfs_conflicts_all=()
spl_conflicts_all=()
for kernel in $(ls ${script_dir}/src/kernels); do
# do not conflict with common or dkms packages
if [[ "$kernel" == "common.sh" || "$kernel" == "common-git.sh" || "$kernel" == "dkms.sh" ]]; then

@ -76,12 +76,12 @@ for (( a = 0; a < $#; a++ )); do
usage
else
check_mode "${args[$a]}"
debug "have mode '${mode}'"
debug "have modes '${modes[*]}'"
fi
done
if [[ ${mode} == "" && ${push_repo} -eq 0 ]]; then
if [[ ${#modes[@]} -eq 0 && ${push_repo} -eq 0 ]]; then
echo
error "A mode must be selected!"
usage
@ -128,15 +128,18 @@ push_repo() {
push_repo
if [[ ${mode} == "" ]]; then
if [[ ${#modes[@]} -eq 0 ]]; then
exit
fi
for (( i = 0; i < ${#modes[@]}; i++ )); do
mode=${modes[i]}
kernel_name=${kernel_names[i]}
get_kernel_update_funcs
debug_print_default_vars
export script_dir mode kernel_name
source_safe "src/kernels/${kernel_name}.sh"
@ -146,3 +149,4 @@ for func in "${update_funcs[@]}"; do
"${func}"
push_packages
done
done

@ -82,7 +82,7 @@ for (( a = 0; a < $#; a++ )); do
usage
else
check_mode "${args[$a]}"
debug "have mode '${mode}'"
debug "have modes '${modes[*]}'"
fi
done
@ -92,7 +92,7 @@ if [[ $# -lt 1 ]]; then
fi
if [[ ${mode} == "" ]]; then
if [[ ${#modes[@]} -eq 0 ]]; then
echo
error "A mode must be selected!"
usage
@ -349,12 +349,17 @@ else
fi
get_kernel_update_funcs
debug_print_default_vars
debug "repo_name: ${repo_name}"
debug "repo_target: ${repo_target}"
for (( i = 0; i < ${#modes[@]}; i++ )); do
mode=${modes[i]}
kernel_name=${kernel_names[i]}
get_kernel_update_funcs
debug_print_default_vars
export script_dir mode kernel_name
source_safe "src/kernels/${kernel_name}.sh"
@ -371,6 +376,7 @@ for func in ${update_funcs[@]}; do
sign_packages
repo_add
done
done
if [[ ${haz_error} -ne 0 ]]; then
warning "An error has been detected! Inspect output above closely..."

Loading…
Cancel
Save