Module: Gordon::Cookery::ApplicationUser
- Included in:
- RubyStandaloneApp, RubyWebApp
- Defined in:
- lib/gordon/cookery/application_user.rb
Instance Method Summary collapse
- #create_user_and_group(env_vars, home_path) ⇒ Object
- #setup_user_permissions(env_vars, home_path) ⇒ Object
Instance Method Details
#create_user_and_group(env_vars, home_path) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gordon/cookery/application_user.rb', line 4 def create_user_and_group(env_vars, home_path) File.open(builddir('.gordon-before-install'), 'w', 0755) do |f| bash = <<-__BASH #!/bin/sh set -e /usr/bin/getent group #{env_vars.app_name} >/dev/null || /usr/sbin/groupadd --system #{env_vars.app_name}; /usr/bin/getent passwd #{env_vars.app_name} >/dev/null || /usr/sbin/useradd --system --gid #{env_vars.app_name} --home-dir #{home_path} --shell /sbin/nologin --comment "#{env_vars.app_description}" #{env_vars.app_name} >/dev/null || :; __BASH f.write(bash) self.class.pre_install(File.(f.path)) end end |
#setup_user_permissions(env_vars, home_path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gordon/cookery/application_user.rb', line 21 def (env_vars, home_path) File.open(builddir('.gordon-after-install'), 'w', 0755) do |f| bash = <<-__BASH #!/bin/sh set -e /usr/bin/chown -R #{env_vars.app_name}:#{env_vars.app_name} #{home_path} __BASH f.write(bash) self.class.post_install(File.(f.path)) end end |