diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-05-14 14:27:50 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-05-14 14:27:50 +0100 |
commit | bdb94fb6441df0e09b4e67f238476ec9993fb83b (patch) | |
tree | d3fb3a2c785c31201d630456c7c7e3376021dd32 /debian/byteback/usr/sbin/byteback-setup-client-receive | |
parent | a77c7ac455aea4d7d7f49d7bc9313a2ecc9cfec3 (diff) |
Removed mess.
Diffstat (limited to 'debian/byteback/usr/sbin/byteback-setup-client-receive')
-rwxr-xr-x | debian/byteback/usr/sbin/byteback-setup-client-receive | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/debian/byteback/usr/sbin/byteback-setup-client-receive b/debian/byteback/usr/sbin/byteback-setup-client-receive deleted file mode 100755 index 35a3b65..0000000 --- a/debian/byteback/usr/sbin/byteback-setup-client-receive +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/ruby -# -# Called by byteback-setup-client to set up a new byteback-setup-client - -require 'fileutils' - -def error(message) - STDERR.print "*** #{message}\n" - exit 1 -end - -@hostname = ARGV.shift -@pubkey = ARGV.join(" ") - -error("You must call this from byteback-setup-client on remote host") unless - @hostname && - /^ssh/.match(@pubkey) && - ENV['SSH_CONNECTION'] - -@client_ip = ENV['SSH_CONNECTION'].split(" ").first - -Dir.chdir(ENV['HOME']) # don't know why we wouldn't be here - -Dir.mkdir(@hostname) - -error("Couldn't create btrfs subvolume (needs sudo)") unless - system("sudo btrfs subvolume create #{@hostname}/current") - -FileUtils.mkdir_p(".ssh") - -error("This key already exists in .ssh/authorized_keys on server") if - File.exists?(".ssh/authorized_keys") && - File.read(".ssh/authorized_keys").match(@pubkey.split(/\s+/)[1]) - -File.open(".ssh/authorized_keys", "a+") do |fh| - fh.print <<-LINE.gsub(/\n/,"") -command="byteback-receive", -from="#{@client_ip}", -environment="BYTEBACK_HOST=#{@hostname}" - #{@pubkey} - LINE -end |