From ac7fe6673429e3995a26046af58f83b5c075835d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 28 Feb 2019 16:41:17 +0800 Subject: [PATCH] u --- plugins/l2tp/index.py | 91 ----------------------------------------- plugins/l2tp/install.sh | 4 ++ 2 files changed, 4 insertions(+), 91 deletions(-) diff --git a/plugins/l2tp/index.py b/plugins/l2tp/index.py index bf292da61..6be3f4ff4 100755 --- a/plugins/l2tp/index.py +++ b/plugins/l2tp/index.py @@ -32,16 +32,6 @@ def getInitDFile(): return '/etc/init.d/' + getPluginName() -def getConf(): - path = getServerDir() + "/etc/pure-ftpd.conf" - return path - - -def getInitDTpl(): - path = getPluginDir() + "/init.d/pure-ftpd.tpl" - return path - - def getArgs(): args = sys.argv[2:] tmp = {} @@ -67,48 +57,8 @@ def status(): return 'start' -def contentReplace(content): - service_path = public.getServerDir() - content = content.replace('{$ROOT_PATH}', public.getRootDir()) - content = content.replace('{$SERVER_PATH}', service_path) - return content - - def initDreplace(): - file_tpl = getInitDTpl() - service_path = os.path.dirname(os.getcwd()) - - initD_path = getServerDir() + '/init.d' - if not os.path.exists(initD_path): - os.mkdir(initD_path) - file_bin = initD_path + '/' + getPluginName() - - # initd replace - if not os.path.exists(file_bin): - content = public.readFile(file_tpl) - content = contentReplace(content) - public.writeFile(file_bin, content) - public.execShell('chmod +x ' + file_bin) - - pureSbinConfig = getServerDir() + "/sbin/pure-config.pl" - if not os.path.exists(pureSbinConfig): - pureTplConfig = getPluginDir() + "/init.d/pure-config.pl" - content = public.readFile(pureTplConfig) - content = contentReplace(content) - public.writeFile(pureSbinConfig, content) - public.execShell('chmod +x ' + pureSbinConfig) - - pureFtpdConfig = getServerDir() + "/etc/pure-ftpd.conf" - pureFtpdConfigBak = getServerDir() + "/etc/pure-ftpd.bak.conf" - pureFtpdConfigTpl = getPluginDir() + "/conf/pure-ftpd.conf" - - if not os.path.exists(pureFtpdConfigBak): - shutil.copyfile(pureFtpdConfig, pureFtpdConfigBak) - content = public.readFile(pureFtpdConfigTpl) - content = contentReplace(content) - public.writeFile(pureFtpdConfig, content) - return file_bin @@ -144,41 +94,6 @@ def reload(): return data[1] -def initdStatus(): - if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': - return "Apple Computer does not support" - initd_bin = getInitDFile() - if os.path.exists(initd_bin): - return 'ok' - return 'fail' - - -def initdInstall(): - import shutil - if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': - return "Apple Computer does not support" - - source_bin = initDreplace() - initd_bin = getInitDFile() - shutil.copyfile(source_bin, initd_bin) - public.execShell('chmod +x ' + initd_bin) - return 'ok' - - -def initdUinstall(): - if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': - return "Apple Computer does not support" - initd_bin = getInitDFile() - os.remove(initd_bin) - return 'ok' - - if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -191,11 +106,5 @@ if __name__ == "__main__": print restart() elif func == 'reload': print reload() - elif func == 'initd_status': - print initdStatus() - elif func == 'initd_install': - print initdInstall() - elif func == 'initd_uninstall': - print initdUinstall() else: print 'error' diff --git a/plugins/l2tp/install.sh b/plugins/l2tp/install.sh index b28a8697e..9b011278e 100755 --- a/plugins/l2tp/install.sh +++ b/plugins/l2tp/install.sh @@ -19,11 +19,15 @@ Install_l2tp() mkdir -p $serverPath/l2tp echo '1.0' > $serverPath/l2tp/version.pl + cp -rf scripts/l2tp.sh $serverPath/l2tp + if [ "Darwin" == "$SYSOS" ];then echo 'macosx unavailable' > $install_tmp exit 0 fi + #cp -rf $serverPath/l2tp + echo 'install complete' > $install_tmp }