From 306951e28791b261f894a8b71255b4c45d105661 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Mon, 20 Oct 2003 10:51:59 +0000 Subject: change copyright remove old xml related files --- Wizard.dtd | 118 ------ client_wizard/Bind_client.pm | 6 +- client_wizard/client.wiz | 368 ---------------- client_wizard/scripts/Clientconf.pm | 116 ----- client_wizard/scripts/do_it_client.sh | 80 ---- common/IFCFG.pm | 4 +- common/Varspaceval.pm | 8 +- common/Wizcommon.pm | 6 +- common/scripts/DrakconnectConf.pm | 71 ---- common/scripts/IFCFG.pm | 88 ---- common/scripts/Vareqval.pm | 89 ---- common/scripts/Varspaceval.pm | 88 ---- common/scripts/check.sh | 64 --- common/scripts/check_root.sh | 51 --- common/scripts/functions.sh | 534 ----------------------- common/scripts/test.pl | 12 - dhcp_wizard/Dhcp.pm | 11 +- dhcp_wizard/dhcp.wiz | 324 -------------- dhcp_wizard/scripts/Dhcpconf.pm | 158 ------- dhcp_wizard/scripts/do_it_dhcp.sh | 124 ------ dns_wizard/dns.wiz | 288 ------------- dns_wizard/scripts/Dnsconf.pm | 174 -------- drakwizard.pl | 4 +- ftp_wizard/Proftpd.pm | 4 +- ftp_wizard/ftp.wiz | 229 ---------- ftp_wizard/scripts/ProFtpconf.pm | 163 ------- news_wizard/Inn.pm | 4 +- news_wizard/news.wiz | 283 ------------- news_wizard/scripts/Newsconf.pm | 77 ---- postfix_wizard/Postfix.pm | 6 +- postfix_wizard/postfix.wiz | 323 -------------- proxy_wizard/Squid.pm | 6 +- proxy_wizard/proxy.wiz | 758 --------------------------------- proxy_wizard/scripts/Squidconf.pm | 121 ------ samba_wizard/Samba.pm | 7 +- samba_wizard/samba.wiz | 778 ---------------------------------- samba_wizard/scripts/Smbconf.pm | 339 --------------- time_wizard/scripts/NTPConf.pm | 70 --- time_wizard/scripts/compute_liste.sh | 36 -- time_wizard/time.wiz | 647 ---------------------------- web_wizard/Apache.pm | 6 +- web_wizard/apache2.wiz | 379 ----------------- web_wizard/scripts/Apache2conf.pm | 120 ------ web_wizard/scripts/Webconf.pm | 119 ------ web_wizard/scripts/mytest.pl | 28 -- web_wizard/web.wiz | 379 ----------------- 46 files changed, 47 insertions(+), 7621 deletions(-) delete mode 100644 Wizard.dtd delete mode 100644 client_wizard/client.wiz delete mode 100644 client_wizard/scripts/Clientconf.pm delete mode 100755 client_wizard/scripts/do_it_client.sh delete mode 100644 common/scripts/DrakconnectConf.pm delete mode 100644 common/scripts/IFCFG.pm delete mode 100755 common/scripts/Vareqval.pm delete mode 100644 common/scripts/Varspaceval.pm delete mode 100755 common/scripts/check.sh delete mode 100755 common/scripts/check_root.sh delete mode 100755 common/scripts/functions.sh delete mode 100644 common/scripts/test.pl delete mode 100644 dhcp_wizard/dhcp.wiz delete mode 100644 dhcp_wizard/scripts/Dhcpconf.pm delete mode 100755 dhcp_wizard/scripts/do_it_dhcp.sh delete mode 100644 dns_wizard/dns.wiz delete mode 100644 dns_wizard/scripts/Dnsconf.pm delete mode 100644 ftp_wizard/ftp.wiz delete mode 100644 ftp_wizard/scripts/ProFtpconf.pm delete mode 100644 news_wizard/news.wiz delete mode 100644 news_wizard/scripts/Newsconf.pm delete mode 100644 postfix_wizard/postfix.wiz delete mode 100644 proxy_wizard/proxy.wiz delete mode 100644 proxy_wizard/scripts/Squidconf.pm delete mode 100644 samba_wizard/samba.wiz delete mode 100755 samba_wizard/scripts/Smbconf.pm delete mode 100644 time_wizard/scripts/NTPConf.pm delete mode 100755 time_wizard/scripts/compute_liste.sh delete mode 100644 time_wizard/time.wiz delete mode 100644 web_wizard/apache2.wiz delete mode 100644 web_wizard/scripts/Apache2conf.pm delete mode 100644 web_wizard/scripts/Webconf.pm delete mode 100755 web_wizard/scripts/mytest.pl delete mode 100644 web_wizard/web.wiz diff --git a/Wizard.dtd b/Wizard.dtd deleted file mode 100644 index 4121cdf5..00000000 --- a/Wizard.dtd +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client_wizard/Bind_client.pm b/client_wizard/Bind_client.pm index 9bf84eaa..b7d065a9 100755 --- a/client_wizard/Bind_client.pm +++ b/client_wizard/Bind_client.pm @@ -2,8 +2,10 @@ # Drakwizard -# Copyright (C) 2002 Arnaud Desmons -# 2003 Florent Villard +# Copyright (C) 2002,2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/client_wizard/client.wiz b/client_wizard/client.wiz deleted file mode 100644 index e0695bce..00000000 --- a/client_wizard/client.wiz +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client_wizard/scripts/Clientconf.pm b/client_wizard/scripts/Clientconf.pm deleted file mode 100644 index b148cec8..00000000 --- a/client_wizard/scripts/Clientconf.pm +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package Clientconf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use strict; -use standalone; - -my $o = IFCFG->new(); -my $wiz_domain_name = $o->network_get("DOMAINNAME"); -my $wiz_ip_server = $o->itf_get("IPADDR"); - -sub name { - $o->network_get("HOSTNAME"); -} - -sub ip { - $wiz_ip_server; -} - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -sub get_root { - my $file = "/etc/sysconfig/named"; - if (-f $file) { - my %mdk = Vareqval->get($file); - return $mdk{ROOTDIR}; - } - ""; -} - -sub up_serial { - my ($file) = @_; - - my (undef, undef, undef, $mday, $mon, $year) = gmtime(time); - $year += 1900; - my $serial_nbm = sprintf "%4dY%2dm%2d00", $year, $mon, $mday; - output($file, map { - my $line = $_; - if (/^(\s*)(\d*)(\s*;\s*Serial.*)$/) { - my $serial_f = $2; - $serial_f++; - if ($serial_f <= $serial_nbm) { - $serial_f = $serial_nbm; - chomp($serial_f); - $line = "$1$serial_f$3\n"; - } - } - $line; - } cat_($file)); -} - -sub test { - !$ENV{wiz_client_name} and return 1; - !$ENV{wiz_client_ip} and return 1; - my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $dc = "$4" if $ENV{wiz_client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $sc_trunc = "$1.$2.$3" if $ENV{wiz_client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - !$sc_trunc and return 1; - !$dc and return 1; - !$ds and return 1; - !$s_trunc and return 1; - ($s_trunc != $sc_trunc) and return 1; - ($dc == $ds || $dc < 0 || $dc > 255) and return 1; - 10; -} - -sub do_it { - my $date = `date`; - chomp($date); - my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $dc = "$4" if $ENV{wiz_client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - - my $file="/var/named/$wiz_domain_name.db"; - MDK::Common::cp_af($file, $file.".orig"); - open(NEW, ">> $file") or die "can not open $file"; - print NEW "\n$ENV{wiz_client_name} IN A $ENV{wiz_client_ip} ; $date"; - close(NEW) or die "can not close $file"; - up_serial($file); - - my $file="/var/named/$s_trunc.rev"; - MDK::Common::cp_af($file, $file.".orig"); - open(NEW, ">> $file") or die "can not open $file"; - print NEW "\n$dc IN PTR $ENV{wiz_client_name}. ; $date"; - close(NEW) or die "can not close $file"; - up_serial($file); - system("/etc/rc.d/init.d/named restart"); - 10; -} -1; diff --git a/client_wizard/scripts/do_it_client.sh b/client_wizard/scripts/do_it_client.sh deleted file mode 100755 index 4a2ec587..00000000 --- a/client_wizard/scripts/do_it_client.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -echo_debug "in $0" - -wiz_ip_net=`get_var wiz_ip_net` -wiz_ip_server=`get_var wiz_ip_server` -wiz_domain_name=`get_var wiz_domain_name` -s_trunc=${wiz_ip_net%.*} -ds=${wiz_ip_server##*.} -sc_trunc=${wiz_client_ip%.*} -dc=${wiz_client_ip##*.} - -wiz_client_name=${wiz_client_name%%.*} - -# change serial number -# $1 : file -up_serial(){ -TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 -cat $1 > ${TMPFILE} -serial_nbm=$(date "+%Y%m%d00") -serial_f=`sed -ne "s/^\([[:space:]]*\)\([0-9]*\)\([[:space:]]*;[[:space:]]*Serial.*$\)/\2/p" ${TMPFILE}` -serial_f=$((${serial_f}+1)) -if [ ${serial_f} -le ${serial_nbm} ]; then - serial_f=${serial_nbm} -fi - -cat ${TMPFILE}\ -|sed -e "s/^\([[:space:]]*\)\([0-9]*\)\([[:space:]]*;[[:space:]]*Serial.*$\)/\1${serial_f}\3/"\ -> $1 -rm -f ${TMPFILE} -} - - - -file="/var/named/${wiz_domain_name}.db" - -bck_file ${file} - -echo "${wiz_client_name} IN A ${wiz_client_ip} ; $(date)" >> ${file} - -up_serial ${file} - - - -file="/var/named/${s_trunc}.rev" - -bck_file ${file} - -echo "${dc} IN PTR ${wiz_client_name}. ; $(date)" >> ${file} - -up_serial ${file} - - -/etc/rc.d/init.d/named restart - -# all seems to be ok -exit 10 diff --git a/common/IFCFG.pm b/common/IFCFG.pm index 81b7f0e5..24441494 100644 --- a/common/IFCFG.pm +++ b/common/IFCFG.pm @@ -2,7 +2,9 @@ # Interfaces Conf Parser -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons +# Copyright (C) 2002,2003 Mandrakesoft +# +# Author: Arnaud Desmons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/common/Varspaceval.pm b/common/Varspaceval.pm index fd5500d1..2f087f03 100644 --- a/common/Varspaceval.pm +++ b/common/Varspaceval.pm @@ -1,8 +1,10 @@ #!/usr/bin/perl -w -# Author Philippe Hétroy, phetroy@mandrakesoft.com -# $Id: Varspaceval.pm,v 1.2 2003-08-22 21:29:12 warly Exp $ - +# Copyright (C) 2002,2003 Mandrakesoft +# +# Author: Philippe Hétroy, phetroy@mandrakesoft.com +# +# $Id: Varspaceval.pm,v 1.3 2003-10-20 10:51:59 warly Exp $ # Module for loding and committing informations in a VAR = value file type package MDK::Wizard::Varspaceval; diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm index 6b7c172d..b06838eb 100644 --- a/common/Wizcommon.pm +++ b/common/Wizcommon.pm @@ -1,8 +1,8 @@ #!/usr/bin/perl -# Interfaces Conf Parser - -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2003 Mandrakesoft +# +# Author: Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/common/scripts/DrakconnectConf.pm b/common/scripts/DrakconnectConf.pm deleted file mode 100644 index a1b4fbf8..00000000 --- a/common/scripts/DrakconnectConf.pm +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - -# Drakconnect Conf Parser - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package DrakconnectConf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -use strict; - -my $file = "/etc/sysconfig/network-scripts/drakconnect_conf"; -!-f $file and die "no such $file"; -sub new { - my $self = {}; - - my %mdk = Vareqval->get($file); - $self->{mdk} = \%mdk; - foreach (keys %{$self->{mdk}}) { - if (/.*(Eth\d)Known.*/) { - my $device = $1; - $self->{mdk}{$_} =~ /.*true.*/ and $self->{device} = $device; - } - } - !$self->{device} and return -1; - bless $self; -} - -sub get_device { - my $self = shift; - - $self->{device}; -} - -sub is_dhcp { - my $self = shift; - - $self->get_from_known_dev("BootProto") =~ /.*dhcp.*/; -} - -sub get { - my $self = shift; - my $key = shift; - - exists $self->{mdk}->{$key} or die "no $key field in $file"; - $self->{mdk}->{$key}; -} - -sub get_from_known_dev { - my $self = shift; - my $arg = shift; - - my $device = $self->{device}; - exists $self->{mdk}{$device.$arg} or die "no $arg for $device in $file"; - $self->{mdk}{$device.$arg}; -} - -10; diff --git a/common/scripts/IFCFG.pm b/common/scripts/IFCFG.pm deleted file mode 100644 index e86128d1..00000000 --- a/common/scripts/IFCFG.pm +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl - -# Interfaces Conf Parser - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package IFCFG; -use strict; -use lib qw(/usr/lib/libDrakX); -use Data::Dumper; -use MDK::Common; -use network::network; - -#my $file = "/etc/sysconfig/network-scripts/drakconnect_conf"; -#!-f $file and die "no such $file"; -sub new { - my $self = {}; - - $ENV{PATH} = ""; - my $ifconfig = `LC_ALL=C /sbin/ifconfig -a`; - my $device = 'NONE'; - my @interfaces; - foreach (split('\n', $ifconfig)) { - my ($temp) = /(^eth[0-9]*:?[0-9]*).*/; - $device = $temp if defined $temp; - my ($ip, $bcast, $netmask) = /\s*inet addr:([0-9\.]*)\s*Bcast:([0-9\.]*)\s*Mask:([0-9\.]*).*/; - if (defined $ip && defined $bcast && defined $netmask) { - $self->{itf}{$device} = {IPADDR => $ip, BROADCAST => $bcast, NETMASK => $netmask}; - my %conf = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-$device"); - $self->{itf}{$device}{$_} = $conf{$_} foreach ('BOOTPROTO'); - } - } - %{$self->{network}} = getVarsFromSh("/etc/sysconfig/network"); - my $r = read_resolv_conf(); - foreach my $k (keys %$r) { - $self->{network}{$k} ||= $r->{$k} - } - $self->{network}{HOSTNAME} ||= `/bin/hostname` and chomp $self->{network}{HOSTNAME}; - ($self->{network}{DOMAINNAME}) = $self->{network}{HOSTNAME} =~ /\.(.*)/; - $self->{network}{DOMAINNAME} ||= `/bin/dnsdomainname` and chomp $self->{network}{DOMAINNAME}; - bless $self; -} - -sub is_dhcp { - my $self = shift; - my ($itf) = @_; - - $itf ||= default_itf(); - $self->{itf}{$itf}{BOOTPROTO} eq 'dhcp'; -} - -#- TODO : return the main interface -sub default_itf { - "eth0"; -} - -sub itf_get { - my $self = shift; - my ($key, $itf) = @_; - - $itf ||= default_itf; - exists $self->{itf}{$itf}{$key} or die "no $key field in $itf hash"; - $self->{itf}{$itf}{$key} -} - -sub network_get { - my $self = shift; - my ($key) = @_; - - exists $self->{network}{$key} or die "no $key field in network hash"; - $self->{network}{$key}; -} - -10; diff --git a/common/scripts/Vareqval.pm b/common/scripts/Vareqval.pm deleted file mode 100755 index 110ad4ec..00000000 --- a/common/scripts/Vareqval.pm +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/perl -w - -# Author Philippe Hétroy, phetroy@mandrakesoft.com -# $Id: Vareqval.pm,v 1.3 2002-09-03 15:11:43 adesmons Exp $ - -# Module for loding and committing informations in a VAR = value file type - -package Vareqval; -use lib('./'); -use strict; -use Data::Dumper; - - -# Get all useful content of the config file -# Return a hash containg the key and the value -# ATTENTION : in the conf file, an empty value is returnes as a spaced value (mandatory because of XML compatibility) -sub get { - my $self = shift; - my $file = shift; - my %l; - local *F; open F, $file or return; - local $_; - - while () { - - my ($v, $val, $val2) = - /^\s* # leading space - (\w+)\s*=\s* # variable - ( - "(.*)" # double-quoted text - | '(.*)' # single-quoted text - | [^'"\s]* # normal text - ) - \s*$ # end of line - /x; - no warnings; - next if (!defined $v || $v eq ""); - $l{$v} = defined $val2 ? $val2 : $val; - } - - %l; -} - -# Commits changes in conf files and ifconfig -sub commit { - my $self = shift; - my ($file, $hash) = @_; - local *F; - - my $output = ""; - if (open(F, $file)) { - local $_; - - while () { - my ($pre, $key, $eq, $val, $rest) = /(^\s*)(\w+)(\s*=\s*"*'*)([^'"\s]*)(.*)/x; - - if (!defined $key) { - $output .= $_; - next; - }; - next if (!exists $hash->{$key}); #Elt has been removed - no warnings; - $val = $hash->{$key}; - delete $hash->{$key}; - $output .= defined $val ? $pre . $key . $eq . $val . $rest . "\n" : $pre . $key . $eq . $val . $rest; -# $output .= $pre . $key . $eq . $val . $rest . "\n"; - } - #appending added parameters - foreach (keys %$hash) { - $output .= $_ . "=" . $hash->{$_} . "\n"; - } - - } else { #the file does not exist - print STDERR "File $file will be created\n"; - foreach (keys %$hash) { - $output .= defined $hash->{$_} ? $_ . "=" . $hash->{$_} . "\n" : $_ . "=\n"; - } - } - -#print $output; -#print "\n------------------\n"; - - # outputing the new conf - open(F, "> $file") or return; - print F $output; - close(F); -} - -1; diff --git a/common/scripts/Varspaceval.pm b/common/scripts/Varspaceval.pm deleted file mode 100644 index 7e385d8a..00000000 --- a/common/scripts/Varspaceval.pm +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl -w - -# Author Philippe Hétroy, phetroy@mandrakesoft.com -# $Id: Varspaceval.pm,v 1.1 2002-07-26 09:19:56 adesmons Exp $ - -# Module for loding and committing informations in a VAR = value file type - -package Varspaceval; -use lib('./'); -use strict; -use Data::Dumper; - - -# Get all useful content of the config file -# Return a hash containg the key and the value -# ATTENTION : in the conf file, an empty value is returnes as a spaced value (mandatory because of XML compatibility) -sub get { - my $self = shift; - my $file = shift; - my %l; - local *F; open F, $file or return; - local $_; - - while () { - - my ($v, $val, $val2) = - /^\s* # leading space - (\w+)\s* # variable - ( - "(.*)" # double-quoted text - | '(.*)' # single-quoted text - | [^'"\s]* # normal text - ) - \s*$ # end of line - /x; - no warnings; - $l{$v} = defined $val2 ? $val2 : $val; - } - - %l; -} - -# Commits changes in conf files and ifconfig -sub commit { - my $self = shift; - my ($file, $hash) = @_; - local *F; - - my $output = ""; - if (open(F, $file)) { - local $_; - - while () { - my ($pre, $key, $eq, $val, $rest) = /(^\s*)(\w+)(\s*"*'*)([^'"\s]*)(.*)/x; - - if (!defined $key) { - $output .= $_; - next; - }; - next if (!exists $hash->{$key}); #Elt has been removed - no warnings; - $val = $hash->{$key}; - delete $hash->{$key}; - $output .= defined $val ? $pre . $key . $eq . $val . $rest . "\n" : $pre . $key . $eq . $val . $rest; -# $output .= $pre . $key . $eq . $val . $rest . "\n"; - } - #appending added parameters - foreach (keys %$hash) { - $output .= $_ . " " . $hash->{$_} . "\n"; - } - - } else { #the file does not exist - print STDERR "File $file will be created\n"; - foreach (keys %$hash) { - $output .= defined $hash->{$_} ? $_ . "=" . $hash->{$_} . "\n" : $_ . "=\n"; - } - } - -#print $output; -#print "\n------------------\n"; - - # outputing the new conf - open(F, "> $file") or return; - print F $output; - close(F); -} - -1; diff --git a/common/scripts/check.sh b/common/scripts/check.sh deleted file mode 100755 index 1a96052e..00000000 --- a/common/scripts/check.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -# script for wizard configuration -# -# $1, $2, ... : root wiz_ip_net wiz_... -# -# exit 0 if all is ok, else exit nb , where nb is the arg number that fails - -typeset -i cpt -cpt=0 - -for test in $@ ; do - - cpt=$cpt+1 - - case "$test" in - - root) - if [ ! -z "${_WIZ_DO_AS_ROOT}" ]; then - echo_debug "Emulating Root login , no problem" - else - if [ `id|sed 's/^uid=\([0-9]*\)[^0-9]*.*$/\1/'` -ne 0 ]; then - echo_debug "need to be root, exit $cpt" - exit $cpt - fi - fi - ;; - *) - ret=`get_var ${test}` - if [ -z "$ret" ]; then - echo_debug "no value for $test , exit $cpt" - exit $cpt - fi - ;; - esac - -done - -# all seems to be ok -exit 0 - diff --git a/common/scripts/check_root.sh b/common/scripts/check_root.sh deleted file mode 100755 index 98ae2839..00000000 --- a/common/scripts/check_root.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -# script for wizard basic network configuration -# -# are we root ? - -if [ ! -z "${_WIZ_DO_AS_ROOT}" ]; then - echo_debug "Emulating Root login" - exit 10 -fi - -if [ `id|sed 's/^uid=\([0-9]*\)[^0-9]*.*$/\1/'` -ne 0 ]; then - echo_debug "need to be root" - exit 1 -fi - -file=/etc/sysconfig/system -if [ ! -f ${file} ]; then - echo_debug "no ${file} ... not Mandrake system" - exit 1 -fi - - - - -# all seems to be ok -exit 10 - diff --git a/common/scripts/functions.sh b/common/scripts/functions.sh deleted file mode 100755 index deca8a0a..00000000 --- a/common/scripts/functions.sh +++ /dev/null @@ -1,534 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000,2001 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -# include for a few functions used in various scripts -# -# - this should be loaded at the beginning of every wizard - -# (wiz load it for you) - - -#[ "${wiz_loaded_function}" = "yes" ] && return 0 - - -# assume not multi line values -#(sed -e :a -e '/\\$/N; s/\\\n//; ta') -#debug function -# $1 : message -echo_debug () { -([ -n "${DEBUG_VAL}" ] && echo $1 >> ${DEBUG_VAL})||: -} - - -# back up the specified file -bck_file(){ -# $1 file -fic=$1 -if [ -f ${fic} ]; then - j=3 - for i in 2 1 ; do - [ -f ${fic}.mdk_orig.$i ] && mv -f ${fic}.mdk_orig.$i ${fic}.mdk_orig.$j - j=$i - done - cp -f ${fic} ${fic}.mdk_orig.1 -fi -} - - -rm_val(){ - grep -v -E "^[[:space:]]*$1[[:space:]]*=" -} - - -# retrive a value from config file -get_val(){ -# $1 : config file -# $2 : variable -if [ ! -f "${1}" -o -z "$2" ]; then - return 1 -fi -sed -n "s£^[[:space:]]*$2[[:space:]]*=[[:space:]]*\(.*\)[[:space:]]*$£\1£p" $1 2>/dev/null\ -|sed 's£^\"\(.*\)\"$£\1£' -} - -# retrive a value from config file, other version without "=" -get_val2(){ -# $1 : config file -# $2 : variable -if [ ! -f "${1}" -o -z "$2" ]; then - return 1 -fi -sed -n "s£^[[:space:]]*$2[[:space:]]\+\(.*\)[[:space:]]*$£\1£p" $1 2>/dev/null\ -|sed 's£^\"\(.*\)\"$£\1£' -} - - - -comment_val(){ -sed "s/^[[:space:]]*$1[[:space:]]*=.*$/#&/" -} - - -mod_val(){ -sed -e '\£^[[:space:]]*'"$1"'[[:space:]]*=.*$£{ -i \ -# removed by mdk_serv script on '"$(date)"' -s££#&£ -a \ -'"$1=\"$2\""' -} -' -} - -mod_val2(){ -# same as chg_val, but without "=" symbol neither "" -sed -e '\£^[[:space:]]*'"$1"'[[:space:]]\+.*$£{ -i \ -# removed by mdk_serv script on '"$(date)"' -s££#&£ -a \ -'"$1 $2"' -} -' -} - - -chg_val(){ -# $1 : config file -# $2 : variable -# $3 : new value -# $4 : "s" : silent mode - -[ -f "$1" ] || exit 1 - -#if [ -n "`grep -E \"^\[\[:space:\]\]*$2\[\[:space:\]\]*=\" \"$1\"`" ]; then - -t=`grep -c -E "^[[:space:]]*$2[[:space:]]*=" $1` - -if [ $t -ge 1 ]; then - TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 - cat "$1" > ${TMPFILE} - (cat ${TMPFILE}|mod_val "$2" "$3" > "$1") && rm -f ${TMPFILE} -else - if [ "$4" = "s" ]; then - echo -e "\ -$2=\"$3\"\n\ -" >> "$1" - else - echo -e "\ -# added by mdk_serv script on $(date)\n\ -$2=\"$3\"\n\ -" >> "$1" - fi -fi -} - -chg_val2(){ -# same as chg_val, but without "=" symbol neither "" - -# $1 : config file -# $2 : variable -# $3 : new value -# $4 : "s" : silent mode - -[ -f "$1" ] || exit 1 - -t=`grep -c -E "^[[:space:]]*$2[[:space:]]+" $1` -if [ $t -ge 1 ]; then - TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 - cat "$1" > ${TMPFILE} - (cat ${TMPFILE}|mod_val2 "$2" "$3" > "$1") && rm -f ${TMPFILE} -else - if [ "$4" = "s" ]; then - echo -e "\ -$2 $3\n\ -" >> "$1" - else - echo -e "\ -# added by mdk_serv script on $(date)\n\ -$2 $3\n\ -" >> "$1" - fi -fi -} - - -# get_var $1 : function to retrieve stored value of wiz_variables -# - if $2 is provided, returns $2 (ok, it's a hack) -# - if the stored value is empty, returns the current one (in memory) -# - this function may return a null string if value is really not found - -get_var(){ -# $1 : name of the variable -# $2 : forcing value - -[ -z "$1" ] && return 1 - -if [ -n "$2" ]; then - echo "$2" - return 0 -fi - -file=/etc/sysconfig/mdk_serv - -case "$1" in - wiz_host_name) - t=`get_val ${file} wiz_host_name` - if [ -z "$t" ]; then - echo ${wiz_host_name} - else - echo "$t" - fi - ;; - wiz_domain_name) - t=`get_val ${file} wiz_domain_name` - if [ -z "$t" ]; then - echo ${wiz_domain_name} - else - echo "$t" - fi - ;; - wiz_device) - t=`get_val ${file} wiz_device` - if [ -z "$t" ]; then - echo ${wiz_device} - else - echo "$t" - fi - ;; - wiz_ext_dns1) - t=`get_val ${file} wiz_ext_dns1` - if [ -z "$t" ]; then - echo ${wiz_ext_dns1} - else - echo "$t" - fi - ;; - wiz_ext_dns2) - t=`get_val ${file} wiz_ext_dns2` - if [ -z "$t" ]; then - echo ${wiz_ext_dns2} - else - echo "$t" - fi - ;; - wiz_web_internal) - t=`get_val ${file} wiz_web_internal` - if [ -z "$t" ]; then - echo ${wiz_web_internal} - else - echo "$t" - fi - ;; - wiz_web_external) - t=`get_val ${file} wiz_web_external` - if [ -z "$t" ]; then - echo ${wiz_web_external} - else - echo "$t" - fi - ;; - wiz_ftp_internal) - t=`get_val ${file} wiz_ftp_internal` - if [ -z "$t" ]; then - echo ${wiz_ftp_internal} - else - echo "$t" - fi - ;; - wiz_ftp_external) - t=`get_val ${file} wiz_ftp_external` - if [ -z "$t" ]; then - echo ${wiz_ftp_external} - else - echo "$t" - fi - ;; - wiz_news_freq) - t=`get_val ${file} wiz_news_freq` - if [ -z "$t" ]; then - echo ${wiz_news_freq} - else - echo "$t" - fi - ;; - wiz_news_server) - t=`get_val ${file} wiz_news_server` - if [ -z "$t" ]; then - echo ${wiz_news_server} - else - echo "$t" - fi - ;; - wiz_banner) - t=`get_val ${file} wiz_banner` - if [ -z "$t" ]; then - echo ${wiz_banner} - else - echo "$t" - fi - ;; - wiz_workgroup) - t=`get_val ${file} wiz_workgroup` - if [ -z "$t" ]; then - echo ${wiz_workgroup} - else - echo "$t" - fi - ;; - wiz_do_printer_sharing) - t=`get_val ${file} wiz_do_printer_sharing` - if [ -z "$t" ]; then - echo ${wiz_do_printer_sharing} - else - echo "$t" - fi - ;; - wiz_do_file_sharing) - t=`get_val ${file} wiz_do_file_sharing` - if [ -z "$t" ]; then - echo ${wiz_do_file_sharing} - else - echo "$t" - fi - ;; - wiz_ip_net) - wdevice=`get_val ${file} wiz_device` - nfile="/etc/sysconfig/network-scripts/ifcfg-${wdevice}" - t=`get_val ${nfile} NETWORK` - if [ -z "$t" ]; then - echo ${wiz_ip_net} - else - echo "$t" - fi - ;; - wiz_ip_netmask) - wdevice=`get_val ${file} wiz_device` - nfile="/etc/sysconfig/network-scripts/ifcfg-${wdevice}" - t=`get_val ${nfile} NETMASK` - if [ -z "$t" ]; then - echo ${wiz_ip_netmask} - else - echo "$t" - fi - ;; - wiz_ip_server) - wdevice=`get_val ${file} wiz_device` - nfile="/etc/sysconfig/network-scripts/ifcfg-${wdevice}" - t=`get_val ${nfile} IPADDR` - if [ -z "$t" ]; then - echo ${wiz_ip_server} - else - echo "$t" - fi - ;; - wiz_ip_range1) - wdevice=`get_val ${file} wiz_device` - nfile="/etc/sysconfig/network-scripts/ifcfg-${wdevice}" - twnet=`get_val ${nfile} NETWORK` - nfile=/etc/dhcpd.conf - rnge= - if [ -f ${nfile} ]; then - rnge=`sed -n -e 's/^[[:space:]]*range[[:space:]]*\([1-9\.]*\)[[:space:]].*$/\1/p' ${nfile}` - fi - [ "${rnge%.*}" == "${twnet%.*}" ] || rnge="" - if [ -z "$rnge" ]; then - echo ${wiz_ip_range1} - else - echo "$rnge" - fi - ;; - wiz_ip_range2) - wdevice=`get_val ${file} wiz_device` - nfile="/etc/sysconfig/network-scripts/ifcfg-${wdevice}" - twnet=`get_val ${nfile} NETWORK` - nfile=/etc/dhcpd.conf - rnge= - if [ -f ${nfile} ]; then - rnge=`sed -n -e 's/^[[:space:]]*range[[:space:]]*[1-9\.]*[[:space:]]*\([1-9\.]*\)[^1-9\.].*$/\1/p' ${nfile}` - fi - [ "${rnge%.*}" == "${twnet%.*}" ] || rnge="" - if [ -z "$rnge" ]; then - echo ${wiz_ip_range2} - else - echo "$rnge" - fi - ;; - wiz_ext_device) - t=`get_val ${file} wiz_ext_device` - if [ -z "$t" ]; then - echo ${wiz_ext_device} - else - echo "$t" - fi - ;; - wiz_extn_device) - t=`get_val /etc/sysconfig/network GATEWAYDEV` - if [ -z "$t" ]; then - echo ${wiz_extn_device} - else - echo "$t" - fi - ;; - wiz_extn_gateway) - t=`get_val /etc/sysconfig/network GATEWAY` - if [ -z "$t" ]; then - echo ${wiz_extn_gateway} - else - echo "$t" - fi - ;; - wiz_firewall_level) - t=`get_val ${file} wiz_firewall_level` - if [ -z "$t" ]; then - echo ${wiz_firewall_level} - else - echo "$t" - fi - ;; - wiz_ext_mail_relay) - postconf -h relayhost - ;; - wiz_mail_masquerade) - nfile=/etc/postfix/canonical - wdname=`get_val ${file} wiz_domain_name` - t="" - if [ -f ${nfile} ]; then - t=`sed -n -e 's/^[[:space:]]*@'"${wdname}"'[[:space:]]*@\([^[:space:]]*\)[[:space:]]*$/\1/p' ${nfile}` - fi - if [ -z "$t" -o -z "wdname" ]; then - echo ${wiz_mail_masquerade} - else - echo "$t" - fi - ;; - wiz_timezone) - nfile=/etc/sysconfig/clock - t=`get_val ${nfile} ZONE` - if [ -z "$t" ]; then - echo ${wiz_timezone} - else - echo "$t" - fi - ;; - wiz_squid_port) - nfile=/etc/squid/squid.conf - t=`get_val2 ${nfile} http_port` - if [ -z "$t" ]; then - echo ${wiz_squid_port} - else - echo "$t" - fi - ;; - wiz_squid_mem) - nfile=/etc/squid/squid.conf - t=`get_val2 ${nfile} cache_mem` - if [ -z "$t" ]; then - echo ${wiz_squid_mem} - else - t1=`echo $t|awk '{print $1}'` - t2=`echo $t|awk '{print $2}'` - if [ "$t2" == "MB" ]; then - echo $t1 - else - echo ${wiz_squid_mem} - fi - fi - ;; - wiz_squid_disk) - nfile=/etc/squid/squid.conf - # nota : only one dir : wiz_squid_defdir - export wiz_squid_defdir=`get_var wiz_squid_defdir` - t=`sed -n "s£^[[:space:]]*cache_dir[[:space:]]\+[a-z]\+[[:space:]]\+$wiz_squid_defdir[[:space:]]\+\([0-9]\+\)[[:space:]]*.*$£\1£p" $nfile 2>/dev/null` - if [ -z "$t" ]; then - echo ${wiz_squid_disk} - else - echo $t - fi - ;; - wiz_squid_level) - t=`get_val ${file} wiz_squid_level` - if [ -z "$t" ]; then - echo ${wiz_squid_level} - else - echo "$t" - fi - ;; - wiz_squid_defdir) - t=`get_val ${file} wiz_squid_defdir` - if [ -z "$t" ]; then - [ -z "${wiz_squid_defdir}" ] && wiz_squid_defdir="/var/spool/squid" - echo ${wiz_squid_defdir} - else - echo "$t" - fi - ;; - wiz_squid_mynetw) - nfile=/etc/squid/squid.conf - t=`get_val2 ${nfile} "acl mynetwork src"` - if [ -z "$t" ]; then - echo `get_var wiz_ip_net`"/"`get_var wiz_ip_netmask` - else - echo $t - fi - ;; - wiz_squid_cachepeer) - nfile=/etc/squid/squid.conf - t=`get_val2 ${nfile} "cache_peer"` - if [ -z "$t" ]; then - echo ${wiz_squid_cachepeer} - else - echo $t|awk '{print $1}' - fi - ;; - wiz_squid_peerport) - nfile=/etc/squid/squid.conf - t=`get_val2 ${nfile} "cache_peer"` - if [ -z "$t" ]; then - echo ${wiz_squid_peerport} - else - echo $t|awk '{print $3}' - fi - ;; - - *) - return 1 - ;; -esac -} - - - - -export -f echo_debug -export -f rm_val -export -f get_val -export -f get_val2 -export -f mod_val -export -f mod_val2 -export -f chg_val -export -f chg_val2 -export -f bck_file - -export -f get_var -#export wiz_loaded_function=yes diff --git a/common/scripts/test.pl b/common/scripts/test.pl deleted file mode 100644 index 5fbba3cb..00000000 --- a/common/scripts/test.pl +++ /dev/null @@ -1,12 +0,0 @@ -use lib qw(/usr/lib/libDrakX); -package Dhcpconf; -require "IFCFG.pm"; -#require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; -use MDK::Common; -use strict; -use standalone; - -my $o = IFCFG->new(); -print $o->is_dhcp() ? "toto\n" : "tata\n"; -print $o->itf_get("IPADDR"); -print $o->network_get("DOMAINNAME"); diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index b38ba025..3bb73ef1 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -2,8 +2,10 @@ # Drakwizard -# Copyright (C) 2002 Arnaud Desmons -# 2003 Florent Villard +# Copyright (C) 2002, 2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,7 +39,8 @@ my $o = { var => { ip1 => '', ip2 => '', - interface => $wiz->{net}->default_itf() + wiz_authoritative => 0, + einterface => $wiz->{net}->default_itf() }, needed_rpm => [ 'dhcp-server' ], defaultimage => "$ENV{__WIZ_HOME__}dhcp_wizard/images/DHCP.png" @@ -217,7 +220,7 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w $mdk{interfaces} = $wiz_device; standalone::explanations("$file: lease_file = $mdk{lease_file}, interfaces = $mdk{interfaces}"); MDK::Wizard::Varspaceval->commit($file, \%mdk); - !$ENV{wiz_authoritative} and output($file, map { + !$o-{var}{wiz_authoritative} and output($file, map { s|^\s*not\s*authoritative.*|\#$&|i; $_ } cat_ ("/etc/dhcpd.conf")); diff --git a/dhcp_wizard/dhcp.wiz b/dhcp_wizard/dhcp.wiz deleted file mode 100644 index 93164559..00000000 --- a/dhcp_wizard/dhcp.wiz +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm deleted file mode 100644 index e75cd855..00000000 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/perl - -# DHCP Conf Parser - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package Dhcpconf; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -#require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; -use MDK::Common; -use strict; -use standalone; - -my $o = IFCFG->new(); -my $wiz_ip_server = $o->itf_get("IPADDR"); -my $d = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; -my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - -sub compute_range { - my $n; - if ($d <= 64) { $n = "65" } - elsif ($d <= 128) { $n = "129" } - else { $n = "1"} - "$s.$n"; -} - -sub compute_range2 { - my $n; - if ($d <= 128) { $n = "254" } - elsif ($d > 192) { $n = "192" } - else { $n = "128"} - "$s.$n"; -} - -sub check { -# FIXME : see check_range.sh - my $r1_trunc = "$1.$2.$3" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $r2_trunc = "$1.$2.$3" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $d1 = "$4" if $ENV{wiz_ip_range1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $d2 = "$4" if $ENV{wiz_ip_range2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - if (!$r1_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 1"); return 1} - if (!$r2_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 2"); return 1} - if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { - standalone::explanations("DHCP wizard : range not in network"); - return 2; - } - if (!$d1 || !$d2 || $d1 > $d2) { standalone::explanations("DHCP wizard : bad range"); return 1} - if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 3} - 10; -} - -sub check_dhcp { - $o->is_dhcp() and return 1; - 0; -} - -sub do_it { - my $wiz_domain_name = $o->network_get("DOMAINNAME"); - my $wiz_host_name = $o->network_get("HOSTNAME"); - my $wiz_gateway = $o->network_get("GATEWAY"); - my $wiz_dns = $o->network_get("dnsServer"); - if ($wiz_dns eq '127.0.0.1') { - $wiz_dns = $wiz_ip_server - } - if (!$wiz_gateway) { - my $t = `LC_ALL=C /sbin/ip route list scope global`; - ($wiz_gateway) = $t =~ /default via (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) dev/; - } - my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $err = check(); - return $err if $err != 10; - my $wiz_ip_range1 = $ENV{wiz_ip_range1}; - my $wiz_ip_range2 = $ENV{wiz_ip_range2}; - my $wiz_ip_netmask = $o->itf_get("NETMASK"); - my $wiz_device = $o->default_itf(); -# patch to rewrite when got new file about dhcp with INTERFACES value -# currently, I put the device to configure as dhcp server -# in /etc/sysconfig/dhcpd - -#[ -f /etc/sysconfig/dhcpd ] && cp -f /etc/sysconfig/dhcpd /var/tmp/wiz_bck/orig/dhcpd - my $file = "/etc/sysconfig/dhcpd"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - - $file = "/etc/rc.d/init.d/dhcpd"; -# now patching etc/rc.d/init.d/dhcpd - standalone::explanations("now patching etc/rc.d/init.d/dhcpd"); - if (!`grep INTERFACES $file`){ - MDK::Common::append_to_file($file, "\nINTERFACES=$wiz_device"); - MDK::Common::cp_af($file, $file . ".orig"); - my $tmp = `/bin/mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!"; - open(NEW, "> $tmp") or die "can't open $tmp: $!"; - open(OLD, "< $file") or die "can't open default: $!"; - while () { - if (m|daemon\s*/usr/sbin/dhcp|) { - print NEW "\tif [ -f /etc/sysconfig/dhcpd ]; then -\t\t. /etc/sysconfig/dhcpd -\t\tDEV=\$INTERFACES -\tfi\n"; - } - print NEW $_; - } - close(OLD); - close(NEW); - chomp($tmp); - system("mv $tmp $file"); - } - $file = "/etc/dhcpd.conf"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - output($file, map { - s|__hname__|$wiz_host_name|g; - s|__dns__|$wiz_dns|g; - s|__net__|$wiz_ip_net|g; - s|__ip__|$wiz_ip_server|g; - s|__mask__|$wiz_ip_netmask|g; - s|__rng1__|$wiz_ip_range1|g; - s|__rng2__|$wiz_ip_range2|g; - s|__dname__|$wiz_domain_name|g; - s|__gateway__|$wiz_gateway|g; - $_; - } cat_ ("__WIZ_HOME__/dhcp_wizard/scripts/dhcpd.conf.default")); - standalone::explanations("$file: hname = $wiz_host_name, net = $wiz_ip_net, ip = $wiz_ip_server, -mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $wiz_domain_name"); - MDK::Common::touch("/var/dhcpd/dhcpd.leases"); -# modifying webmin config - $file="/etc/webmin/dhcpd/config"; - if (-f $file) { - my %mdk = Vareqval->get($file); - $mdk{lease_file} = "/var/dhcpd/dhcpd.leases"; - $mdk{interfaces} = $wiz_device; - standalone::explanations("$file: lease_file = $mdk{lease_file}, interfaces = $mdk{interfaces}"); - Vareqval->commit($file, \%mdk); - !$ENV{wiz_authoritative} and output($file, map { - s|^\s*not\s*authoritative.*|\#$&|i; - $_ - } cat_ ("/etc/dhcpd.conf")); - } - - system("/etc/rc.d/init.d/dhcpd restart"); - 10; -} -1; - diff --git a/dhcp_wizard/scripts/do_it_dhcp.sh b/dhcp_wizard/scripts/do_it_dhcp.sh deleted file mode 100755 index 5141b8c0..00000000 --- a/dhcp_wizard/scripts/do_it_dhcp.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -# script for wizard network configuration -# -# install default dhcpd configuration for dhcp server -# assuming all dependencies are ok - -echo_debug "in $0" - -cfg_file=/etc/sysconfig/mdk_serv -# loading var -wiz_device=`get_var wiz_device` -echo_debug "wiz_device=$wiz_device" -wiz_host_name=`get_var wiz_host_name` -echo_debug "wiz_host_name=$wiz_host_name" -wiz_ip_net=`get_var wiz_ip_net` -echo_debug "wiz_ip_net=$wiz_ip_net" -wiz_ip_netmask=`get_var wiz_ip_netmask` -echo_debug "wiz_ip_netmask=$wiz_ip_netmask" -wiz_domain_name=`get_var wiz_domain_name` -echo_debug "wiz_domain_name=$wiz_domain_name" -wiz_ip_server=`get_var wiz_ip_server` -echo_debug "=wiz_ip_server=$wiz_ip_server" - -echo_debug "wiz_ip_range1 is $wiz_ip_range1" -echo_debug "wiz_ip_range2 is $wiz_ip_range2" -chg_val ${cfg_file} wiz_ip_range1 "${wiz_ip_range1}" s -chg_val ${cfg_file} wiz_ip_range2 "${wiz_ip_range2}" s - -# patch to rewrite when got new file about dhcp with INTERFACES value -# currently, I put the device to configure as dhcp server -# in /etc/sysconfig/dhcpd - -# ok, the new init.d/dhcp is not as wanted, still need a patch - -#[ -f /etc/sysconfig/dhcpd ] && cp -f /etc/sysconfig/dhcpd /var/tmp/wiz_bck/orig/dhcpd -bck_file /etc/sysconfig/dhcpd -echo "INTERFACES=${wiz_device}" > /etc/sysconfig/dhcpd - -# ok, the new init.d/dhcp is not as wanted, still need a patch -# now patching /etc/rc.d/init.d/dhcpd if needed - -if [ -z "`grep INTERFACES /etc/rc.d/init.d/dhcpd`" ]; then - echo_debug "now patching etc/rc.d/init.d/dhcpd" - bck_file /etc/rc.d/init.d/dhcpd - cat /etc/rc.d/init.d/dhcpd.mdk_orig.1 \ -|sed -e '/daemon \/usr\/sbin\/dhcpd/{ -i \ - if [ -f /etc/sysconfig/dhcpd ]; then\ - . /etc/sysconfig/dhcpd\ - DEV=$INTERFACES\ - fi - }' > /etc/rc.d/init.d/dhcpd - -#old version patch /etc/rc.d/init.d/dhcpd < ${CWD}/scripts/dhcpd.patch - -fi - - -# dhcpd.conf - -bck_file /etc/dhcpd.conf - -echo_debug "now putting dhcpd config file" - -cat ${CWD}/scripts/dhcpd.conf.default \ -|sed "s|__hname__|${wiz_host_name}|g" \ -|sed "s|__net__|${wiz_ip_net}|g" \ -|sed "s|__ip__|${wiz_ip_server}|g" \ -|sed "s|__mask__|${wiz_ip_netmask}|g" \ -|sed "s|__rng1__|${wiz_ip_range1}|g" \ -|sed "s|__rng2__|${wiz_ip_range2}|g" \ -|sed "s|__dname__|${wiz_domain_name}|g" \ -> /etc/dhcpd.conf - -touch /var/dhcpd/dhcpd.leases - - -# modifying webmin config - -echo_debug "modifying webmin config" - -file="/etc/webmin/dhcpd/config" -if [ -f ${file} ]; then - chg_val ${file} lease_file "/var/dhcpd/dhcpd.leases" - chg_val ${file} interfaces "${wiz_device}" -fi - - -# this part of script to be played at the very end - -echo_debug "restarting services" - -/etc/rc.d/init.d/dhcpd restart - - -# all is ok -exit 10 - - - diff --git a/dns_wizard/dns.wiz b/dns_wizard/dns.wiz deleted file mode 100644 index b4a0b3ef..00000000 --- a/dns_wizard/dns.wiz +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dns_wizard/scripts/Dnsconf.pm b/dns_wizard/scripts/Dnsconf.pm deleted file mode 100644 index 4b8b66b0..00000000 --- a/dns_wizard/scripts/Dnsconf.pm +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/perl - -# DNS Config Parser - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package Dnsconf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use strict; -use standalone; - -my $o = IFCFG->new(); - -my $dns1; -my $dns2; - -sub get_root { - my $file = "/etc/sysconfig/named"; - if (-f $file) { - my %mdk = Vareqval->get($file); - return $mdk{ROOTDIR}; - } - ""; -} - -my $file = "/etc/named.conf"; -if (-f $file) { - open (NEW, "< $file"); - DNS : while () { - $dns2 = ""; - if (m/^\s*options\s*\{/s...m/^\s*\}\;/s ) { - if (m/^\s*forwarders\s*\{/s...m/^\s*\}\;/s ) { - if (/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { - $dns2 = "$1.$2.$3.$4"; - $dns1 and next DNS; - $dns1 = $dns2; - } - } - } - } - close (NEW); -} - -sub get_dns1 { - $dns1; -} - -sub get_dns2 { - $dns2; -} - -sub up_serial { - my ($file) = @_; - - my (undef, undef, undef, $mday, $mon, $year) = gmtime(time); - $year += 1900; - my $serial_nbm = sprintf "%4dY%2dm%2d00", $year, $mon, $mday; - output($file, map { - my $line = $_; - if (/^(\s*)(\d*)(\s*;\s*Serial.*)$/) { - my $serial_f = $2; - $serial_f++; - if ($serial_f <= $serial_nbm) { - $serial_f = $serial_nbm; - chomp($serial_f); - $line = "$1$serial_f$3\n"; - } - } - $line; - } cat_($file)); -} - -sub do_it { - my $wiz_ip_server = $o->itf_get("IPADDR"); - my $wiz_domain_name = $o->network_get("DOMAINNAME"); - my $wiz_host_name = $o->network_get("HOSTNAME"); - my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $host = "$1" if $wiz_host_name =~ /(.*?)\..*/; - my $reversnet = "$3$2$1" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $file = "/etc/host.conf"; - - MDK::Common::cp_af($file, $file.".orig"); - MDK::Common::cp_af("__WIZ_HOME__/dns_wizard/scripts/host.conf.default", $file); - - $file = "/etc/named.conf"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - - my $ispns1 = $ENV{wiz_ext_dns1} || "// __ISPN1__"; - my $ispns2 = $ENV{wiz_ext_dns2} || "// __ISPN2__"; - - output($file, map { - s|__ISPNS1__|$ispns1|g; - s|__ISPNS2__|$ispns2|g; - s|__dname__|$wiz_domain_name|g; - s|__revnet__|$reversnet|g; - s|__net__|$s_trunc|g; - $_; - } cat_("__WIZ_HOME__/dns_wizard/scripts/named.conf.default")); - - standalone::explanations("$file : DNS1: $ispns1 DNS2: $ispns2"); -# Bug fix for bind 9: - if (! -f "/etc/rndc.key") { system("touch /etc/rndc.key") or die "can not touch /etc/rndc.key"}; - -# root.hints - $file="/var/named/root.hints"; - -f $file and MDK::Common::cp_af($file, $file . ".orig"); - MDK::Common::cp_af("__WIZ_HOME__/dns_wizard/scripts/root.hints.default", $file); - standalone::explanations("$file clobbered"); -# 127.0.0.rev - $file="/var/named/127.0.0.rev"; - -f $file and MDK::Common::cp_af($file, $file . ".orig"); - output($file, map { - s|__hname__|$wiz_host_name|g; - $_; - } cat_("__WIZ_HOME__/dns_wizard/scripts/127.0.0.rev.default")); - standalone::explanations("$file : hostname: $wiz_host_name"); - up_serial($file); - -# $ipnet.rev - $file = "/var/named/$s_trunc.rev"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - output($file, map { - s|__dname__|$wiz_domain_name|g; - s|__hname__|$wiz_host_name|g; - s|__revnet__|$reversnet|g; - s|__nb__|$ds|g; - $_; - } cat_("__WIZ_HOME__/dns_wizard/scripts/ipnet.rev.default")); - up_serial($file); - standalone::explanations("$file : domain: $wiz_domain_name hostname: $wiz_host_name revnet: $reversnet -nb: $ds"); -# $domain.db - $file = "/var/named/$wiz_domain_name.db"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - output($file, map { - s|__dname__|$wiz_domain_name|g; - s|__hname__|$wiz_host_name|g; - s|__ip__|$wiz_ip_server|g; - s|__host__|$host|g; - s|__nb__|$ds|g; - $_; - } cat_("__WIZ_HOME__/dns_wizard/scripts/domain.db.default")); - up_serial($file); - standalone::explanations("$file : domain: $wiz_domain_name hostname: $wiz_host_name revnet: $reversnet -nb: $ds"); -# resolv.conf - $file = "/etc/resolv.conf"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - open(NEW, "> $file"); - print NEW "domain $wiz_domain_name\n"; - print NEW "nameserver $wiz_ip_server\n"; - standalone::explanations("$file : domain: $wiz_domain_name nameserver: $wiz_ip_server"); - system("/sbin/chkconfig --level 235 named on"); - system("/etc/rc.d/init.d/named restart"); - 10; -} -1; diff --git a/drakwizard.pl b/drakwizard.pl index 093a39bf..69f9220a 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -2,7 +2,9 @@ # Drakwizard -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2003 Mandrakesoft +# +# Author: Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm index 45247a33..c4bb6b0c 100755 --- a/ftp_wizard/Proftpd.pm +++ b/ftp_wizard/Proftpd.pm @@ -2,7 +2,9 @@ # Drakwizard -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2003 Mandrakesoft +# +# Author: Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/ftp_wizard/ftp.wiz b/ftp_wizard/ftp.wiz deleted file mode 100644 index 5c7a055c..00000000 --- a/ftp_wizard/ftp.wiz +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ftp_wizard/scripts/ProFtpconf.pm b/ftp_wizard/scripts/ProFtpconf.pm deleted file mode 100644 index 854245cc..00000000 --- a/ftp_wizard/scripts/ProFtpconf.pm +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package ProFtpconf; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use strict; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; - -sub true { - my ($val) = @_; - - $val eq "1" || $val eq "\'1\'" || $val eq "\"1\"" || - $val eq "true" || $val eq "\'true\'" || $val eq "\"true\"" and - return 1; - 0; -} - -sub check_dir { - -d $ENV{wiz_dir} and return 10; - 1; -} - -sub get_dir { - my $file = "/etc/proftpd.conf"; - die "no ftp configuration file found ! warning." if (!-f $file); - open(NEW, "< $file") or die "error while opening $file: $!"; - - while () { # we need 3 elements to consider section as known - if (m/^\s*/s...m/^\s*<\/drakwizard>/s ) { - if (m/^\s*/s ) { - return $1; - } - } - } - return ""; -} - -my $o = IFCFG->new(); - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -sub print_anonymous() { - print ' -# - - User ftp - Group ftp - UserAlias anonymous ftp - MaxClients 10 - - DenyAll - - -# -'; -} - -sub do_it { - my $wiz_ftp_internal = $ENV{wiz_ftp_external} ? 1 : true $ENV{wiz_ftp_internal}; - my $wiz_ftp_external = true $ENV{wiz_ftp_external}; - my $file = "/etc/proftpd.conf"; - die "no ftp configuration file found ! warning." if (!-f $file); - MDK::Common::cp_af($file, $file . ".orig"); - open(NEW, "< $file") or die "error while opening $file: $!"; - my $allow = "all"; - if ($wiz_ftp_internal && !$wiz_ftp_external) { - ($allow) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; - $allow .= " 127.0.0.1"; - } - elsif (!$wiz_ftp_external) { - $allow = "none"; - } - my $file = "/etc/proftpd.conf"; - open (NEW, "< $file"); - my $exist = 0; - while () { # we need 3 elements to consider section as known - if (m/^\s*/s...m/^\s*<\/Global>/s ) { - if (m/^\s*/s...m/^\s*<\/Limit>/s ) { - if (/^\s*(?!\#)\s*Order .*$/) { - $exist++; - } - if (/^\s*(?!\#)\s*Allow .*$/) { - $exist++; - } - if (/^\s*(?!\#)\s*Deny .*$/) { - $exist++; - } - } - } - } - close (NEW); - if ($exist < 3) { # Odd parameters are commented if exists to then add a known section - substInFile { - if (m/^\s*/s...m/^\s*<\/Global>/s ) { - if (m/^\s*/s...m/^\s*<\/Limit>/s ) { - s/^\s*(?!\#)\s*Order .*$/\#$&\n/s; - s/^\s*(?!\#)\s*Allow .*$/\#$&\n/s; - s/^\s*(?!\#)\s*Deny .*$/\#$&\n/s; - } - } - } $file; - open (NEW, ">> $file"); - print NEW ' -# - - - Order allow,deny - Allow from '.$allow.' - Deny from all - - -#'; - close NEW; - } - else { # the known section (3 parameters ) is replaced with our needs - substInFile { - if (m/^\s*/s...m/^\s*<\/Global>/s ) { - if (m/^\s*/s...m/^\s*<\/Limit>/s ) { - if (/^\s*(?!\#)\s*Order .*$/i) { - if (!/\s*Order\s*allow,\s*deny\s*$/) { - s//\#$&\n Order allow,deny\n/; - } - } - if (/^\s*(?!\#)\s*Allow .*$/i) { - if (!/\s*Allow\s*from\s*$allow\s*$/) { - s//\#$&\n Allow from $allow/; - } - } - if (/^\s*(?!\#)\s*Deny .*$/i) { - if (!/\s*Deny\s*from\s*all\s*$/) { - s//\#$&\n Deny from all\n/; - } - } - } - } - } $file; - } - system("/etc/rc.d/init.d/proftpd restart"); - 10; -} -1; diff --git a/news_wizard/Inn.pm b/news_wizard/Inn.pm index 92779f1d..76ebf4e3 100755 --- a/news_wizard/Inn.pm +++ b/news_wizard/Inn.pm @@ -2,7 +2,9 @@ # Drakwizard -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2003 Mandrakesoft +# +# Author: Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/news_wizard/news.wiz b/news_wizard/news.wiz deleted file mode 100644 index 1a56faf2..00000000 --- a/news_wizard/news.wiz +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/news_wizard/scripts/Newsconf.pm b/news_wizard/scripts/Newsconf.pm deleted file mode 100644 index 10b6bfa6..00000000 --- a/news_wizard/scripts/Newsconf.pm +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -package Newsconf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -use MDK::Common; -use strict; - -sub normalize_freq { - my ($freq) = @_; - - if ($freq =~ /(\d*)/) { - $freq = $1; - } - if ($freq <= 0) { - $freq = 0; - } - if ($freq >= 24) { - $freq = 24; - } - $freq; -} - -sub get_server { - my %mdk = Vareqval->get("/etc/leafnode/config"); - $mdk{server}; -} - -sub normalize_server { - my ($server) = @_; - - $server; -} - -sub do_it { - $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"; - output($file, map { - s|__server__|$server|g; - $_; - } cat_("__WIZ_HOME__/news_wizard/scripts/config.default")); - $file = "/var/spool/cron/news"; - my $file_c = "/etc/leafnode/crontab"; - if (-f $file) { - MDK::Common::cp_af($file, $file_c); - MDK::Common::cp_af($file, $file . ".orig"); - } - output($file_c, map { - s|__freq__|$freq|g; - $_; - } cat_("__WIZ_HOME__/news_wizard/scripts/news.cron")); - system("crontab -u news /etc/leafnode/crontab"); - 10; -} - -1; diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 980bc5ee..c5f28f3d 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -2,8 +2,10 @@ # Drakwizard -# Copyright (C) 2002 Arnaud Desmons -# 2003 Florent Villard +# Copyright (C) 2002, 2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/postfix_wizard/postfix.wiz b/postfix_wizard/postfix.wiz deleted file mode 100644 index 45954c12..00000000 --- a/postfix_wizard/postfix.wiz +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm index 89f4cee6..f7287e49 100755 --- a/proxy_wizard/Squid.pm +++ b/proxy_wizard/Squid.pm @@ -2,8 +2,10 @@ # Drakwizard -# Copyright (C) 2002 Arnaud Desmons -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2002,2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/proxy_wizard/proxy.wiz b/proxy_wizard/proxy.wiz deleted file mode 100644 index d4f61e4a..00000000 --- a/proxy_wizard/proxy.wiz +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/proxy_wizard/scripts/Squidconf.pm b/proxy_wizard/scripts/Squidconf.pm deleted file mode 100644 index 56548652..00000000 --- a/proxy_wizard/scripts/Squidconf.pm +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -package Squidconf; -use lib '/usr/lib/libDrakX'; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -require "__WIZ_HOME__/common/scripts/Varspaceval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use services; -use strict; -use standalone; - -sub network_mask { - my $o = IFCFG->new(); - my $wiz_ip_server = $o->itf_get("IPADDR"); - my $mask = $o->itf_get("NETMASK"); - "$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; -} - -sub testport { - if ($ENV{wiz_squid_port} == 3128 || $ENV{wiz_squid_port} == 8080) { - return 0; - } - elsif ($ENV{wiz_squid_port} <= 1024 || $ENV{wiz_squid_port} >= 65536) { - return 2; - } - 1; -} - -sub port { - my $ret; - my @lines = grep(/$ENV{wiz_squid_port}\/tcp/, cat_("/etc/services")); - foreach (@lines) { - s/\t/ /g; - $ret .= "\n$_"; - } - $ret; -} - -sub do_it_squid { - my $file="/etc/squid/squid.conf"; - -f $file and MDK::Common::cp_af($file, $file.".orig"); - MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file); - substInFile { - s|^\s*\#?\s*(cache_dir.*$ENV{wiz_squid_defdir}\s*)\d*(.*)|$1$ENV{wiz_squid_disk}$2|; - s|^\s*\#?\s*(acl\s*mynetwork\s*src\s*).*$|$1$ENV{wiz_squid_mynetw}\n|; - s|^\s*\#?\s*(cache_mem\s*)\d*(\s*MB.*)|$1$ENV{wiz_squid_mem}$2|; - s|^\s*\#?\s*(http_port\s*)\d*(.*)|$1$ENV{wiz_squid_port}$2|; - } $file; - print "LEVEL $ENV{'wiz_squid_level'}\n\n"; - exit; - standalone::explanations("$file: cache_dir = $ENV{wiz_squid_defdir} $ENV{wiz_squid_disk} -mynetw = $ENV{wiz_squid_mynetw} cache_mem = $ENV{wiz_squid_mem} http_port = $ENV{wiz_squid_port} -level = $ENV{wiz_squid_level}"); - if ($ENV{wiz_squid_level} == 1) { - substInFile { - s|^\s*\#?\s*(http_access\s*)deny(\s*all.*)|\#$&\n$1allow$2|; - } $file; - } - elsif ($ENV{wiz_squid_level} == 2) { - substInFile { - s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|; - s|^\s*\#?\s*(http_access\s*allow\s*)localhost|\#$&\n$1mynetwork|; - } $file; - } - elsif ($ENV{wiz_squid_level} == 3) { - substInFile { - s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|; - s|^\s*\#?\s*(http_access\s*allow\s*)mynetwork|\#$&\n$1localhost|; - } $file; - } else { # should not happen - die "wiz_squid_level error"; - } - my $t = 0; - foreach (cat_($file)) { - if (/^\s*cache_peer.*/) { - $t = $_;; - last; - } - } - if ($ENV{wiz_squid_menupeer} == 1 && length $t) { - substInFile { - s|^\s*!\#\s*(cache_peer.*)|\#$&|; - } $file; - } - elsif ($ENV{wiz_squid_menupeer} == 2 && length $ENV{wiz_squid_cachepeer}) { - if (lenght $t) { - substInFile { - s|^\s*\#?\s*(cache_peer.*)|\#$&|; - } $file; - } - append_to_file($file, "cache_peer $ENV{wiz_squid_cachepeer} parent $ENV{wiz_squid_peerport} 3130"); - } - system("/sbin/chkconfig --level 345 squid on"); - if (services::is_service_running('squid')) { - services::restart('squid') - } else { - services::start('squid') - } - 10; -} -1; diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index ffd79c3f..b2c2f3e2 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -1,9 +1,10 @@ #!/usr/bin/perl # Drakwizard - -# Copyright (C) 2002 Arnaud Desmons -# Copyright (C) 2003 Florent Villard +# Copyright (C) 2002,2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/samba_wizard/samba.wiz b/samba_wizard/samba.wiz deleted file mode 100644 index b802677c..00000000 --- a/samba_wizard/samba.wiz +++ /dev/null @@ -1,778 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samba_wizard/scripts/Smbconf.pm b/samba_wizard/scripts/Smbconf.pm deleted file mode 100755 index 253b9c0c..00000000 --- a/samba_wizard/scripts/Smbconf.pm +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package Smbconf; -use lib '/usr/lib/libDrakX'; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use strict; -use services; -use Data::Dumper; - -# All possibilies in the config file must be precedeed by ";" -# This script can just comment, uncomment or/and change values -# but can not add anything. -# so one variable cannot be commented and not in the same file. - -my $o = IFCFG->new(); - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -sub check_services { - $ENV{wiz_do_homes} and return 3; - $ENV{wiz_do_file_sharing} and return 2; - $ENV{wiz_do_printer_sharing} and return 1; - 0; -} - -sub check_dir { - -d ($ENV{wiz_dir}) and return 10; - 1; -} - -# the "__" before comment is to avoid conflicts with possible "comment" variable -# for variables value is in value key and comment idem (no risque of conflict) - -sub read_conf { - my $self = {}; - my ($file) = @_; - my $menu; - my @tab; - my %conf; - - open(FH, $file) or die "$! ($file)"; - while () { - if (/^(\s*\;?\s*)\[(.*)\].*/) { - $menu = $2; - $conf{$menu}{__comment} = $1; - } - elsif (/^(?!\#)(\s*\;*\s*)(.*?)\s*=\s*(.*)\s*$/) { - $conf{$menu}{$2}{value} = $3; - $conf{$menu}{$2}{comment} = $1; - } - push @tab, $_; - } - $self->{conf} = \%conf; - $self->{tab} = \@tab; - bless $self; -} - -# we parse @tab to check for values in the struct. - -sub write_conf { - my $self = shift; - my ($file) = @_; - my $menu; - - open(FH, "> $file") or die "$!"; - foreach (@{$self->{tab}}) { - if (/^\s*\;?\s*\[(.*)\].*/) { - $menu = $1; - print FH "$self->{conf}->{$menu}{__comment}"."[$menu]\n"; - } - elsif (/^(?!\#)\s*\;*\s*(.*?)\s*=/) { - print FH "$self->{conf}->{$menu}{$1}{comment}"."$1" ." = ". "$self->{conf}->{$menu}{$1}{value}\n"; - } - else { - print FH $_; - } - } -} - -#section has the name of the printer -sub add_printer { - my $self = shift; - my ($printer) = @_; - - if (exists $self->{conf}->{$printer}) { - $self->comment_menu($printer, " "); - } - else { - $self->{conf}->{$printer}{printable}{comment} = " "; - $self->{conf}->{$printer}{printer}{comment} = " "; - push @{$self->{tab}}, "[$printer]\n"; - push @{$self->{tab}}, "printer = $printer\n"; - push @{$self->{tab}}, "printable = yes\n"; - $self->{conf}->{$printer}{printer}{value} = $printer; - $self->{conf}->{$printer}{printable}{value} = "yes"; - } -} - -sub list_printers { - my @list if 0; - - return @list if @list; - @list = sort grep /^(?!\#).*/, map { - my ($printer) = split(':', $_); - } cat_("/etc/printcap"); -} - - -sub check_users { - return 1 if $ENV{wiz_do_printer_sharing}; - 0; -} - -sub comment_menu { - my $self = shift; - my ($menu, $str) = @_; - - return if (!$menu or !exists $self->{conf}->{$menu}); - $self->{conf}->{$menu}{__comment} = $str; - foreach (keys %{$self->{conf}->{$menu}}) { - ($_ eq "__comment") and next; - $self->{conf}->{$menu}{$_}{comment} = $str; - } -} - -sub comment_var { - my $self = shift; - my ($menu, $var, $str) = @_; - - $self->{conf}->{$menu}{$var}{comment} = $str; -} - -sub chg_var { - my $self = shift; - my ($menu, $var, $str) = @_; - - $self->{conf}->{$menu}{$var}{value} = $str; -} - -# all or selected printers -sub printer_sharing { - my $self = shift; - - if ($ENV{wiz_all_printers}) { - $self->comment_menu("printers", " "); - foreach my $printer (keys (%::bool)) { - $self->comment_menu($printer, ";"); - } - } - else { - $self->comment_menu("printers", ";"); - foreach my $printer (keys (%::bool)) { - if (int($::bool{$printer})) { - $self->comment_menu($printer, " "); - $self->add_printer($printer); - } - else { - $self->comment_menu($printer, ";"); - } - } - } -} - -sub get_printers { - if ($ENV{wiz_do_printer_sharing}) { - my $string; - $ENV{wiz_all_printers} and return "all printers"; - foreach (keys (%::bool)) { - $string .= "$_, " if int($::bool{$_}); - } - "$string"; - } - else { - "disabled"; - } -} - -sub check_workgroup { - !$ENV{wiz_workgroup} and return 1; - 10; -} - -sub ask_acces { - 10; -} - -my $old = read_conf("/etc/samba/smb.conf"); - -sub get_write { - $old->{conf}->{public}{"write list"}{value}; -} - -sub get_read { - $old->{conf}->{public}{"read list"}{value}; -} - -sub check_banner { - !$ENV{wiz_banner} and return 1; - 10; -} - -sub get_workgroup { - $old->{conf}->{global}{workgroup}{value}; -} - -sub get_banner { - $old->{conf}->{global}{"server string"}{value}; -} - -sub ask_dir { - return 2 if $ENV{wiz_do_file_sharing}; - return 1 if $ENV{wiz_do_printer_sharing}; - 0; -} - -sub get_dir { - $old->{conf}->{public}{path}{value}; -} - -sub get_file_sharing { - return 0 if ($old->{conf}->{public}{__comment} =~ /\;|\#/); - 1; -} - -sub get_home_sharing { - return 0 if ($old->{conf}->{homes}{__comment} =~ /\;|\#/); - 1; -} - -sub get_netmask { - "192.168.100.1/255.255.255.0"; -} - -sub get_allow_host { - $old->{conf}->{global}{"hosts allow"}{value}; -} - -sub get_deny_host { - $old->{conf}->{global}{"hosts deny"}{value}; -} - -sub chk_level { -# if ($ENV{wiz_level} == 2) { -# $ENV{wiz_allow_allow} = "toto"; -# $ENV{wiz_allow_allow} = "toto"; -# } -# else { -# $ENV{wiz_hosts_deny} = "tata"; -# $ENV{wiz_hosts_deny} = "tata"; -# } -# if ($ENV{wiz_level} == 3) { -# $ENV{wiz_allow_allow} = "toto"; -# $ENV{wiz_allow_allow} = "toto"; -# } -# else { -# $ENV{wiz_hosts_deny} = "tata"; -# $ENV{wiz_hosts_deny} = "tata"; -# } - $ENV{wiz_level}; -} - -# remember one variable cannot be commented and not in the same file. -sub do_it { - my $file = "__WIZ_HOME__/samba_wizard/scripts/smb.conf.default"; - - my $conf = read_conf($file); - $conf->chg_var("global", "workgroup", $ENV{wiz_workgroup}); - $conf->chg_var("global", "server string", $ENV{wiz_banner}); - $conf->chg_var("public", "write list", $ENV{wiz_write_list}) if $ENV{wiz_do_file_sharing}; - $conf->chg_var("public", "read list", $ENV{wiz_read_list}) if $ENV{wiz_do_file_sharing}; - my $ip = $o->itf_get("IPADDR"); - if ($ENV{wiz_do_file_sharing}) { - standalone->explanations("Enabling $ENV{wiz_dir} samba file sharing"); - $conf->comment_menu("public", " "); - $conf->chg_var("public", "path", $ENV{wiz_dir}); - } - else { - standalone->explanations("Disabling samba file sharing"); - $conf->comment_menu("public", ";"); - } - if ($ENV{wiz_do_homes}) { - standalone->explanations("Enabling samba homes sharing"); - $conf->comment_menu("homes", " "); - } - else { - standalone->explanations("Disabling samba homes sharing"); - $conf->comment_menu("homes", ";"); - } - standalone->explanations("Samba deny $ENV{wiz_hosts_deny}"); - standalone->explanations("Samba allow $ENV{wiz_hosts_allow}"); -# $conf->chg_var("global", "hosts deny", $ENV{wiz_hosts_deny}); -# $conf->chg_var("global", "hosts allow", $ENV{wiz_hosts_allow}); - - if ($ENV{wiz_do_printer_sharing}) { - standalone->explanations("Enabling printer sharing"); - $conf->printer_sharing(); - } - else { - standalone->explanations("Disabling printer sharing"); - foreach my $printer (keys (%::bool)) { - if (!int($::bool{$printer})) { - $conf->comment_menu("$printer", ";"); - } - } - $conf->comment_menu("printers", ";"); - } - $conf->write_conf("/etc/samba/smb.conf"); - if (services::is_service_running('smb')) { - services::restart('smb') - } else { - services::start('smb') - } - 10; -} -1; diff --git a/time_wizard/scripts/NTPConf.pm b/time_wizard/scripts/NTPConf.pm deleted file mode 100644 index efcc838d..00000000 --- a/time_wizard/scripts/NTPConf.pm +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl - -# NTP Config Parser - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package NTPConf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -use MDK::Common; -use strict; -use standalone; - -sub chooser4 { - if ($ENV{chooser4} eq "save_quit") { - do_it(); - return 1; - } - 2; -} - -sub test { - system("/usr/sbin/ntpdate -q $ENV{server1} $ENV{server2}"); - if (!($? >> 8)) { - do_it(); - return 1; - } - 2; -} - -sub do_it { - my $file = "/etc/sysconfig/clock"; - MDK::Common::cp_af($file, $file.".orig"); - open(NEW, "> $file") or die "can not open $file: $!"; - print NEW "UTC=true\n"; - print NEW "ZONE=$ENV{wiz_timezone}\n"; - print NEW "ARC=false\n"; - close NEW or die "can not close $file: $!"; - MDK::Common::cp_af("/usr/share/zoneinfo/$ENV{wiz_timezone}", "/etc/localtime"); - -f "/etc/ntp/step-tickers" and MDK::Common::cp_af("/etc/ntp/step-tickers", "/etc/ntp/step-tickers.orig"); - open(NEW, "> /etc/ntp/step-tickers") or die "can not open /etc/ntp/step-tickers: $!"; - print NEW $ENV{server1}."\n"; - print NEW $ENV{server2}."\n"; - close NEW or die "can not close /etc/ntp/step-tickers: $!"; - substInFile { s/(# server clock.via.net)/$1\nserver $ENV{server1}/ } '/etc/ntp.conf' if -f '/etc/ntp.conf'; - standalone::explanations("Wrote /etc/ntp/step-tickers, starting services"); - my @services = qw(crond atd ntpd); - foreach (@services) { - system("/etc/rc.d/init.d/$_ stop"); - } - foreach (reverse @services) { - system("/etc/rc.d/init.d/$_ start"); - } - system("/sbin/hwclock --systohc --utc"); - 10; -} -1; diff --git a/time_wizard/scripts/compute_liste.sh b/time_wizard/scripts/compute_liste.sh deleted file mode 100755 index 287808fb..00000000 --- a/time_wizard/scripts/compute_liste.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# Wizard -# -# Copyright (C) 2000 Mandrakesoft. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See file LICENSE for further informations on licensing terms. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi -# icons: Helene Durosini -# http://www.mandrakesoft.com - -# script for wizard time configuration -# -# echo on stdout liste & description (same) of timezone - -# zoneinfo directory probably exists, but -[ -d /usr/share/zoneinfo ] || exit 1 - -echo_debug "timezone list" - -cd /usr/share/zoneinfo && find [A-Z]* -type f | sort - diff --git a/time_wizard/time.wiz b/time_wizard/time.wiz deleted file mode 100644 index ac746ab2..00000000 --- a/time_wizard/time.wiz +++ /dev/null @@ -1,647 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm index 5249446d..0d2fc4a2 100755 --- a/web_wizard/Apache.pm +++ b/web_wizard/Apache.pm @@ -2,8 +2,10 @@ # Drakwizard -# Copyright (C) 2002 Arnaud Desmons -# 2003 Florent Villard +# Copyright (C) 2002, 2003 Mandrakesoft +# +# Authors: Arnaud Desmons +# Florent Villard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/web_wizard/apache2.wiz b/web_wizard/apache2.wiz deleted file mode 100644 index 51de8c9a..00000000 --- a/web_wizard/apache2.wiz +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web_wizard/scripts/Apache2conf.pm b/web_wizard/scripts/Apache2conf.pm deleted file mode 100644 index 94d284ce..00000000 --- a/web_wizard/scripts/Apache2conf.pm +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl - -package Apache2conf; -require "__WIZ_HOME__/common/scripts/Varspaceval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; - -use strict; - -my $o = IFCFG->new(); - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -a -my $file = "/etc/httpd/conf/httpd2.conf"; -my $root; - -if (-f $file) { - open(FH, "< $file") or die "$! ($file)"; - while () { - if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { - close(FH); - $root = "$1"; - last; - } - } - close(FH); -} - -sub get_docroot { - $root; -} - -sub check_dir { - -d ($ENV{wiz_dir}) and return 10; - 1; -} - -sub chg_docroot { - my $old; - substInFile { - s|(^\s*\#?\s*DocumentRoot\s*)(\S*).*|$1$ENV{wiz_dir}| and $old ||=$2; - } "/etc/httpd/conf/httpd2.conf"; - - print "DEBUG $old"; - substInFile { - s|^\s*||; - } "/etc/httpd/conf/commonhttpd.conf" if $old; - - substInFile { - s|^\s*||; - } "/etc/httpd/conf/commonhttpd.conf"; -} - -sub is_user_mod { - if ($ENV{wiz_user_mod}) { - return 1; - } - $ENV{wiz_user_dir} = "disabled"; - 0; -} - -sub is_last_user_mod { - my $root = get_user_dir(); - chomp($root); - !($root eq 'disabled'); -} - -sub get_user_dir { - my %conf = Varspaceval->get("/etc/httpd/conf/commonhttpd.conf"); - $conf{UserDir}; -} - -sub chg_user_dir { - my $root = get_user_dir(); - if ($ENV{wiz_user_mod}) { - substInFile { - s|(/home/\*/)$root(/?)|$1$ENV{wiz_user_dir}$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir $ENV{wiz_user_dir}$2|g; - s|(/home/\*/)$root(/?)|$1$ENV{wiz_user_dir}$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - } - else { - substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir disabled$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - } - 10; -} - -sub do_it { - my $file = "/etc/httpd/conf/commonhttpd.conf"; - my $that = "localhost"; - - if ($ENV{wiz_web_external} eq "1") { - $that = "all"; - } - elsif ($ENV{wiz_web_internal} eq "1") { - ($that) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; - $that .= " 127.0.0.1"; - } - cp_af($file, $file.".orig"); - substInFile { - if( m /^\s*/s...m/^\s*<\/Directory>/s ) { - { s /^\s*Allow .*$/ Allow from $that\n/s;} - ;} - } $file; - chg_docroot(); - chg_user_dir(); - system("/etc/rc.d/init.d/httpd restart"); - 10; -} - -1; diff --git a/web_wizard/scripts/Webconf.pm b/web_wizard/scripts/Webconf.pm deleted file mode 100644 index a787ac37..00000000 --- a/web_wizard/scripts/Webconf.pm +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/perl - -package Webconf; -require "__WIZ_HOME__/common/scripts/Varspaceval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; - -use strict; - -my $o = IFCFG->new(); - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -my $file = "/etc/httpd/conf/httpd.conf"; -my $root; - -if (-f $file) { - open(FH, "< $file") or die "$! ($file)"; - while () { - if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { - close(FH); - $root = "$1"; - last; - } - } - close(FH); -} - -sub get_docroot { - $root; -} - -sub check_dir { - -d ($ENV{wiz_dir}) and return 10; - 1; -} - -sub chg_docroot { - my $old; - substInFile { - s|(^\s*\#?\s*DocumentRoot\s*)(\S*).*|$1$ENV{wiz_dir}| and $old ||=$2; - } "/etc/httpd/conf/httpd.conf"; - - print "DEBUG $old"; - substInFile { - s|^\s*||; - } "/etc/httpd/conf/commonhttpd.conf" if $old; - - substInFile { - s|^\s*||; - } "/etc/httpd/conf/commonhttpd.conf"; -} - -sub is_user_mod { - if ($ENV{wiz_user_mod}) { - return 1; - } - $ENV{wiz_user_dir} = "disabled"; - 0; -} - -sub is_last_user_mod { - my $root = get_user_dir(); - chomp($root); - !($root eq 'disabled'); -} - -sub get_user_dir { - my %conf = Varspaceval->get("/etc/httpd/conf/commonhttpd.conf"); - $conf{UserDir}; -} - -sub chg_user_dir { - my $root = get_user_dir(); - if ($ENV{wiz_user_mod}) { - substInFile { - s|(/home/\*/)$root(/?)|$1$ENV{wiz_user_dir}$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir $ENV{wiz_user_dir}$2|g; - s|(/home/\*/)$root(/?)|$1$ENV{wiz_user_dir}$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - } - else { - substInFile { - s|(\s*)UserDir\s*$root(/?)|$1UserDir disabled$2|g; - } "/etc/httpd/conf/commonhttpd.conf"; - } - 10; -} - -sub do_it { - my $file = "/etc/httpd/conf/commonhttpd.conf"; - my $that = "localhost"; - - if ($ENV{wiz_web_external} eq "1") { - $that = "all"; - } - elsif ($ENV{wiz_web_internal} eq "1") { - ($that) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; - $that .= " 127.0.0.1"; - } - cp_af($file, $file.".orig"); - substInFile { - if( m /^\s*/s...m/^\s*<\/Directory>/s ) { - { s /^\s*Allow .*$/ Allow from $that\n/s;} - ;} - } $file; - chg_docroot(); - chg_user_dir(); - system("/etc/rc.d/init.d/httpd restart"); - 10; -} - -1; diff --git a/web_wizard/scripts/mytest.pl b/web_wizard/scripts/mytest.pl deleted file mode 100755 index e13f3708..00000000 --- a/web_wizard/scripts/mytest.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -use strict; - -open(FH, $ARGV[0]); - -my $that; - -if ($ENV{wiz_web_external} eq "1") { - $that = "all"; -} -elsif ($ENV{wiz_web_internal} eq "1") { - $that = $ip; -} -else { - $that = "localhost"; -} - - -while() { - if( m/^[[:space:]]*/s ) { - s/^[[:space:]]*Allow .*$/Allow from $that/s; - } - if( m /^[[:space:]]*/s ) { - s/^[[:space:]]*Allow .*$/Allow from $that/s; - } - print $_; -} - diff --git a/web_wizard/web.wiz b/web_wizard/web.wiz deleted file mode 100644 index bb7ec2c3..00000000 --- a/web_wizard/web.wiz +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.1