[util-iso-image] don't suppress output;

try to partially address #189
This commit is contained in:
udeved 2016-02-23 22:00:59 +01:00
parent 3109d6bfb6
commit 8fae9629ca
3 changed files with 29 additions and 27 deletions

View file

@ -87,7 +87,7 @@ configure_services_live(){
info "Configuring [%s] ...." "${initsys}" info "Configuring [%s] ...." "${initsys}"
for svc in ${start_openrc_live[@]}; do for svc in ${start_openrc_live[@]}; do
msg2 "Setting %s ..." "$svc" msg2 "Setting %s ..." "$svc"
chroot $1 rc-update add $svc default &> /dev/null chroot $1 rc-update add $svc default #&> /dev/null
done done
info "Done configuring [%s]" "${initsys}" info "Done configuring [%s]" "${initsys}"
;; ;;
@ -95,7 +95,7 @@ configure_services_live(){
info "Configuring [%s] ...." "${initsys}" info "Configuring [%s] ...." "${initsys}"
for svc in ${start_systemd_live[@]}; do for svc in ${start_systemd_live[@]}; do
msg2 "Setting %s ..." "$svc" msg2 "Setting %s ..." "$svc"
chroot $1 systemctl enable $svc &> /dev/null chroot $1 systemctl enable $svc #&> /dev/null
done done
info "Done configuring [%s]" "${initsys}" info "Done configuring [%s]" "${initsys}"
;; ;;
@ -121,7 +121,7 @@ configure_services(){
info "Configuring [%s] ...." "${initsys}" info "Configuring [%s] ...." "${initsys}"
for svc in ${start_openrc[@]}; do for svc in ${start_openrc[@]}; do
msg2 "Setting %s ..." "$svc" msg2 "Setting %s ..." "$svc"
chroot $1 rc-update add $svc default &> /dev/null chroot $1 rc-update add $svc default #&> /dev/null
done done
info "Done configuring [%s]" "${initsys}" info "Done configuring [%s]" "${initsys}"
;; ;;
@ -129,7 +129,7 @@ configure_services(){
info "Configuring [%s] ...." "${initsys}" info "Configuring [%s] ...." "${initsys}"
for svc in ${start_systemd[@]}; do for svc in ${start_systemd[@]}; do
msg2 "Setting %s ..." "$svc" msg2 "Setting %s ..." "$svc"
chroot $1 systemctl enable $svc &> /dev/null chroot $1 systemctl enable $svc #&> /dev/null
done done
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' $1/etc/systemd/logind.conf sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' $1/etc/systemd/logind.conf
@ -262,14 +262,14 @@ configure_displaymanager(){
if [[ ${initsys} == 'openrc' ]];then if [[ ${initsys} == 'openrc' ]];then
local conf='DISPLAYMANAGER="'${displaymanager}'"' local conf='DISPLAYMANAGER="'${displaymanager}'"'
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
chroot $1 rc-update add xdm default &> /dev/null chroot $1 rc-update add xdm default #&> /dev/null
else else
local service=${displaymanager} local service=${displaymanager}
if [[ -f $1/etc/plymouth/plymouthd.conf && \ if [[ -f $1/etc/plymouth/plymouthd.conf && \
-f $1/usr/lib/systemd/system/${displaymanager}-plymouth.service ]]; then -f $1/usr/lib/systemd/system/${displaymanager}-plymouth.service ]]; then
service=${displaymanager}-plymouth service=${displaymanager}-plymouth
fi fi
chroot $1 systemctl enable ${service} &> /dev/null chroot $1 systemctl enable ${service} #&> /dev/null
fi fi
fi fi
msg2 "Configured: ${displaymanager}" msg2 "Configured: ${displaymanager}"
@ -317,7 +317,7 @@ chroot_clean(){
msg2 "Deleting chroot %s ..." "$(basename "${image}")" msg2 "Deleting chroot %s ..." "$(basename "${image}")"
lock 9 "${image}.lock" "Locking chroot '${image}'" lock 9 "${image}.lock" "Locking chroot '${image}'"
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${image}"; } &> /dev/null { type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
fi fi
rm -rf --one-file-system "${image}" rm -rf --one-file-system "${image}"
fi fi
@ -430,14 +430,14 @@ chroot_create(){
# $1: image path # $1: image path
clean_up_image(){ clean_up_image(){
msg2 "Cleaning up [%s]" "${1##*/}" msg2 "Cleaning up [%s]" "${1##*/}"
[[ -d "$1/boot/" ]] && find "$1/boot" -name 'initramfs*.img' -delete &> /dev/null [[ -d "$1/boot/" ]] && find "$1/boot" -name 'initramfs*.img' -delete #&> /dev/null
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen" [[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf" [[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete &> /dev/null find "$1/var/lib/pacman" -maxdepth 1 -type f -delete #&> /dev/null
find "$1/var/lib/pacman/sync" -type f -delete &> /dev/null find "$1/var/lib/pacman/sync" -type f -delete #&> /dev/null
#find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null #find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null
find "$1/var/log" -type f -delete &> /dev/null find "$1/var/log" -type f -delete #&> /dev/null
#find "$1/var/tmp" -mindepth 1 -delete &> /dev/null #find "$1/var/tmp" -mindepth 1 -delete &> /dev/null
#find "$1/tmp" -mindepth 1 -delete &> /dev/null #find "$1/tmp" -mindepth 1 -delete &> /dev/null

View file

@ -16,6 +16,7 @@ error_function() {
# first exit all subshells, then print the error # first exit all subshells, then print the error
if (( ! BASH_SUBSHELL )); then if (( ! BASH_SUBSHELL )); then
error "A failure occurred in %s()." "$1" error "A failure occurred in %s()." "$1"
umount_image "$1"
plain "Aborting..." plain "Aborting..."
fi fi
exit 2 exit 2
@ -23,28 +24,29 @@ error_function() {
# $1: function # $1: function
run_log(){ run_log(){
local func="$1"
if ${is_log};then if ${is_log};then
local logfile=${iso_dir}/$(gen_iso_fn).$1.log shellopts=$(shopt -p) local logfile=${iso_dir}/$(gen_iso_fn).$func.log shellopts=$(shopt -p)
logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX") logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX")
mkfifo "$logpipe" mkfifo "$logpipe"
tee "$logfile" < "$logpipe" & tee "$logfile" < "$logpipe" &
local teepid=$! local teepid=$!
$1 &> "$logpipe" $func &> "$logpipe"
wait $teepid wait $teepid
rm "$logpipe" rm "$logpipe"
eval "$shellopts" eval "$shellopts"
else else
$1 "$func"
fi fi
} }
run_safe() { run_safe() {
local restoretrap local restoretrap func="$1"
set -e set -e
set -E set -E
restoretrap=$(trap -p ERR) restoretrap=$(trap -p ERR)
trap 'error_function $1' ERR trap 'error_function $func' ERR
run_log "$1" run_log "$func"
eval $restoretrap eval $restoretrap
set +E set +E
set +e set +e

View file

@ -607,26 +607,26 @@ compress_images(){
build_images(){ build_images(){
local timer=$(get_timer) local timer=$(get_timer)
load_pkgs "${profile_dir}/Packages-Root" load_pkgs "${profile_dir}/Packages-Root"
run_safe make_image_root run_safe "make_image_root"
if [[ -f "${packages_custom}" ]] ; then if [[ -f "${packages_custom}" ]] ; then
load_pkgs "${packages_custom}" load_pkgs "${packages_custom}"
run_safe make_image_custom run_safe "make_image_custom"
fi fi
if [[ -f ${profile_dir}/Packages-Live ]]; then if [[ -f ${profile_dir}/Packages-Live ]]; then
load_pkgs "${profile_dir}/Packages-Live" load_pkgs "${profile_dir}/Packages-Live"
run_safe make_image_live run_safe "make_image_live"
fi fi
if [[ -f ${packages_mhwd} ]] ; then if [[ -f ${packages_mhwd} ]] ; then
load_pkgs "${profile_dir}/Packages-Mhwd" load_pkgs "${packages_mhwd}"
run_safe make_image_mhwd run_safe "make_image_mhwd"
fi fi
run_safe make_image_boot run_safe "make_image_boot"
if [[ "${arch}" == "x86_64" ]]; then if [[ "${arch}" == "x86_64" ]]; then
run_safe make_efi run_safe "make_efi"
run_safe make_efiboot run_safe "make_efiboot"
fi fi
run_safe make_isolinux run_safe "make_isolinux"
run_safe make_isomounts run_safe "make_isomounts"
show_elapsed_time "${FUNCNAME}" "${timer_start}" show_elapsed_time "${FUNCNAME}" "${timer_start}"
} }