Browse Source

Small fixes to usability.

master
Jeff R. Allen 3 years ago
parent
commit
61e208dd1a
  1. 3
      update.sh
  2. 19
      utils/bootstrap.pl

3
update.sh

@ -9,4 +9,7 @@ git pull --quiet
cp ~/uucp/ssh/authorized_keys ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
if [ -f ~/.ssh/authorized_keys.local ]; then
cat ~/.ssh/authorized_keys.local >> ~/.ssh/authorized_keys
fi

19
utils/bootstrap.pl

@ -4,7 +4,7 @@ use warnings;
use strict;
use Digest::MD5 qw(md5_hex);
my $myNode = $ARGV[0];
my $myNode = $ARGV[0] || die("usage: ./bootstrap.pl node-id\n");
sub getNodes {
my $nodelist = "../nodelist";
@ -17,16 +17,19 @@ sub getNodes {
my @fields = split(",", $line);
my $nodeName = $fields[0];
#$nodeName eq $myNode && continue
my $nodeAddress = $fields[1];
generatePort($nodeName,$nodeAddress);
generateSys($nodeName);
generateCall($nodeName);
generatePasswd($nodeName);
getKeys($nodeAddress);
generateConfig($myNode);
print("System ".$nodeName." added successfully\n");
}
generateConfig($myNode);
print("Done\n\n");
}
@ -46,7 +49,7 @@ sub generatePort {
};
my $portFile = "port";
open(FH, '>', $portFile);
open(FH, '>>', $portFile);
print FH $template;
}
@ -74,7 +77,7 @@ sub generateSys {
my $sysFile = "sys";
open(FH, '>', $sysFile);
open(FH, '>>', $sysFile);
print FH $template;
}
@ -82,9 +85,9 @@ sub generateConfig {
my $nodeName = shift;
my $confFile = "config";
open(FH, '>',$confFile);
open(FH, '>>',$confFile);
my $nodeConfig = "nodename\t\t".$nodeName;
my $nodeConfig = "nodename\t\t".$nodeName."\n";
print FH $nodeConfig;
}
@ -105,7 +108,7 @@ sub generateCall{
my $callHash = md5_hex($password);
my $callPasswd = $nodeName."\t"."U".$myNode."\t".$callHash."\n";
open(FH, '>', $callFile);
open(FH, '>>', $callFile);
print FH $callPasswd;
}
@ -118,7 +121,7 @@ sub generatePasswd {
my $passwdHash = md5_hex($password);
my $authPasswd = "U".$nodeName."\t".$passwdHash."\n";
open(FH, '>', $passwdFile);
open(FH, '>>', $passwdFile);
print FH $authPasswd;
}

Loading…
Cancel
Save