Handle hostnames with upper-case letters
[webmin.git] / samba / readonly-share.pl
1 #!/usr/local/bin/perl
2 # Set a Samba share to read-only mode
3
4 $no_acl_check++;
5 $ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
6 $ENV{'WEBMIN_VAR'} ||= "/var/webmin";
7 if ($0 =~ /^(.*\/)[^\/]+$/) {
8         chdir($1);
9         }
10 chop($pwd = `pwd`);
11 $0 = "$pwd/readonly-share.pl";
12 require './samba-lib.pl';
13 $< == 0 || die "readwrite-share.pl must be run as root";
14
15 @ARGV || die "usage: readonly-share.pl <share> ...";
16 foreach $s (@ARGV) {
17         &get_share($s);
18         &setval("writable", "no");
19         &modify_share($s, $s);
20         }