summaryrefslogtreecommitdiffstats
path: root/news_wizard
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-09-02 15:36:47 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-09-02 15:36:47 +0000
commitc564eb666da61ff63cea41be88f54ba47f18ec1f (patch)
tree00b2b2e81a5b1026de1b6a8aa0a1c2a9332fcbe0 /news_wizard
parent49050b263948bdee8987ccc1f0c576fc2d0830ec (diff)
downloaddrakwizard-c564eb666da61ff63cea41be88f54ba47f18ec1f.tar
drakwizard-c564eb666da61ff63cea41be88f54ba47f18ec1f.tar.gz
drakwizard-c564eb666da61ff63cea41be88f54ba47f18ec1f.tar.bz2
drakwizard-c564eb666da61ff63cea41be88f54ba47f18ec1f.tar.xz
drakwizard-c564eb666da61ff63cea41be88f54ba47f18ec1f.zip
some shortcuts and remove of mdk_serv update
Diffstat (limited to 'news_wizard')
-rw-r--r--news_wizard/scripts/Newsconf.pm54
1 files changed, 14 insertions, 40 deletions
diff --git a/news_wizard/scripts/Newsconf.pm b/news_wizard/scripts/Newsconf.pm
index a0968891..2ec5675d 100644
--- a/news_wizard/scripts/Newsconf.pm
+++ b/news_wizard/scripts/Newsconf.pm
@@ -27,52 +27,26 @@ sub normalize_server {
}
sub do_it {
- defined $ENV{wiz_news_freq} and my $freq = normalize_freq($ENV{wiz_news_freq}) or
- die "freq not defined: $!";
- defined $ENV{wiz_news_server} and my $server = normalize_server($ENV{wiz_news_server}) or
- die "server not defined: $!";
- my %mdk = Vareqval->get("/etc/sysconfig/mdk_serv");
- $mdk{wiz_news_freq} = $freq;
- $mdk{wiz_news_server} = $server;
- Vareqval->commit("/etc/sysconfig/mdk_serv", \%mdk);
+ $ENV{wiz_news_freq} and my $freq = normalize_freq($ENV{wiz_news_freq}) or
+ die "freq not defined: $!";
+ $ENV{wiz_news_server} and my $server = normalize_server($ENV{wiz_news_server}) or
+ die "server not defined: $!";
my $file = "/etc/leafnode/config";
- if (! -f $file) { die "$file not found: $!"};
- my $tmp = `mktemp /tmp/Newsconf.XXXXXX`
- or die "can't make a temp file: $!";
- open(OLD, "< __WIZ_HOME__/news_wizard/scripts/config.default")
- or die "can't open default: $!";
- open(NEW, "> $tmp")
- or die "can't open $tmp: $!";
- while (<OLD>) {
+ output($file, map {
s|__server__|$server|g;
- print NEW $_;
- }
- close(OLD);
- close(NEW);
- chomp($tmp);
- system("mv $tmp $file");
+ $_;
+ } cat_("__WIZ_HOME__/news_wizard/scripts/config.default"));
$file = "/var/spool/cron/news";
- if (-f $file) {
- MDK::Common::cp_af($file, "/etc/leafnode/crontab");
- }
+ -f $file and MDK::Common::cp_af($file, "/etc/leafnode/crontab");
$file = "/etc/leafnode/crontab";
MDK::Common::cp_af($file, $file . ".orig");
my $file = "/etc/leafnode/crontab";
- my $tmp = `mktemp /tmp/Newsconf.XXXXXX`
- or die "can't make a temp file: $!";
- open(OLD, "< __WIZ_HOME__/news_wizard/scripts/news.cron")
- or die "can't open default: $!";
- open(NEW, "> $tmp")
- or die "can't open $tmp: $!";
- while (<OLD>) {
+ output($file, map {
s|__freq__|$freq|g;
- print NEW $_;
- }
- close(OLD);
- close(NEW);
- chomp($tmp);
- system("mv $tmp $file");
- print "hello\n";
+ $_;
+ } cat_("__WIZ_HOME__/news_wizard/scripts/news.cron"));
system("crontab -u news /etc/leafnode/crontab");
- print "hello\n";
+ 10;
}
+
+1;