From bb503b90308ea12542c85dea9b799e11632158a6 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Fri, 1 Jan 2021 03:15:33 +0100 Subject: add optional pv tool use pv to give feedback on copying the airootfs to RAM when copytoram kernel parameter is given --- archiso/initcpio/hooks/archiso | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'archiso/initcpio/hooks') diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 1b848ce..485fb0f 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -69,10 +69,23 @@ _mnt_sfs() { # defined via initcpio's parse_cmdline() if [ "${copytoram}" = "y" ]; then msg -n ":: Copying squashfs image to RAM..." - if ! cp -- "${img}" "/run/archiso/copytoram/${img_fullname}" ; then + + # in case we have pv use it to display copy progress feedback otherwise + # fallback to using plain cp + if [ -x /usr/bin/pv ]; then + echo "" + (pv "${img}" > "/run/archiso/copytoram/${img_fullname}") + local rc=$? + else + (cp -- "${img}" "/run/archiso/copytoram/${img_fullname}") + local rc=$? + fi + + if [ $rc != 0 ]; then echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'" launch_interactive_shell fi + img="/run/archiso/copytoram/${img_fullname}" msg "done." fi -- cgit v1.2.3-54-g00ecf