fix pac-domain migration
This commit is contained in:
parent
aeab721f10
commit
fd516ce57a
@ -374,35 +374,36 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
|
||||
private Processor createMovePacDomainContent(EntityManager em, Domain dom) {
|
||||
Pac pac = dom.getUser().getPac();
|
||||
String pacDir = "/home/pacs/" + pac.getName();
|
||||
String domDir = pacDir + "/doms/" + pac.getName() + ".hostsharing.net";
|
||||
String pacName = pac.getName();
|
||||
String pacDir = "/home/pacs/" + pacName;
|
||||
String domDir = pacDir + "/doms/" + pacName + ".hostsharing.net";
|
||||
String[] sourceDirs = new String[] { "web", "web-ssl", "cgi", "cgi-ssl", "fastcgi", "fastcgi-ssl" } ;
|
||||
String[] targetDirs = new String[] { "htdocs", "htdocs-ssl", "cgi", "cgi-ssl", "fastcgi", "fastcgi-ssl" } ;
|
||||
CompoundProcessor processor = new CompoundProcessor();
|
||||
for (int idx = 0; idx < targetDirs.length; idx++) {
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("rm -rf " + domDir + targetDirs[idx]));
|
||||
new ShellProcessor("rm -rf " + domDir + "/" + targetDirs[idx]));
|
||||
}
|
||||
for (int idx = 0; idx < sourceDirs.length; idx++) {
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("shopt -s dotglob && ls " + pacDir + "/" + sourceDirs[idx] + " >/dev/null 2>&1" +
|
||||
" && mv " + pacDir + "/" + sourceDirs[idx] + domDir + "/" + targetDirs[idx] +
|
||||
" && mv " + pacDir + "/" + sourceDirs[idx] + " " + domDir + "/" + targetDirs[idx] +
|
||||
" || echo 'directory " + pacDir + "/" + sourceDirs[idx] + " not found'"));
|
||||
}
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("test -L " + domDir + "/htdocs" +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs |sed -e's/^.*`//' -e\"s/'$//\"` = web-ssl " +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs` |sed -e's/^.*`//' -e\"s/'$//\"` = web-ssl " +
|
||||
" && cd " + domDir +
|
||||
" && rm " + domDir + "/htdocs" +
|
||||
" && ln -sf htdocs-ssl htdocs" +
|
||||
" && chown -h " + pac + ":" + pac + " " + domDir + "/htdocs"));
|
||||
" && chown -h " + pacName + ":" + pacName + " " + domDir + "/htdocs"));
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("test -L " + domDir + "/htdocs-ssl" +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs-ssl |sed -e's/^.*`//' -e\"s/'$//\"` = web " +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs-ssl` |sed -e's/^.*`//' -e\"s/'$//\"` = web " +
|
||||
" && cd " + domDir +
|
||||
" && rm " + domDir + "/htdocs-ssl" +
|
||||
" && ln -sf htdocs htdocs-ssl" +
|
||||
" && chown -h " + pac + ":" + pac + " " + domDir + "/htdocs-ssl"));
|
||||
" && chown -h " + pacName + ":" + pacName + " " + domDir + "/htdocs-ssl"));
|
||||
return processor;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user