summaryrefslogtreecommitdiff
path: root/byteback-setup-client-receive
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-04-02 09:21:42 +0100
committerSteve Kemp <steve@steve.org.uk>2015-04-02 09:21:42 +0100
commite254303eec822eb7f19ef7e37da0a0d4c5ff9182 (patch)
tree38e29c83a18d6a23a30c952f95933f4cfcbac89b /byteback-setup-client-receive
parent4a66fec4b42af038c9fffc25396fe6b5fc177e56 (diff)
Use consistant load-path fiddling.
Diffstat (limited to 'byteback-setup-client-receive')
-rwxr-xr-xbyteback-setup-client-receive11
1 files changed, 6 insertions, 5 deletions
diff --git a/byteback-setup-client-receive b/byteback-setup-client-receive
index 0dc850f..e17c30b 100755
--- a/byteback-setup-client-receive
+++ b/byteback-setup-client-receive
@@ -2,7 +2,8 @@
#
# Called by byteback-setup-client to set up a new byteback-setup-client
-$: << '/usr/lib/byteback'
+$LOAD_PATH.unshift("/usr/lib/byteback")
+
require 'fileutils'
require 'trollop'
require 'byteback/util'
@@ -19,7 +20,7 @@ end
@pubkey = ARGV.join(" ")
error("You must call this from byteback-setup-client on remote host") unless
- @hostname &&
+ @hostname &&
/^ssh/.match(@pubkey) &&
ENV['SSH_CONNECTION']
@@ -29,15 +30,15 @@ Dir.chdir(ENV['HOME']) # don't know why we wouldn't be here
FileUtils.mkdir_p(@hostname)
-error("Couldn't create btrfs subvolume") unless
+error("Couldn't create btrfs subvolume") unless
system("/sbin/btrfs subvolume create #{@hostname}/current")
FileUtils.mkdir_p(".ssh")
-if File.exists?(".ssh/authorized_keys") &&
+if File.exists?(".ssh/authorized_keys") &&
File.read(".ssh/authorized_keys").match(@pubkey.split(/\s+/)[1])
- warn("This key already exists in .ssh/authorized_keys on server, nothing to do!")
+ warn("This key already exists in .ssh/authorized_keys on server, nothing to do!")
else