From a3d5079d63d53d7a639162a03a89fa8fdcfbee8a Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 30 Nov 2001 17:19:30 +0000 Subject: fileshare should be ok, handle diskdrake --fileshare, fix smb import --- perl-install/Makefile.config | 2 +- perl-install/Makefile.drakxtools | 4 ++++ perl-install/any.pm | 29 +++++++++++++++++++++++++++++ perl-install/network/smb.pm | 4 ++-- perl-install/standalone/diskdrake | 9 ++++++++- 5 files changed, 44 insertions(+), 4 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index 5500d43ec..8aa927e7d 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -5,7 +5,7 @@ VERSION = 2.2.10-BOOT SUDO = sudo SO_FILES = c/blib/arch/auto/c/c.so PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm sbus_probing/*.pm network/*.pm commands install2 g_auto_install live_install live_install2 -STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet localedrake net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake lsnetdrake scannerdrake +STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet localedrake net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake lsnetdrake scannerdrake fileshareset PMS += $(STANDALONEPMS:%=standalone/%) REP4PMS = /usr/bin/perl-install ROOTDEST = /export diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools index e0f6b3523..03d0eac1f 100644 --- a/perl-install/Makefile.drakxtools +++ b/perl-install/Makefile.drakxtools @@ -31,6 +31,7 @@ install: install $(STANDALONEPMS) $(SBINDEST) install -s rpcinfo-flushed ddcprobe/ddcxinfos serial_probe/serial_probe $(SBINDEST) ln -s ../../$(patsubst $(PREFIX)/usr%,%,$(SBINDEST))/XFdrake $(BINX11DEST)/Xdrakres + ln -s fileshareset $(SBINDEST)/filesharelist mv -f $(SBINDEST)/lsnetdrake $(BINDEST)/lsnetdrake install -m 644 *.pm $(LIBDEST) @@ -39,6 +40,9 @@ install: install -m 644 share/diskdrake.rc $(ETCDEST) install -m 644 share/wizard.rc $(ETCDEST) + install -d $(PREFIX)/etc/security + echo 'RESTRICT=yes' > $(PREFIX)/etc/security/fileshare.conf + install -m 644 $(patsubst %,Newt/%.pm,Newt) $(LIBDEST)/Newt install -m 644 $(patsubst %,c/%.pm,stuff) $(LIBDEST)/c install -m 644 $(patsubst %,sbus_probing/%.pm,main) $(LIBDEST)/sbus_probing diff --git a/perl-install/any.pm b/perl-install/any.pm index 45db781a7..9e459af1c 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -864,4 +864,33 @@ sub devfssymlinkf { symlinkf($if, "$prefix/$_") foreach ("dev/$of", "lib/dev-state/$of"); } +sub fileshare_config { + my ($in) = @_; + + my $file = '/etc/security/fileshare.conf'; + my %conf = getVarsFromSh($file); + + my @l = (__("No sharing"), __("Allow all users"), __("Custom")); + my $restrict = exists $conf{RESTRICT} ? text2bool($conf{RESTRICT}) : 1; + + my $r = $in->ask_from_list_('fileshare', +'Do you want to allow users to export some directories in their home? +Allowing this will permit users to simply click on "Share" in konqueror and nautilus. + +"Custom" permit a per-user granularity. +', + \@l, $l[$restrict ? 0 : 1]) or return; + $restrict = $r ne $l[1]; + $conf{RESTRICT} = bool2yesno($restrict); + + setVarsInSh($file, \%conf); + if ($r eq $l[2]) { + # custom + $in->ask_warn('', +'The per-user sharing uses the group "fileshare". +You can use userdrake to add a user in this group. +Or on the command line use: "usermod -G fileshare user_name"'); + } +} + 1; diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm index d5c128b41..a9f8907ce 100644 --- a/perl-install/network/smb.pm +++ b/perl-install/network/smb.pm @@ -35,13 +35,13 @@ sub find_servers() { sub find_exports { my ($server) = @_; my @l; - my $name = $server->{name} ? " -L $server->{name}" : ''; + my $ip = $server->{ip} ? " -I $server->{ip}" : ''; my $group = $server->{group} ? " -W $server->{group}" : ''; # WARNING: using smbclient -L is ugly. It can't handle more than 15 # characters shared names - foreach (`smbclient -U% -L -I $server->{ip}$name$group`) { + foreach (`smbclient -U% -L $server->{name}$ip$group`) { chomp; s/^\t//; my ($name, $type, $comment) = unpack "A15 A10 A*", $_; diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index 4ae662a86..be570dadb 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -43,10 +43,11 @@ if ($::isEmbedded) { local $_ = join '', @ARGV; -/-h/ and die "usage: diskdrake [--expert] [--testing]\n"; +/-h/ and die "usage: diskdrake [--expert] [--testing] [--fileshare]\n"; $::expert = /-expert/; $::testing = /-testing/; +my $fileshare = /-fileshare/; if ($>) { $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; @@ -54,6 +55,12 @@ if ($>) { my $in = 'interactive'->vnew('su'); + +if ($fileshare) { + any::fileshare_config($in); + $in->exit(0); +} + my ($all_hds) = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { -- cgit v1.2.1