📄 thirdparty.pl
字号:
# thirdparty.pl# Checks for modules available in an old install of webmin that are# not included in this new install, and offers to copy them across.# Also re-creates clones of existing modules in the new install($newdir, $olddir, $copythird) = @ARGV;# find missing modulesopendir(DIR, $olddir);while($m = readdir(DIR)) { if ($m !~ /^\./ && -r "$olddir/$m/module.info" && !-r "$newdir/$m/module.info") { if (-l "$olddir/$m") { # Found a clone - recreate it $clone = readlink("$olddir/$m"); symlink($clone, "$newdir/$m"); } else { # Found a candidate for copying local %minfo; &read_file("$olddir/$m/module.info", \%minfo); push(@missing, $m); push(@missdesc, $minfo{'desc'}); } } }closedir(DIR);if (@missing) { # Tell the user, and ask whether to copy if (!$copythird) { print "The following third party modules were found in your old Webmin\n"; print "installation in $olddir :\n"; for($i=0; $i<@missing; $i++) { printf " %-12.12s %s\n", $missing[$i], $missdesc[$i]; } print "Copy to new Webmin installation (y/n): "; chop($resp = <STDIN>); $copythird = $resp =~ /^y/i; } if ($copythird) { foreach $m (@missing) { system("cp -rp $olddir/$m $newdir"); } } }# read_file(file, array)# Fill an associative array with name=value pairs from a filesub read_file{local($arr);$arr = $_[1];open(ARFILE, $_[0]) || return 0;while(<ARFILE>) { chop; if (!/^#/ && /^([^=]+)=(.*)$/) { $$arr{$1} = $2; } }close(ARFILE);return 1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -