> URL: http://svn.opensuse.org/viewcvs/yast?rev=62759&view=rev
> Log:
> update fstab options (bnc#649497)
> 
> @@ -5178,6 +5178,25 @@
>       }
>      }
>  
> +global define void UpdateFstabOptions() {
> +    y2milestone( "UpdateFstabOptions" );
> +    string tabpath = PathToDestdir( "/etc/fstab" );
> +    map fstab = Partitions::GetFstab( tabpath );
> +    integer line = 0;
> +    string n = "";
> +    while( line<=AsciiFile::NumLines( fstab ) )
> +     {
> +     map l = AsciiFile::GetLine( fstab, line );
> +        string options = l["fields", 3]:"";
> +        if (regexpmatch (options, "^\(.*,\)\?hotplug\(,.*\)\?$")) {
> +            options = regexpsub (options, "^\(.*,\)\?hotplug\(,.*\)\?$", 
> "\\1nofail\\2");
> +         AsciiFile::ChangeLineField( fstab, line, 3, options );
> +        }
> +     line = line+1;
> +    }
> +    AsciiFile::RewriteFile( fstab, tabpath );
> +}
> +

My new favorite hammer can do this in one line ;-)
  int aug_setm(augeas *aug, const char *base, const char *sub, const char 
*value)

aug_setm(context, "/files/etc/fstab/*/opt[. = 'hotplug']", NULL, "nofail");

Or in Ruby:
http://git.fedorahosted.org/git/?p=ruby-augeas.git;a=blobdiff;f=tests/tc_augeas.rb;h=3edfc0124407637146a1fcddc590a05ca0e77c28;hp=489986f4ba24e35509db78f39db8d213dd89747e;hb=3f518d2c4d3d1ea85ddeb62646e8a14b3318ee3e;hpb=73423803a9fcf016b859bf7cba3128f020571098
-- 
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu

Attachment: pgpVkjpnJxs7U.pgp
Description: PGP signature

Reply via email to