sparkle-pack-shell-helpers 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b70545093ac47caab954a0ef2aea203b8de941f
4
- data.tar.gz: d50dc11987705e14e61f654c5355928d17494c2f
3
+ metadata.gz: 77257128664967820b7807a7431a4081f4df01bd
4
+ data.tar.gz: 95917792afea5386f4687b40a651d2ac355262dc
5
5
  SHA512:
6
- metadata.gz: 389fbe0da4e7616544713036bd96d6c16800fb9ef2cfe56e2b3baf6e7e821971456db99e274d6bac0fe3c4cc2e7995d4da844909c41361cff64ac64a1dde51e8
7
- data.tar.gz: 4854d558df2d6dca0e913aa75bfa174e2cdad11c05a55fec93e203308388342ad61133895f59459c0f7ee240e313f3fb2448a46d7d9a631781cf79bb712aadfe
6
+ metadata.gz: bb1c2dc7a9aa273829088db61723ab382cfe62670191f50885868a3b44e717277bb9200d3fd09e5a4032781dd838028caeeea1ca086d19f56c5532c5d2a73c91
7
+ data.tar.gz: d724b56509ca631a2881d41d56924bfaac332c94d9ff36218eddaa8d09463fd58218c9a192358f7ece61d4935ad4e5b6c1381f9adcf31c0ef90c08f2c7e2e85e
@@ -1,10 +1,19 @@
1
1
  SfnRegistry.register(:shell_helper) do |args|
2
2
  case args[:part].to_s
3
3
  when 'shebang'
4
+ case args[:shell].to_s
5
+ when 'sh'
6
+ shell = 'sh'
7
+ when 'bash'
8
+ shell = 'bash'
9
+ else
10
+ shell = 'bash'
11
+ end
12
+
4
13
  if args[:catch_errors]
5
- "#!/bin/sh -ex\n\n"
14
+ "#!/bin/#{shell} -ex\n\n"
6
15
  else
7
- "#!/bin/sh -x\n\n"
16
+ "#!/bin/#{shell} -x\n\n"
8
17
  end
9
18
 
10
19
  ## Put the following at the top of your userdata after shebang
@@ -30,6 +39,25 @@ SfnRegistry.register(:shell_helper) do |args|
30
39
  --region "${CFN_REGION}"
31
40
 
32
41
  EOF
42
+
43
+ when 'add_user'
44
+ if !args[:user]
45
+ raise!("Parameter :user is required. You've passed: #{args.inspect}")
46
+ end
47
+
48
+ lines = ["useradd -m #{args[:user]}"]
49
+ if args[:sudo]
50
+ if args[:nopasswd]
51
+ lines << "echo '#{args[:user]} ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/90-#{args[:user]}"
52
+ else
53
+ lines << "echo '#{args[:user]} ALL=(ALL) ALL' > /etc/sudoers.d/90-#{args[:user]}"
54
+ end
55
+ end
56
+ lines.join("\n") + "\n\n"
57
+
58
+ when 'no_requiretty'
59
+ "echo 'Defaults !requiretty' > /etc/sudoers.d/99-requiretty\n\n"
60
+
33
61
  else
34
62
  raise!("Unknown part #{args[:part].inspect} passed to registry shell_helper")
35
63
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sparkle-pack-shell-helpers'
3
- s.version = '0.3.0'
3
+ s.version = '0.5.0'
4
4
  s.licenses = ['MIT']
5
5
  s.summary = 'SparklePack with various shell helpers to be used in UserData'
6
6
  s.description = 'Shell helpers to be used in UserData templates for easier generation of shell scripts'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparkle-pack-shell-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timur Batyrshin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-14 00:00:00.000000000 Z
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Shell helpers to be used in UserData templates for easier generation
14
14
  of shell scripts