3-xen-orchestra-install #4
26
setup.sh
26
setup.sh
@ -1,5 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Whatever comes in on file descriptor (FD) 3 gets redirected to where file
|
||||||
|
# descriptor 1 is pointing. File descriptor 1 points to stdout so when we
|
||||||
|
# output-redirect something into FD 3 it shows up on stdout. We can use this
|
||||||
|
# to produce arbitrary logging output inside a subshell like so:
|
||||||
|
#
|
||||||
|
# function my_func () {
|
||||||
|
# some_command "${1:?}"
|
||||||
|
# >&3 echo 'A log message'
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# var="$(my_func arg_1)"
|
||||||
|
#
|
||||||
|
# Here "${var}" will only capture the output of some_command "${1:?}". It
|
||||||
|
# will not capture 'echo' which will instead show up on our stdout/FD 1.
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
|
|
||||||
declare this_script_url
|
declare this_script_url
|
||||||
@ -250,7 +264,7 @@ function setup_zpool () {
|
|||||||
export_pool
|
export_pool
|
||||||
import_pool
|
import_pool
|
||||||
else
|
else
|
||||||
printf -- '%s\n' 'A zpool already exists, that is unexpected. Cowardly exiting 1 ...'
|
>&3 printf -- '%s\n' 'A zpool already exists, that is unexpected. Cowardly exiting 1 ...'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -299,7 +313,7 @@ function prepare_zfsbootmenu_efi_bin_pkg () {
|
|||||||
mount --bind '/mnt/efi' '/efi'
|
mount --bind '/mnt/efi' '/efi'
|
||||||
pushd "${git_zbm_efi_bin_dir}"
|
pushd "${git_zbm_efi_bin_dir}"
|
||||||
sudo -u 'arch' makepkg -s || {
|
sudo -u 'arch' makepkg -s || {
|
||||||
printf -- '%s\n' 'Failed building zfsbootmenu-efi-bin package. Exiting ...'
|
>&3 printf -- '%s\n' 'Failed building zfsbootmenu-efi-bin package. Exiting ...'
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
@ -310,7 +324,7 @@ function prepare_zfsbootmenu_efi_bin_pkg () {
|
|||||||
package_file="$(basename "${package_file_abs}")"
|
package_file="$(basename "${package_file_abs}")"
|
||||||
mkdir -p "${chroot_pacman_cache_dir}"
|
mkdir -p "${chroot_pacman_cache_dir}"
|
||||||
rsync -av "${package_file_abs}" "${chroot_pacman_cache_dir}"'/'"${package_file}" || {
|
rsync -av "${package_file_abs}" "${chroot_pacman_cache_dir}"'/'"${package_file}" || {
|
||||||
printf -- '%s\n' 'Failed rsyncing zfsbootmenu-efi-bin package file into chroot. Exiting ...'
|
>&3 printf -- '%s\n' 'Failed rsyncing zfsbootmenu-efi-bin package file into chroot. Exiting ...'
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
export ZFSBOOTMENU_EFI_BIN_PKG_PATH="${pacman_cache_dir}"'/'"${package_file}"
|
export ZFSBOOTMENU_EFI_BIN_PKG_PATH="${pacman_cache_dir}"'/'"${package_file}"
|
||||||
@ -539,7 +553,7 @@ function paru_install () {
|
|||||||
[[ "${1}" ]] && while :; do
|
[[ "${1}" ]] && while :; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-[[:alnum:]]*)
|
-[[:alnum:]]*)
|
||||||
printf -- '%s\n' \
|
>&3 printf -- '%s\n' \
|
||||||
'Short-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
'Short-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
||||||
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
||||||
exit 77
|
exit 77
|
||||||
@ -550,7 +564,7 @@ function paru_install () {
|
|||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
printf -- '%s\n' \
|
>&3 printf -- '%s\n' \
|
||||||
'Long-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
'Long-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
||||||
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
||||||
exit 77
|
exit 77
|
||||||
@ -565,7 +579,7 @@ function paru_install () {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done || {
|
done || {
|
||||||
printf -- '%s\n' \
|
>&3 printf -- '%s\n' \
|
||||||
'No argument '"'${1}'"' given for function '"'${FUNCNAME[0]}'"'. Exiting ...'
|
'No argument '"'${1}'"' given for function '"'${FUNCNAME[0]}'"'. Exiting ...'
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user