From dbac4a23940db92bc19b00b1dfa9f07cade5ebe7 Mon Sep 17 00:00:00 2001 From: Daouda Lo Date: Tue, 2 Mar 2004 14:00:57 +0000 Subject: - fix wide conf writtings --- mdkonline | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/mdkonline b/mdkonline index 90d43eb0..f2395d7d 100755 --- a/mdkonline +++ b/mdkonline @@ -4,9 +4,9 @@ # # # Copyright (C) 2001-2002-2003-2004 MandrakeSoft # # # -# Renaud Chaillat # # Daouda Lo # -# # +# Renaud Chaillat # +# # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License Version 2 as # # published by the Free Software Foundation. # @@ -52,6 +52,8 @@ my $VERSION = '1.0'; my ($create_account, $auto_update) = (0, 0); my $linkAccount = "http://www.mandrakeexpert.com/index2.php"; +my $wideconf = '/etc/sysconfig/mdkonline'; + my ($o, $p); $o->{mw} = ugtk2->new("MandrakeOnline" . " " . $VERSION, center => 1); @@ -63,7 +65,7 @@ $o->{nb}->set_show_tabs(0); $o->{nb}->set_show_border(0); $o->{bottomHbox} = Gtk2::HBox->new; my %stage = ( 0 => sub { if ($o->{account_cb}->get_active) { subsOnline() } else { $o->{nb}->next_page} }, - 1 => sub { $o->{nb}->next_page() }, + 1 => sub { $o->{nb}->next_page(); setEntryWithConf() }, 2 => sub { testPasswd() }, 3 => sub { sendConfig() }, 4 => sub { setConf() } @@ -195,6 +197,10 @@ sub checkErrors { raiseError($o->{mw}->{window},N("Error"), N("Not a valid mail address!\n")) } } +sub setEntryWithConf { + my %t = getVarsFromSh($wideconf); + foreach (qw(login machine)) { $o->{$_}->set_text($t->{uc{$_}}) } +} sub sendConfig { # When we arrive here, we're sure the login/passwd is correct # print STDERR "Sending config\n"; @@ -228,7 +234,7 @@ sub sendConfig { remove_wait_msg($w); if ($response->is_success) { $result = ($response->content =~ /^TRUE(.*)/) ? 0 : -1; - printf("Send Config :\nNEWKEY=%s\nRESPONSE=%s", $1, $response->content); + #printf("Send Config :\nNEWKEY=%s\nRESPONSE=%s", $1, $response->content); $o->{currentkey} = $1; } else { # pb with the connection ? @@ -246,6 +252,7 @@ sub sendConfig { } sub setConf { if ($o->{autoup}->get_active) { automatedUpgrades() } + writeWideConf(); } sub init { my $i = shift; @@ -386,13 +393,15 @@ COUNTRY=$country qq(#!/bin/bash if [ -f /root/.mdkupdate ]; then /usr/bin/mdkupdate --auto; fi ); + +chmod 0755, "/etc/cron.daily/mdkupdate"; +} +sub writeWideConf { my $date = chomp_(`date`); - output_with_perm "/etc/sysconfig/mdkonline", 644, + output_with_perm $wideconf, 644, qq(LOGIN=$login -BOX=$boxname +MACHINE=$boxname COUNTRY=$country -LASTCHECK=$date ); - -chmod 0755, "/etc/cron.daily/mdkupdate"; + } -- cgit v1.2.1