imperador / chromefy

Project Croissant: Install Chrome OS on any Computer - Transforming Chromium to Chrome
GNU General Public License v3.0
880 stars 80 forks source link

silence cp #117

Closed nihil-2019 closed 4 years ago

nihil-2019 commented 4 years ago

Currently, the croissant script runs cp with -v on every invocation, causing every single file on the Chrome OS root to be printed. This is an issue because the script is so verbose that even with a huge scrollback everything in a terminal will be pushed away, including the first lines of output of the script. In addition, it's pointless anyway as cp will still display errors in silent mode.

alesimula commented 4 years ago

I know, but it is also an indicator of progress, especially so when using the script with an image, and maybe that image is also located in a slow HDD, it will take a lot of time and an empty prompt without feedback for too long may bring the user to abort

nihil-2019 commented 4 years ago

That is a good idea, but by the same logic, if cp takes a while to copy one file from/to slow storage (or linux starts to sync on a machine with big cache set w/ sysctl & a decent amount of RAM, which causes the same effect even on fast HDDs) it will also give the effect of "freezing", albeit with output, & the user may do the same thing. Even if the script had a Windows-style overall progress bar (using rsync or pv), the progress bar itself could still appear to "freeze" & also cause the user to do the same thing.

Maybe a good solution would be to printf something like Warning: do NOT abort this script, let it finish running!\n before cp starts?

alesimula commented 4 years ago

The only part where a verbose cp would seem kind of stuck is when copying the Android system image (as it is relatively big compared to the rest), but it would otherwise seem to be progressing

Maybe i can add an rsync call instead if it is installed, but since there's no guarantee to it I can't just replace it, and I still want to fallback the ol' reliable cp -av in this case

rsync --info=progress2 -ah SOURCE DEST seems to work pretty well though

alesimula commented 4 years ago

@nihil-2019 I made a commit with the rsync changes, what do you think?