Modify

Opened 7 years ago

Closed 7 years ago

Last modified 22 months ago

#5636 closed enhancement (fixed)

[PATCH] add default option to config_get and some followup cleanups

Reported by: Malte S. Stretz <mss@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: base system Version:
Keywords: Cc:

Description

The command config_get_bool allows a fourth parameter which defines a default value. At many places it would be very useful if the plain three-parameter version of config get supported such a parameter as well, that saves a bunch of [ -z "$foo" ] checks in my scripts.

I'll attach some patches: The first introduces an optional fourth parameter to config_get. That patch could be backported to 8.09 branch.

The next four patches apply this four-parameter version in functions.sh, init.d/boot, init.d/led and init.d/fstab.

Finally there's another patch to /lib/network/config.sh which also includes some refactoring moving around some code and localizes a lot of variables which weren't so before. The changes don't spread over more than two hunks per refactoring.

Attachments (9)

0001--package-base-files-allow-default-value-for-config.patch (1.5 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0002--package-base-files-port-functions.sh-to-new-confi.patch (1.0 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0003--package-base-files-port-init.d-boot-to-new-config.patch (1.6 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0004--package-base-files-port-init.d-led-to-new-config_.patch (1.7 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0005--package-base-files-clean-up-init.d-fstab-and-port.patch (2.3 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0006--package-base-files-some-lib-network-config.sh-re.patch (7.9 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0007-docs-update-documentation-to-explain-the-four-param.patch (1.9 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0008-doc-some-talk-about-named-sections-and-stuff.patch (3.8 KB) - added by Malte S. Stretz <mss@…> 7 years ago.
0009--package-base-files-small-refactoring-to-use-alrea.patch (1.3 KB) - added by Malte S. Stretz <mss@…> 7 years ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

comment:1 Changed 7 years ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

applied in r17155 - r17160
I changed the first patch to preserve the sanity checking functionality in config_get_bool

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

Changed 7 years ago by Malte S. Stretz <mss@…>

comment:2 Changed 7 years ago by Maddes <maddes_trac@…>

Patch 0008-doc-some-talk-about-named-sections-and-stuff.patch mentions to use the option "named" in uci configs.
But when I check with "uci show | grep name", then only the firewall zone sections have an option called "name" (no D) not "named".

So my suggestestion would be to use "name" (no D) for direct names in uci configs, and something like "_named"/"_name" for generated names.

comment:3 Changed 22 months ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.