set -e not working in loops, manually trigger exit

This commit is contained in:
illiliti 2020-04-19 10:52:53 +03:00
parent 68a5cfe5ad
commit 67dc4e50dd

View File

@ -159,7 +159,7 @@ install_devmgr()
{ {
info "installing device manager" info "installing device manager"
install_devmgr_helper() install_device_helper()
{ {
for _binary in kill mkdir blkid "${filesdir}/device-helper"; do for _binary in kill mkdir blkid "${filesdir}/device-helper"; do
install_binary "$_binary" install_binary "$_binary"
@ -190,24 +190,24 @@ install_devmgr()
[ "$luks" = 1 ] || [ "$lvm" = 1 ] && install_binary dmsetup [ "$luks" = 1 ] || [ "$lvm" = 1 ] && install_binary dmsetup
for _binary in /usr/lib/udev/ata_id /usr/lib/udev/scsi_id; do for _binary in /usr/lib/udev/ata_id /usr/lib/udev/scsi_id; do
install -Dm755 "$_binary" "${workdir}${_binary}" install -Dm755 "$_binary" "${workdir}${_binary}" || return
done done
# TODO we really need all rules? # TODO we really need all rules?
set +f; for _file in /usr/lib/udev/rules.d/*; do set +f; for _file in /usr/lib/udev/rules.d/*; do
install -Dm644 "$_file" "${workdir}${_file}" install -Dm644 "$_file" "${workdir}${_file}" || return
done; set -f done; set -f
;; ;;
mdev) mdev)
install_binary mdev install_binary mdev
install_devmgr_helper install_device_helper
;; ;;
mdevd) mdevd)
for _binary in mdevd mdevd-coldplug; do for _binary in mdevd mdevd-coldplug; do
install_binary "$_binary" install_binary "$_binary"
done done
install_devmgr_helper install_device_helper
;; ;;
esac esac
} }
@ -270,11 +270,11 @@ install_luks()
for opt; do case "${opt%%=*}" in for opt; do case "${opt%%=*}" in
header) header)
install -m400 "${opt##*=}" "${workdir}/root/header" install -m400 "${opt##*=}" "${workdir}/root/header" || return
luks_opts=$(printf "%s" "$luks_opts" | sed "s|${opt##*=}|/root/header|") luks_opts=$(printf "%s" "$luks_opts" | sed "s|${opt##*=}|/root/header|")
;; ;;
key) key)
install -m400 "${opt##*=}" "${workdir}/root/key" install -m400 "${opt##*=}" "${workdir}/root/key" || return
luks_opts=$(printf "%s" "$luks_opts" | sed "s|${opt##*=}|/root/key|") luks_opts=$(printf "%s" "$luks_opts" | sed "s|${opt##*=}|/root/key|")
;; ;;
esac; done esac; done
@ -304,7 +304,7 @@ install_module()
# check if module already installed # check if module already installed
[ -e "$module" ] && [ ! -e "${workdir}${module}" ] && [ -e "$module" ] && [ ! -e "${workdir}${module}" ] &&
install -Dm644 "$module" "${workdir}${module}" install -Dm644 "$module" "${workdir}${module}" || return
done ||: done ||:
} }
@ -408,7 +408,7 @@ install_binary()
binary="${binary%/*}/${readlink_binary##*/}" binary="${binary%/*}/${readlink_binary##*/}"
done done
install -m755 "$binary" "${workdirbin}${binary##*/}" install -m755 "$binary" "${workdirbin}${binary##*/}" || return
strip "${workdirbin}${binary##*/}" > /dev/null 2>&1 ||: strip "${workdirbin}${binary##*/}" > /dev/null 2>&1 ||:
# check if binary statically linked # check if binary statically linked
@ -445,7 +445,7 @@ install_library()
library="${library%/*}/${readlink_library##*/}" library="${library%/*}/${readlink_library##*/}"
done done
install -m755 "$library" "${workdirlib}${library##*/}" install -m755 "$library" "${workdirlib}${library##*/}" || return
strip "${workdirlib}${library##*/}" > /dev/null 2>&1 ||: strip "${workdirlib}${library##*/}" > /dev/null 2>&1 ||:
} }