[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to add small console application to debian linux distribution?



Hi pe pi and others,

Quoting Alex Mestiashvili (2020-10-13 09:54:15)
> it's nice that you want to make the software available for others, but 
> this task is simply way to simple to have a special package for it. 
> The whole thing can be done with a few shell commands, so there is no 
> need for a tool in my opinion. For example a perl oneliner doing the 
> line substitution:
> 
> export myopt='bla'; perl -i -pe 
> 's/^(GRUB_CMDLINE_LINUX_DEFAULT=)\"(.*)\"/$1\"$2 $ENV{myopt}\"/' /tmp/grub

Beware that export mangles some characters special to POSIX shell.

This is more reliable and shorter (also by using \K and no capture):

myopt='bla' perl -i -pe 
's/^GRUB_CMDLINE_LINUX_DEFAULT=\".*\K(?=\")/ $ENV{myopt}/' /tmp/grub


I agree with the general point that this feels too tiny and narrow 
purpose for a Debian package.

I do recognize, however, that oneliners like the above are easy to do 
wrong, and that's scary when it is the bootloader configuration you are 
messing with.

Would it perhaps be interesting for you to generalize your script to a 
"grub-set-bootarg" script which adds _any_ option to grub, or replace 
its value for an option already declared)?

You could then propose the package maintainers of grub to include that 
script with the grub package.

If grub maintainers reject your proposed script, you might consider 
generalizing even further to a "configfile-set-arg" script that first 
tries to detect syntax, and for a syntax recognized does the surgery.  
You could then propose to have that script added to package moreutils.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

Attachment: signature.asc
Description: signature


Reply to: