oswitch 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f17f0c2bd70cf5a969f60d6a000ebacaba1940dc
4
- data.tar.gz: 4fc93cdb2580315e7a49032c2ff32797566144a1
3
+ metadata.gz: bbe3ef281a84b86f6912113be364ff1db6c2732d
4
+ data.tar.gz: 9abab4b1888052a8ad92c097dca8a238e743f7ea
5
5
  SHA512:
6
- metadata.gz: 08362f1f00b5d02531c2df28c59ccb9107f13e9ffcce5efef32cf2378e922f83c8db512dd098af6c081237b6db7920bf64c1d258c0f916762de5bd5a3eb0e883
7
- data.tar.gz: 73b363b026815f51c84b110dd59a857a168fc9c8e9aaee6b22b14cb96341b4d83c7eba06b02a92d9fd18ef2cbb4d4f2fd91307cf1ba52f27aa4b6909da0f8e3e
6
+ metadata.gz: 702620d1e4c891b48ad70d846ec8c744e8f370cde50820f83035e86120357566030cb091b1036eb4449ef9e35aa5f9c0e2306285c0240938736f4e854b919e20
7
+ data.tar.gz: f8a1ed6d3b66716f2bff1caad751f3f21421c76f7ecaafb8b26fc562077a045c7b0455103b9cb85c3298c474469bbe3b40718807f0accddc46932e79db8c562c
data/context/_switch ADDED
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env sh
2
+
3
+ if [ $# -lt 5 ]; then
4
+ echo "Usage: ... <uid> <gid> <user> <home> <shell>"
5
+ exit
6
+ fi
7
+
8
+ uid=$1
9
+ gid=$2
10
+ user=$3;
11
+ home=$4;
12
+ shell=$5;
13
+ shift 5
14
+
15
+ echo
16
+ echo "Switch-ifying ..."
17
+
18
+ ## Debian ##
19
+ if command -v apt-get >/dev/null; then
20
+
21
+ export DEBIAN_FRONTEND=noninteractive
22
+
23
+ echo
24
+ echo 'Assuming Ubuntu.'
25
+ echo 'Attempting to activate universe and multiverse repositories.'
26
+ apt-get install -y software-properties-common
27
+ apt-add-repository universe
28
+ apt-add-repository multiverse
29
+
30
+ if [ $? -ne 0 ]; then
31
+ echo
32
+ echo 'Oops ... it is Debian. Continuing.'
33
+ fi
34
+
35
+ echo
36
+ echo 'Updating list of packages.'
37
+ apt-get update
38
+
39
+ echo
40
+ echo 'Installing utilities.'
41
+ apt-get install -y sudo less
42
+
43
+ echo
44
+ echo 'Setting up locale.'
45
+ apt-get install -y locales
46
+ echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
47
+ locale-gen en_US.UTF-8
48
+
49
+ echo
50
+ echo "Installing $shell as requested."
51
+ apt-get install -y $shell
52
+
53
+ ## Red Hat ##
54
+ elif command -v yum >/dev/null; then
55
+
56
+ echo 'Red Hat based image detected.'
57
+
58
+ echo
59
+ echo 'Installing utilities.'
60
+ yum install -y sudo passwd
61
+
62
+ echo
63
+ echo "Installing $shell as requested."
64
+ yum install -y $shell
65
+
66
+ ## Arch ##
67
+ # elif command -v pacman >/dev/null; then
68
+ #
69
+ # echo 'Arch based image detected.'
70
+ #
71
+ # echo
72
+ # echo 'Updating list of packages.'
73
+ # pacman --noconfirm -Sy
74
+ #
75
+ # echo
76
+ # echo "Installing $shell as requested."
77
+ # pacman --noconfirm -S $shell
78
+ else
79
+ echo
80
+ echo "Can't infer base image."
81
+ fi
82
+
83
+ # Will create group 'wheel' to give passwordless sudo access to users. Will
84
+ # create the user, without password, keeping the same uid as the host. Will
85
+ # set newly created user as the current user in container.
86
+
87
+ echo
88
+ echo "Creating user $user with uid $uid ..."
89
+ groupadd -f wheel
90
+ groupadd -f $user -g $gid
91
+ useradd -M -N -g $gid -G wheel -d $home -u $uid $user
92
+ passwd -d $user &> /dev/null
93
+
94
+ echo 'Done.'
95
+ echo "Your home directory is $homedir."
96
+ echo 'You can use sudo.'
data/context/wheel ADDED
@@ -0,0 +1 @@
1
+ %wheel ALL = (ALL) NOPASSWD: ALL
data/oswitch.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  # meta
3
3
  s.name = 'oswitch'
4
- s.version = '0.1.0'
5
- s.authors = ['Anurag Priyam']
4
+ s.version = '0.2.1'
5
+ s.authors = ['Anurag Priyam', 'Bruno Vieira', 'Yannick Wurm']
6
6
  s.email = ['anurag08priyam@gmail.com']
7
7
  s.homepage = 'https://github.com/yeban/oswitch'
8
8
  s.license = 'MIT'
@@ -17,11 +17,13 @@ DESC
17
17
 
18
18
  # dependencies
19
19
  s.add_dependency('colorize', '~> 0.7.5')
20
+ s.required_ruby_version = '>= 2.0'
20
21
 
21
22
  # gem
22
- s.files = Dir['lib/**/*'] + Dir['Dockerfiles/**/*']
23
+ s.files = Dir['lib/**/*'] + Dir['context/**/*']
23
24
  s.files = s.files + ['Gemfile', 'oswitch.gemspec']
24
25
  s.files = s.files + ['README.mkd']
25
26
  s.require_paths = ['lib']
26
27
  s.executables = ['oswitch']
28
+
27
29
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oswitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anurag Priyam
8
+ - Bruno Vieira
9
+ - Yannick Wurm
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
13
+ date: 2015-02-20 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: colorize
@@ -38,6 +40,8 @@ files:
38
40
  - Gemfile
39
41
  - README.mkd
40
42
  - bin/oswitch
43
+ - context/_switch
44
+ - context/wheel
41
45
  - lib/oswitch.rb
42
46
  - oswitch.gemspec
43
47
  homepage: https://github.com/yeban/oswitch
@@ -52,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
56
  requirements:
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: '0'
59
+ version: '2.0'
56
60
  required_rubygems_version: !ruby/object:Gem::Requirement
57
61
  requirements:
58
62
  - - ">="