Migrate to cygwin sh
This commit is contained in:
parent
ffbe5107e2
commit
fb6de25e5f
21 changed files with 21 additions and 246 deletions
|
@ -25,12 +25,17 @@ QString OpenVpnConfigurator::getEasyRsaShPath()
|
|||
// easyrsa sh path should looks like
|
||||
// "/Program Files (x86)/AmneziaVPN/easyrsa/easyrsa"
|
||||
QString easyRsaShPath = QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\easyrsa\\easyrsa";
|
||||
easyRsaShPath.replace("C:\\", "");
|
||||
easyRsaShPath.replace("\\", "/");
|
||||
easyRsaShPath.prepend("/");
|
||||
// easyRsaShPath.replace("C:\\", "/cygdrive/c/");
|
||||
// easyRsaShPath.replace("\\", "/");
|
||||
easyRsaShPath = "\"" + easyRsaShPath + "\"";
|
||||
|
||||
//return "\"" + easyRsaShPath + "\"";
|
||||
return "\"/Program Files (x86)/AmneziaVPN/easyrsa/easyrsa\"";
|
||||
// easyRsaShPath = "\"/cygdrive/c/Program Files (x86)/AmneziaVPN/easyrsa/easyrsa\"";
|
||||
|
||||
// easyRsaShPath = "\"C:\\Program Files (x86)\\AmneziaVPN\\easyrsa\\easyrsa\"";
|
||||
qDebug().noquote() << "EasyRsa sh path" << easyRsaShPath;
|
||||
|
||||
return easyRsaShPath;
|
||||
// return "\"/Program Files (x86)/AmneziaVPN/easyrsa/easyrsa\"";
|
||||
#else
|
||||
return QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/easyrsa";
|
||||
#endif
|
||||
|
@ -42,6 +47,7 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
QString pathEnvVar = env.value("PATH");
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
pathEnvVar.clear();
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\easyrsa\\bin;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn\\i386;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn\\x64;");
|
||||
|
@ -50,6 +56,7 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
#endif
|
||||
|
||||
env.insert("PATH", pathEnvVar);
|
||||
//qDebug().noquote() << "ENV PATH" << pathEnvVar;
|
||||
return env;
|
||||
}
|
||||
|
||||
|
@ -61,7 +68,9 @@ ErrorCode OpenVpnConfigurator::initPKI(const QString &path)
|
|||
#ifdef Q_OS_WIN
|
||||
p.setProcessEnvironment(prepareEnv());
|
||||
p.setProgram("cmd.exe");
|
||||
p.setNativeArguments(QString("/C \"sh.exe %1\"").arg(getEasyRsaShPath() + " init-pki"));
|
||||
p.setNativeArguments(QString("/C \"ash.exe %1\"").arg(getEasyRsaShPath() + " init-pki"));
|
||||
qDebug().noquote() << "EasyRsa tmp path" << path;
|
||||
qDebug().noquote() << "EasyRsa args" << p.nativeArguments();
|
||||
#else
|
||||
p.setProgram(getEasyRsaShPath());
|
||||
p.setArguments(QStringList() << "init-pki");
|
||||
|
@ -69,9 +78,9 @@ ErrorCode OpenVpnConfigurator::initPKI(const QString &path)
|
|||
|
||||
p.setWorkingDirectory(path);
|
||||
|
||||
// QObject::connect(&p, &QProcess::channelReadyRead, [&](){
|
||||
// qDebug().noquote() << p.readAll();
|
||||
// });
|
||||
QObject::connect(&p, &QProcess::channelReadyRead, [&](){
|
||||
qDebug().noquote() << "Init PKI" << p.readAll();
|
||||
});
|
||||
|
||||
p.start();
|
||||
p.waitForFinished();
|
||||
|
@ -88,7 +97,8 @@ ErrorCode OpenVpnConfigurator::genReq(const QString &path, const QString &client
|
|||
#ifdef Q_OS_WIN
|
||||
p.setProcessEnvironment(prepareEnv());
|
||||
p.setProgram("cmd.exe");
|
||||
p.setNativeArguments(QString("/C \"sh.exe %1\"").arg(getEasyRsaShPath() + " gen-req " + clientId + " nopass"));
|
||||
p.setNativeArguments(QString("/C \"ash.exe %1\"").arg(getEasyRsaShPath() + " gen-req " + clientId + " nopass"));
|
||||
qDebug().noquote() << "EasyRsa args" << p.nativeArguments();
|
||||
#else
|
||||
p.setArguments(QStringList() << "gen-req" << clientId << "nopass");
|
||||
p.setProgram(getEasyRsaShPath());
|
||||
|
@ -98,7 +108,7 @@ ErrorCode OpenVpnConfigurator::genReq(const QString &path, const QString &client
|
|||
|
||||
QObject::connect(&p, &QProcess::channelReadyRead, [&](){
|
||||
QString data = p.readAll();
|
||||
//qDebug().noquote() << data;
|
||||
qDebug().noquote() << data;
|
||||
|
||||
if (data.contains("Common Name (eg: your user, host, or server name)")) {
|
||||
p.write("\n");
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
Licence
|
||||
-------
|
||||
|
||||
mksh/Win32 is a derived work of The MirBSD Korn Shell and
|
||||
recognised by The MirOS Project but realised by an independent
|
||||
developer with support and legal permit by Scalaris AG.
|
||||
|
||||
|
||||
The shell itself comes under The MirOS Licence:
|
||||
|
||||
Copyright (c) 2002-2013
|
||||
The MirOS Project
|
||||
Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
Thorsten Glaser <tg@mirbsd.org>
|
||||
Copyright (c) 2010, 2011, 2012, 2013
|
||||
Michael Langguth <lan@scalaris.com>
|
||||
|
||||
Provided that these terms and disclaimer and all copyright notices
|
||||
are retained or reproduced in an accompanying document, permission
|
||||
is granted to deal in this work without restriction, including un-
|
||||
limited rights to use, publicly perform, distribute, sell, modify,
|
||||
merge, give away, or sublicence.
|
||||
|
||||
This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
||||
the utmost extent permitted by applicable law, neither express nor
|
||||
implied; without malicious intent or gross negligence. In no event
|
||||
may a licensor, author or contributor be held liable for indirect,
|
||||
direct, other damage, loss, or other issues arising in any way out
|
||||
of dealing in the work, even if advised of the possibility of such
|
||||
damage or existence of a defect, except proven that it results out
|
||||
of said person's immediate fault when using the work as intended.
|
||||
|
||||
|
||||
The shell contains strlcpy() under the ISC licence:
|
||||
|
||||
Copyright (c) 2006, 2008, 2009
|
||||
Thorsten Glaser <tg@mirbsd.org>
|
||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
This version of the shell contains setmode() under the UCB BSD licence:
|
||||
|
||||
Copyright (c) 1989, 1993, 1994
|
||||
The Regents of the University of California. All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Dave Borman at Cray Research, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
|
||||
The shell includes nedmalloc under the Boost Software License which,
|
||||
in turn, includes dlmalloc under CC0 (eventually) in its binary.
|
||||
|
||||
|
||||
The "liblan" portability library is covered by The MirOS Licence:
|
||||
|
||||
Copyright (c) 1996, 1998, 2003, 2004, 2005, 2010, 2011, 2012, 2013
|
||||
Scalaris AG, Author: Michael Langguth <lan@scalaris.com>
|
||||
|
||||
Provided that these terms and disclaimer and all copyright notices
|
||||
are retained or reproduced in an accompanying document, permission
|
||||
is granted to deal in this work without restriction, including un-
|
||||
limited rights to use, publicly perform, distribute, sell, modify,
|
||||
merge, give away, or sublicence.
|
||||
|
||||
This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
||||
the utmost extent permitted by applicable law, neither express nor
|
||||
implied; without malicious intent or gross negligence. In no event
|
||||
may a licensor, author or contributor be held liable for indirect,
|
||||
direct, other damage, loss, or other issues arising in any way out
|
||||
of dealing in the work, even if advised of the possibility of such
|
||||
damage or existence of a defect, except proven that it results out
|
||||
of said person's immediate fault when using the work as intended.
|
||||
|
||||
|
||||
It includes an implementation of POSIX directory browsing functions
|
||||
and types for Win32 under a Historical Permission Notice variant:
|
||||
|
||||
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided
|
||||
that this copyright and permissions notice appear in all copies and
|
||||
derivatives.
|
||||
|
||||
This software is supplied "as is" without express or implied warranty.
|
||||
|
||||
But that said, if there are any problems please get in touch.
|
||||
|
||||
|
||||
The program shortcut (mkshicon1.ico) is an unregistered trademark:
|
||||
|
||||
Copyright (c) 2013 Michael Langguth
|
||||
Copyright (c) 2006 Benny Siegert
|
||||
Copyright (c) 2005 Thorsten Glaser
|
||||
|
||||
This icon may be used to refer to The MirBSD Korn Shell and
|
||||
its Win32 port. Distribution patches are acceptable as long
|
||||
as they modify $KSH_VERSION according to the guidelines that
|
||||
are published on the website; forks and works that are not
|
||||
derivates are not allowed to use it.
|
||||
|
||||
The BSD daemon is Copyright (c) 1988 by Marshall Kirk McKusick.
|
||||
All Rights Reserved. Individuals may use the daemon for their
|
||||
personal use within the bounds of good taste. When reasonably
|
||||
possible, the text shown above is to be included.
|
||||
|
||||
The Shilouette daemon is Copyright (c) 2003 by Rick Collette.
|
||||
The MirOS Project may freely use the former ekkoBSD Logo,
|
||||
the shilouette Daemon, for MirBSD, on anything the project
|
||||
leader sees fit, so long as it pertains to MirBSD in some
|
||||
way and the leader gives credit for the original daemon to
|
||||
Marshall Kirk McKusick.
|
|
@ -1,20 +0,0 @@
|
|||
Mktemp is distributed under the following ISC-style license:
|
||||
|
||||
Copyright (c) 1996-1997, 2000-2001, 2008, 2010
|
||||
Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 1996, David Mazieres <dm@uun.org>
|
||||
Copyright (c) 2008, Damien Miller <djm@openbsd.org>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
From https://www.mktemp.org/mktemp/license.html
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,67 +0,0 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC2161,SC1091
|
||||
|
||||
# This script is a frontend designed to create & launch a POSIX shell
|
||||
# environment suitable for use with Easy-RSA. mksh/Win32 is used with this
|
||||
# project; use with other POSIX shells for Windows may require modification to
|
||||
# this wrapper script.
|
||||
|
||||
setup_path="${EASYRSA:-$PWD}"
|
||||
export PATH="$setup_path;$setup_path/bin;$PATH"
|
||||
export HOME="$setup_path"
|
||||
|
||||
# This prevents reading from a user's .mkshrc if they have one.
|
||||
# A user who runs mksh for other purposes might have it
|
||||
export ENV="/disable-env"
|
||||
|
||||
# Verify required externals are present
|
||||
extern_list="which awk cat cp mkdir printf rm"
|
||||
for f in $extern_list; do
|
||||
if ! which "${f}.exe" >/dev/null 2>&1; then
|
||||
echo ""
|
||||
echo "FATAL: EasyRSA Shell init is missing a required external file:"
|
||||
echo " ${f}.exe"
|
||||
echo " Your installation is incomplete and cannot function without the required"
|
||||
echo " files."
|
||||
echo ""
|
||||
echo " Press enter to exit."
|
||||
#shellcheck disable=SC2162
|
||||
read
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# set_var is defined as any vars file needs it.
|
||||
# This is the same as in easyrsa, but we _don't_ export
|
||||
set_var() {
|
||||
var="$1"
|
||||
shift
|
||||
value="$*"
|
||||
eval "$var=\"\${$var-$value}\""
|
||||
} #=> set_var()
|
||||
|
||||
# Check for a usable openssl bin, referencing vars if present
|
||||
[ -r "vars" ] && EASYRSA_CALLER=1 . "vars" 2>/dev/null
|
||||
if [ -z "$EASYRSA_OPENSSL" ] && ! which openssl.exe >/dev/null 2>&1; then
|
||||
echo "WARNING: openssl isn't in your system PATH. The openssl binary must be"
|
||||
echo " available in the PATH, defined in the 'vars' file, or defined in a"
|
||||
echo " named environment variable. See README-Windows.txt for more info."
|
||||
fi
|
||||
|
||||
[ -f "$setup_path/easyrsa" ] || {
|
||||
echo "Missing easyrsa script. Expected to find it at: $setup_path/easyrsa"
|
||||
exit 2
|
||||
}
|
||||
|
||||
# Set prompt and welcome message
|
||||
export PS1='
|
||||
EasyRSA Shell
|
||||
# '
|
||||
echo ""
|
||||
echo "Welcome to the EasyRSA 3 Shell for Windows."
|
||||
echo "Easy-RSA 3 is available under a GNU GPLv2 license."
|
||||
echo ""
|
||||
echo "Invoke './easyrsa' to call the program. Without commands, help is displayed."
|
||||
|
||||
# Drop to a shell and await input
|
||||
bin/sh
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue