Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions update-from-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Update webmin/usermin to the latest develop version from GitHub repo
# inspired by authentic-theme/theme-update.sh script, thanks qooob
#
VERS="1.6.3, 2018-03-17"
VERS="1.6.4, 2018-03-87"
#
COPY=" Kay Marquardt <kay@rrr.de> https://github.com/gnadelwartz"
#############################################################################
Expand Down Expand Up @@ -41,15 +41,21 @@ fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROD="webmin" # default

if [[ -r "${DIR}/usermin-init" && -r "${DIR}/uconfig.cgi" ]] ; then
if [[ -r "${DIR}/uconfig.cgi" ]] ; then
if [[ -d "${DIR}/webmin" ]] ; then
echo -e "${RED}Error: cannot detect if current dir is webmin or usermin. aborting ...${NC}"
echo -e "${RED}Error: found Usermin but also Webmin files. aborting ...${NC}"
exit 1
else
echo -e "${ORANGE}Usermin detected ...${NC}"
PROD="usermin"
fi
PROD="usermin"
else
if [[ -d "${DIR}/language" ]] ; then
echo -e "${RED}Error: found Webmin but also Usermin files. aborting ...${NC}"
exit 1
fi
PROD="webmin"
fi
echo -e "${ORANGE}${PROD^} detected ...${NC}"

# where to get source
HOST="https://github.com"
REPO="webmin/$PROD"
Expand Down Expand Up @@ -444,7 +450,7 @@ fi
rm -rf .~files
# fix permissions, should be done by makedist.pl?
echo -e "${CYAN}Make scripts executable ...${NC}"
chmod -R -x+X ${DIR}
chmod -R +X ${DIR}
chmod +x *.pl *.cgi *.pm *.sh */*.pl */*.cgi */*.pm */*.sh

# thats all folks
Expand Down
40 changes: 33 additions & 7 deletions webmin/webmin-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ sub install_webmin_module
my (@mdescs, @mdirs, @msizes);
my (@newmods, $m);
my $install_root_directory = $gconfig{'install_root'} || $root_directory;
my $is_patch=0;

# Uncompress the module file if needed
my $two;
Expand Down Expand Up @@ -270,7 +271,7 @@ sub install_webmin_module
}
}
foreach $m (keys %mods) {
if (!$hasfile{$m,"module.info"} && !$hasfile{$m,"theme.info"}) {
if (!$hasfile{$m,"module.info"} && !$hasfile{$m,"theme.info"} && !$hasfile{$m,"patch.info"}) {
unlink($file) if ($need_unlink);
return &text('install_einfo', "<tt>$m</tt>");
}
Expand All @@ -280,20 +281,22 @@ sub install_webmin_module
return $text{'install_enone'};
}

# Get the module.info or theme.info files to check dependencies
# Get the module.info, theme.info or patch.info files to check dependencies
my $ver = &get_webmin_version();
my $tmpdir = &transname();
mkdir($tmpdir, 0700);
my $err;
my @realmods;
foreach $m (keys %mods) {
next if (!$hasfile{$m,"module.info"} &&
!$hasfile{$m,"theme.info"});
!$hasfile{$m,"theme.info"} && !$hasfile{$m,"patch.info"} );
push(@realmods, $m);
my %minfo;
system("cd $tmpdir ; tar xf \"$file\" $m/module.info ./$m/module.info $m/theme.info ./$m/theme.info >/dev/null 2>&1");
system("cd $tmpdir ; tar xf \"$file\" $m/module.info ./$m/module.info $m/theme.info ./$m/theme.info $m/patch.info ./$m/patch.info>/dev/null 2>&1");
$is_patch=1 if ($hasfile{$m,"patch.info"});
if (!&read_file("$tmpdir/$m/module.info", \%minfo) &&
!&read_file("$tmpdir/$m/theme.info", \%minfo)) {
!&read_file("$tmpdir/$m/theme.info", \%minfo) &&
!&read_file("$tmpdir/$m/patch.info", \%minfo)) {
$err = &text('install_einfo', "<tt>$m</tt>");
}
elsif (!&check_os_support(\%minfo)) {
Expand Down Expand Up @@ -360,7 +363,7 @@ sub install_webmin_module
my @grantmods;
foreach $m (@realmods) {
push(@grantmods, $m) if (!&foreign_exists($m));
if ($m ne "webmin") {
if ($m ne "webmin" && ! $is_patch) {
system("rm -rf ".quotemeta("$install_root_directory/$m")." 2>&1 >/dev/null");
}
}
Expand Down Expand Up @@ -388,14 +391,22 @@ sub install_webmin_module
{ 'desc' => $minfo{'desc'} });
push(@newmods, $moddir);
}
else {
elsif ($hasfile{$moddir,"theme.info"}) {
my %tinfo = &get_theme_info($moddir);
push(@mdescs, $tinfo{'desc'});
push(@mdirs, $pwd);
push(@msizes, &disk_usage_kb($pwd));
&webmin_log("tinstall", undef, $moddir,
{ 'desc' => $tinfo{'desc'} });
}
else {
my %pinfo = &get_patch_info($moddir);
push(@mdescs, $pinfo{'desc'});
push(@mdirs, $pwd);
push(@msizes, &disk_usage_kb($pwd));
&webmin_log("tinstall", undef, $moddir,
{ 'desc' => $pinfo{'desc'} });
}
system("cd $install_root_directory ; (find $pwd -name '*.cgi' ; find $pwd -name '*.pl') 2>/dev/null | $perl $root_directory/perlpath.pl $perl -");
system("cd $install_root_directory ; chown -R $st[4]:$st[5] $pwd");
}
Expand Down Expand Up @@ -442,6 +453,21 @@ sub install_webmin_module
return [ \@mdescs, \@mdirs, \@msizes ];
}

sub get_patch_info
{
return () if ($_[0] =~ /^\./);
my %rv;
my $tdir = &module_root_directory($_[0]);
&read_file("$tdir/patch.info", \%rv) || return ();
foreach my $o (@lang_order_list) {
$rv{"desc"} = $rv{"desc_$o"} if ($rv{"desc_$o"});
}
$rv{"dir"} = $_[0];
return %rv;
}



=head2 grant_user_module(&users/groups, &modules)

Grants users or groups access to a set of modules. The users parameter must
Expand Down