lxdev 0.1.0 → 0.1.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 +4 -4
- data/lib/lxdev.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2120a1f663ad212a874571fd8bf7e8a9c786de30
|
4
|
+
data.tar.gz: dc6fd44130b3fa99542d48e181222ee4706b80d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b0bfc74622c66e21f19b339ea2d3f6274ae674dfffd28acaa5156634d57097c5ea2b95da84ffab3e2620183498e8cbb844fe89ef9c4a39d702a992907304d6a
|
7
|
+
data.tar.gz: 87079f38bd82eecc97c2ca3c40e28639fc4447c6556d87b57b9e619c81efaebb34523315ecf954eba8039e8b4a5b92dbecf470756256006a4927a552a806834c
|
data/lib/lxdev.rb
CHANGED
@@ -6,7 +6,7 @@ class LxDev
|
|
6
6
|
WHITELISTED_SUDO_COMMANDS = ["lxc", "redir", "kill"]
|
7
7
|
SHELLS = ["bash", "zsh", "sh", "csh", "tcsh", "ash"]
|
8
8
|
BOOT_TIMEOUT = 30
|
9
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.1'
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@uid=%x{id -u}.chomp
|
@@ -105,7 +105,7 @@ class LxDev
|
|
105
105
|
puts "#{@name} doesn't seem to be running."
|
106
106
|
exit 1
|
107
107
|
end
|
108
|
-
ssh_command = "ssh -o StrictHostKeyChecking=no -t #{@user}@#{get_container_ip} #{args.empty? ? '
|
108
|
+
ssh_command = "ssh -o StrictHostKeyChecking=no -t #{@user}@#{get_container_ip} #{args.empty? ? '' : "'#{args.join(' ')}'"}"
|
109
109
|
exec ssh_command
|
110
110
|
end
|
111
111
|
|
@@ -189,12 +189,12 @@ class LxDev
|
|
189
189
|
|
190
190
|
def add_subuid_and_subgid
|
191
191
|
need_restart = false
|
192
|
-
%x{
|
192
|
+
%x{grep -q 'root:#{@uid}:1' /etc/subuid}
|
193
193
|
if $?.exitstatus != 0
|
194
194
|
%x{echo 'root:#{@uid}:1' | sudo tee -a /etc/subuid}
|
195
195
|
need_restart = true
|
196
196
|
end
|
197
|
-
%x{
|
197
|
+
%x{grep -q 'root:#{@gid}:1' /etc/subgid}
|
198
198
|
if $?.exitstatus != 0
|
199
199
|
%x{echo 'root:#{@gid}:1' | sudo tee -a /etc/subgid}
|
200
200
|
need_restart = true
|
@@ -211,6 +211,8 @@ class LxDev
|
|
211
211
|
%x{sudo lxc exec #{@name} -- chmod 0700 /home/#{user}/.ssh}
|
212
212
|
%x{ssh-add -L | sudo lxc exec #{@name} tee /home/#{user}/.ssh/authorized_keys}
|
213
213
|
%x{sudo lxc exec #{@name} -- chown -R #{user} /home/#{user}/.ssh}
|
214
|
+
%x{sudo lxc exec #{@name} -- touch /home/#{@user}/.hushlogin}
|
215
|
+
%x{sudo lxc exec #{@name} -- chown #{user} /home/#{user}/.hushlogin}
|
214
216
|
%x{printf "#{user} ALL=(ALL) NOPASSWD: ALL\n" | sudo lxc exec #{@name} -- tee -a /etc/sudoers}
|
215
217
|
%x{sudo lxc exec #{@name} -- chmod 0440 /etc/sudoers}
|
216
218
|
end
|