<commit_before># Note: changes to this section of the spec may require synchronisation with the
# install.sh source based installation methodology.
#
# Add <%= EZBake::Config[:group] %> group
<% if EZBake::Config[:numeric_uid_gid].nil? -%>
getent group <%= EZBake::Config[:group] %> >/dev/null || groupadd --system --force <%= EZBake::Config[:group] %>
<% else -%>
getent group <%= EZBake::Config[:group] %> >/dev/null || groupadd --system --force --gid <%= EZBake::Config[:numeric_uid_gid] %> <%= EZBake::Config[:group] %>
<% end -%>

# Add <%= EZBake::Config[:user] %> user
if getent passwd <%= EZBake::Config[:user] %> > /dev/null; then
  usermod --gid <%= EZBake::Config[:group] %> --home %{_app_data} \
  --comment "<%= EZBake::Config[:project] %> daemon" <%= EZBake::Config[:user] %> || :
else
  useradd_options=('--system' '--gid' '<%= EZBake::Config[:group] %>' '--home' '%{_app_data}' '--shell' "$(which nologin)" '--comment' '<%= EZBake::Config[:project] %> daemon')
<% unless EZBake::Config[:numeric_uid_gid].nil? -%>
  if ! getent passwd <%= EZBake::Config[:numeric_uid_gid] %> > /dev/null; then
    useradd_options+=('--uid' '<%= EZBake::Config[:numeric_uid_gid] %>')
  fi
<% end -%>
  useradd "${useradd_options[@]}" <%= EZBake::Config[:user] %> || :
fi
<% if defined?(additional_preinst)
additional_preinst.split(',').each do |cmd| -%>
<%= cmd %>
<% end -%>
<% end -%><commit_msg>(maint) Additional preinstall scripts weren't added properly<commit_after># Note: changes to this section of the spec may require synchronisation with the
# install.sh source based installation methodology.
#
# Add <%= EZBake::Config[:group] %> group
<% if EZBake::Config[:numeric_uid_gid].nil? -%>
getent group <%= EZBake::Config[:group] %> >/dev/null || groupadd --system --force <%= EZBake::Config[:group] %>
<% else -%>
getent group <%= EZBake::Config[:group] %> >/dev/null || groupadd --system --force --gid <%= EZBake::Config[:numeric_uid_gid] %> <%= EZBake::Config[:group] %>
<% end -%>

# Add <%= EZBake::Config[:user] %> user
if getent passwd <%= EZBake::Config[:user] %> > /dev/null; then
  usermod --gid <%= EZBake::Config[:group] %> --home %{_app_data} \
  --comment "<%= EZBake::Config[:project] %> daemon" <%= EZBake::Config[:user] %> || :
else
  useradd_options=('--system' '--gid' '<%= EZBake::Config[:group] %>' '--home' '%{_app_data}' '--shell' "$(which nologin)" '--comment' '<%= EZBake::Config[:project] %> daemon')
<% unless EZBake::Config[:numeric_uid_gid].nil? -%>
  if ! getent passwd <%= EZBake::Config[:numeric_uid_gid] %> > /dev/null; then
    useradd_options+=('--uid' '<%= EZBake::Config[:numeric_uid_gid] %>')
  fi
<% end -%>
  useradd "${useradd_options[@]}" <%= EZBake::Config[:user] %> || :
fi
<% EZBake::Config[:redhat][:additional_preinst].each do |cmd| -%>
<%= cmd %>
<% end -%>
{'fraction_non_alphanumeric': 0.24385902456390174, 'fraction_numerical': 0.0, 'mean_word_length': 5.135371179039302, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4507741', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1013, 'n_words': 199}