3-xen-orchestra-install #4
26
setup.sh
26
setup.sh
@ -1,5 +1,19 @@
|
||||
#!/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
|
||||
|
||||
declare this_script_url
|
||||
@ -250,7 +264,7 @@ function setup_zpool () {
|
||||
export_pool
|
||||
import_pool
|
||||
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
|
||||
fi
|
||||
}
|
||||
@ -299,7 +313,7 @@ function prepare_zfsbootmenu_efi_bin_pkg () {
|
||||
mount --bind '/mnt/efi' '/efi'
|
||||
pushd "${git_zbm_efi_bin_dir}"
|
||||
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
|
||||
}
|
||||
popd
|
||||
@ -310,7 +324,7 @@ function prepare_zfsbootmenu_efi_bin_pkg () {
|
||||
package_file="$(basename "${package_file_abs}")"
|
||||
mkdir -p "${chroot_pacman_cache_dir}"
|
||||
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
|
||||
}
|
||||
export ZFSBOOTMENU_EFI_BIN_PKG_PATH="${pacman_cache_dir}"'/'"${package_file}"
|
||||
@ -539,7 +553,7 @@ function paru_install () {
|
||||
[[ "${1}" ]] && while :; do
|
||||
case "${1}" in
|
||||
-[[:alnum:]]*)
|
||||
printf -- '%s\n' \
|
||||
>&3 printf -- '%s\n' \
|
||||
'Short-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
||||
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
||||
exit 77
|
||||
@ -550,7 +564,7 @@ function paru_install () {
|
||||
continue
|
||||
;;
|
||||
--*)
|
||||
printf -- '%s\n' \
|
||||
>&3 printf -- '%s\n' \
|
||||
'Long-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
|
||||
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
|
||||
exit 77
|
||||
@ -565,7 +579,7 @@ function paru_install () {
|
||||
;;
|
||||
esac
|
||||
done || {
|
||||
printf -- '%s\n' \
|
||||
>&3 printf -- '%s\n' \
|
||||
'No argument '"'${1}'"' given for function '"'${FUNCNAME[0]}'"'. Exiting ...'
|
||||
exit 77
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user