New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added named.conf API transformation script to spec #7
Conversation
contrib/bind-dyndb-ldap.spec
Outdated
| LIBPATH=/usr/lib | ||
| fi | ||
|
|
||
| while read -r PATTERN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This construct is used only to allow multiple lines to make the sed script a bit more readable.
| do | ||
| SEDSCRIPT+="$PATTERN" | ||
| done <<EOF | ||
| /^\s*dynamic-db/,/};/ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scopes the changes only to dynamic-db part, until }; is found. This will fail in rare cases when }; is used as a part of string (i.e. in password) or in comment.
| done <<EOF | ||
| /^\s*dynamic-db/,/};/ { | ||
|
|
||
| s/\(\s*\)arg\s\+\(["']\)\([a-Z_]\+\s\)/\1\3\2/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transforms arg "name value" to name "value". Also works with single quotes.
| s/^dynamic-db/dyndb/; | ||
|
|
||
| s@\(dyndb "[^"]\+"\)@\1 "$LIBPATH/bind/ldap.so"@; | ||
| s@\(dyndb '[^']\+'\)@\1 '$LIBPATH/bind/ldap.so'@; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$LIBPATH properly handles differences between i686 and x86_64.
Works with both single and double quotes.
| s@\(dyndb "[^"]\+"\)@\1 "$LIBPATH/bind/ldap.so"@; | ||
| s@\(dyndb '[^']\+'\)@\1 '$LIBPATH/bind/ldap.so'@; | ||
|
|
||
| /\s*library[^;]\+;/d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the old way of providing the path to library.
| /\s*cache_ttl[^;]\+;/d; | ||
| /\s*psearch[^;]\+;/d; | ||
| /\s*serial_autoincrement[^;]\+;/d; | ||
| /\s*zone_refresh[^;]\+;/d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these deprecated options that are no longer supported.
| } | ||
| EOF | ||
|
|
||
| sed -i.bak -e "$SEDSCRIPT" /etc/named.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the sed script. Make a backup of /etc/named.conf. It may be useful if the transformation fails and the user needs to manually edit the /etc/named.conf file to use the new-style API.
|
This patch is meant to fix existing IPA installations when they're upgraded to use BIND-9.11. New IPA installations are covered by freeipa/freeipa#351 The script is written in sed. I added some inline comments for better clarity. |
|
IMO those explanatory comments should be in code not in github |
|
otherwise LGTM |
A script that converts old-style configuration API of named.conf to the new-style API after rpm isntallation was added to contrib specfile. Required version of BIND was also bumped to 9.11.
A script that converts old-style configuration API of named.conf
to the new-style API after rpm isntallation was added to contrib
specfile.
Required version of BIND was also bumped to 9.11.