Changeset 5e71d34 for fedkit


Ignore:
Timestamp:
Jan 18, 2013 10:06:54 AM (11 years ago)
Author:
Ted Faber <faber@…>
Branches:
master
Children:
8f654de
Parents:
950b55e
Message:

Fix fedkit to work on Ubuntu 12.04

Location:
fedkit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fedkit/gateway_lib.pm

    r950b55e r5e71d34  
    4444    $t = new File::Temp() || die "Can't open tempfile: $!\n";
    4545
     46    # If the parameter is in the file (even in a comment) update the line to
     47    # have the new parameter.
     48    my %updated;
    4649    while (<$f>) {
    4750        foreach my $k (keys %{$keys}) {
    48             s/^\s*#?\s*$k.*/$k $keys->{$k}/;
     51            if (s/^\s*#?\s*$k.*/$k $keys->{$k}/) { $updated{$k}++; }
    4952        }
    5053        print $t $_;
     54    }
     55    # Any parameters not found above are output directly.
     56    foreach my $k (keys %{$keys}) {
     57        print $t "$k " . $keys->{$k} . "\n" unless $updated{$k};
    5158    }
    5259    $f->close();
  • fedkit/prep_gateway.pl

    r950b55e r5e71d34  
    4040    gateway_lib::set_sshd_params(
    4141        { 'GatewayPorts' => 'yes', 'PermitTunnel' => 'yes' } );
    42     system("/etc/init.d/sshd restart");
     42    if ( -x "/etc/init.d/sshd") {
     43        system("/etc/init.d/sshd restart");
     44    }
     45    elsif (-x "/etc/init.d/ssh") {
     46        # XXX should look for service
     47        system("/etc/init.d/ssh restart");
     48    }
     49    else {
     50        print "Cannot figure out how to restart sshd\n";
     51    }
    4352    gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
    4453        if $ssh_pubkey;
Note: See TracChangeset for help on using the changeset viewer.