Re: Some ideas for improvements
From: Duncan <hidden>
Date: 2016-05-25 22:05:58
Nicholas D Steeves posted on Wed, 25 May 2016 16:36:13 -0400 as excerpted:
On 25 May 2016 at 15:03, Duncan [off-list ref] wrote:quoted
Dmitry Katsubo posted on Wed, 25 May 2016 16:45:41 +0200 as excerpted:
quoted
quoted
btrfs-restore [needs an o]ption that applies (y) to all questions (completely unattended recovery)That['s] a known sore spot that a lot of people have complained about.
I'm surprised no one has mentioned, in any of these discussions, what I believe is the standard method of providing this functionality: yes | btrfs-restore -options /dev/disk
Good point. I didn't bring it up because while I've used btrfs restore a few times, my btrfs are all on relatively small SSD partitions, so I both needed less y's, and the total time per restore is a few minutes, not hours, so it wasn't a big deal. As a result, while I know of yes, I didn't need to think about automation, and as I never used it, it didn't occur to me to suggest it for others. Had I needed to use it, however, I expect I would have reached for yes, myself, so good point indeed, pointing out its use to others. I just wish I'd thought of mentioning it, now. =:^)
And if you need it in your initrd on a Debian-like system, put the
following in /etc/initramfs-tools/hooks/yes.hook :
#!/bin/sh
. /usr/share/initramfs-tools/hook-functions
if command -v /usr/bin/yes >/dev/null 2>&1; then
copy_exec /usr/bin/yes usr/bin/yes copy_exec /usr/bin/yes
usr/bin/yes
fi
I haven't tested this, but it seems like it would do the trick.FWIW, for those using a dracut-based initr* (which should be fedora/rh- based distros as well as those like arch and gentoo, where it'd be an option, the recommended option in at least gentoo's case), it's a simple config file edit, with dracut taking care of the rest, including pulling in libraries for non-static binaries. I've not used it for yes, but I've used it for a few other binaries. I use the /etc/dracut.conf.d/* style of config here, and here's what I have in my specific installitems.conf file in that dir: install_items+=" /bin/most /bin/nano " (I don't have less, which dracut uses by default, on my system, preferring most. And nano is a tiny but useful text editor that doesn't require the esoteric pre-use knowledge of something like vi/vim-minimal, tho I prefer the larger mc/mcedit in a less size constrained environment.) Obviously I'd just need to include one more line there to pull in /bin/yes, if I wanted/needed it. (Tho I've not checked, for all I know dracut pulls it in on its own or via some other module I'm already using.) -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman