From c3914f980fa2c59fa42bc17af73200cf5365bbf9 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 --- hooks/archiso | 15 ++++++++++++++- install/archiso | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hooks/archiso b/hooks/archiso index 1b848ce..485fb0f 100644 --- a/hooks/archiso +++ b/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 diff --git a/install/archiso b/install/archiso index 74948c7..df0f6b5 100644 --- a/install/archiso +++ b/install/archiso @@ -18,6 +18,7 @@ build() { add_binary truncate add_binary gpg add_binary grep + add_binary pv add_file /usr/lib/udev/rules.d/60-cdrom_id.rules add_file /usr/lib/udev/rules.d/10-dm.rules -- cgit v1.2.3-54-g00ecf From 22b57518a6e16ff85224f3aa6601e6b70831e534 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Tue, 5 Jan 2021 13:04:39 +0000 Subject: Apply 1 suggestion(s) to 1 file(s) --- hooks/archiso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/archiso b/hooks/archiso index 485fb0f..d897ae1 100644 --- a/hooks/archiso +++ b/hooks/archiso @@ -72,7 +72,7 @@ _mnt_sfs() { # in case we have pv use it to display copy progress feedback otherwise # fallback to using plain cp - if [ -x /usr/bin/pv ]; then + if command -v pv > /dev/null 2>&1; then echo "" (pv "${img}" > "/run/archiso/copytoram/${img_fullname}") local rc=$? -- cgit v1.2.3-54-g00ecf From c42ce636434ae82de904a5505863547770978635 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Mon, 5 Apr 2021 23:41:18 +0200 Subject: Update README.bootparams Explain the purpose of optionally adding the "pv" program to the package list. --- docs/README.bootparams | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/README.bootparams b/docs/README.bootparams index bcafc0e..da1fcda 100644 --- a/docs/README.bootparams +++ b/docs/README.bootparams @@ -24,7 +24,9 @@ INDEX * archisobasedir= Set the base directory where all files reside. Default: "arch" * copytoram= If set to "y" or just "copytoram" without arguments, - all SquashFS are copied to "RAM". + all SquashFS are copied to "RAM". If you add the package + "pv" to the packages.x86_64 it is used to display the copy + progress. Default: (unset) * checksum= If set to "y" or just "checksum" without arguments, performs a self-test of all files inside ${install_dir}, -- cgit v1.2.3-54-g00ecf From 756c9dbeb6d693158587ae6e0116156ef5aa1af6 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Tue, 6 Apr 2021 00:56:16 +0200 Subject: Fence add_binary for pv --- install/archiso | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install/archiso b/install/archiso index df0f6b5..c64e10e 100644 --- a/install/archiso +++ b/install/archiso @@ -18,7 +18,12 @@ build() { add_binary truncate add_binary gpg add_binary grep - add_binary pv + + if command -v pv > /dev/null 2>&1; then + add_binary pv + else + warning 'pv not found; falling back to cp for copy to RAM' + fi add_file /usr/lib/udev/rules.d/60-cdrom_id.rules add_file /usr/lib/udev/rules.d/10-dm.rules -- cgit v1.2.3-54-g00ecf