[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}"
for svc in ${start_openrc_live[@]}; do
msg2 "Setting %s ..." "$svc"
chroot $1 rc-update add $svc default &> /dev/null
chroot $1 rc-update add $svc default #&> /dev/null
done
info "Done configuring [%s]" "${initsys}"
;;
@ -95,7 +95,7 @@ configure_services_live(){
info "Configuring [%s] ...." "${initsys}"
for svc in ${start_systemd_live[@]}; do
msg2 "Setting %s ..." "$svc"
chroot $1 systemctl enable $svc &> /dev/null
chroot $1 systemctl enable $svc #&> /dev/null
done
info "Done configuring [%s]" "${initsys}"
;;
@ -121,7 +121,7 @@ configure_services(){
info "Configuring [%s] ...." "${initsys}"
for svc in ${start_openrc[@]}; do
msg2 "Setting %s ..." "$svc"
chroot $1 rc-update add $svc default &> /dev/null
chroot $1 rc-update add $svc default #&> /dev/null
done
info "Done configuring [%s]" "${initsys}"
;;
@ -129,7 +129,7 @@ configure_services(){
info "Configuring [%s] ...." "${initsys}"
for svc in ${start_systemd[@]}; do
msg2 "Setting %s ..." "$svc"
chroot $1 systemctl enable $svc &> /dev/null
chroot $1 systemctl enable $svc #&> /dev/null
done
sed -i 's/#\(HandleSuspendKey=\)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
local conf='DISPLAYMANAGER="'${displaymanager}'"'
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
local service=${displaymanager}
if [[ -f $1/etc/plymouth/plymouthd.conf && \
-f $1/usr/lib/systemd/system/${displaymanager}-plymouth.service ]]; then
service=${displaymanager}-plymouth
fi
chroot $1 systemctl enable ${service} &> /dev/null
chroot $1 systemctl enable ${service} #&> /dev/null
fi
fi
msg2 "Configured: ${displaymanager}"
@ -317,7 +317,7 @@ chroot_clean(){
msg2 "Deleting chroot %s ..." "$(basename "${image}")"
lock 9 "${image}.lock" "Locking chroot '${image}'"
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
rm -rf --one-file-system "${image}"
fi
@ -430,14 +430,14 @@ chroot_create(){
# $1: image path
clean_up_image(){
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.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/sync" -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/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/tmp" -mindepth 1 -delete &> /dev/null

View file

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

View file

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