[Mageia-dev] Cleaning up init

Colin Guthrie mageia at colin.guthr.ie
Thu Jan 31 11:00:36 CET 2013


'Twas brillig, and Dan Fandrich at 30/01/13 22:49 did gyre and gimble:
> On Tue, Jan 29, 2013 at 10:19:46AM +0000, Colin Guthrie wrote:
>> find /etc/rc.d/rc{0,1,2,3,4,5,6,7}.d -type l -exec sh -c 'if [ ! -e {}
>> ]; then rm -f {}; fi' \;
>>
>> This does much the same job, but "find" is already used in multiple
>> places so probably a better solution even if the command is more convoluted!
>>
>> If anyone spots any issues with this, please shout.
> 
> This solution has a problem handling files with embedded spaces and
> special shell characters. It could potentially be bad if run on a system
> where a link such as "/etc/rc.d/rc0.d/S01Super * Star Program" exists.

While I'm pretty sure no such init script exists and would break in
other ways, it's still a valid point. I've changed it to "{}" now.

Anyone else have any comments on this?

Col


-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the Mageia-dev mailing list