NIFI-3015 - This closes #1422. Corrects issue were RPM profile run.as property was not being used

This supersedes #1198
This commit is contained in:
Andre F de Miranda 2017-01-17 03:44:55 +11:00 committed by joewitt
parent adfaffc773
commit 76e31dfd19
1 changed files with 9 additions and 0 deletions

View File

@ -485,6 +485,15 @@ language governing permissions and limitations under the License. -->
<defaultFilemode>640</defaultFilemode>
<defaultUsername>nifi</defaultUsername>
<defaultGroupname>nifi</defaultGroupname>
<!-- This allows the stanza to produce bootstrap.conf that is pre-configured with run.as=nifi
given the uid is created by the preinstallScriptlet below. Meanwhile, normal zip and tar.gz
ship without this particular property set -->
<installScriptlet>
<!-- It is important to note because of the way the plugin calls the command, the sed backup
parameter -i and the sed command do not beed to be wrapped by single or double quotes.
Also note maven properties are processed before RPM variables and before sed commands -->
<script>sed -i s/^run\.as=$/run\.as=${nifi.run.as}/ $RPM_BUILD_ROOT/opt/nifi/nifi-${project.version}/conf/bootstrap.conf</script>
</installScriptlet>
<preinstallScriptlet>
<script>
/usr/bin/getent group nifi &gt;/dev/null || /usr/sbin/groupadd -r nifi; /usr/bin/getent passwd nifi &gt;/dev/null || /usr/sbin/useradd -r -g nifi -d /opt/nifi -s /sbin/nologin -c "NiFi System User" nifi