Mac install fixes, more internal use scripts.

This commit is contained in:
Adam Ierymenko 2014-01-08 23:12:03 -08:00
parent 60731e6d02
commit 3482d836ae
11 changed files with 38 additions and 43 deletions

View File

@ -2,13 +2,16 @@
#include "ui_aboutwindow.h"
#include <QMessageBox>
#include "../node/Defaults.hpp"
#include "../node/Node.hpp"
AboutWindow::AboutWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutWindow)
{
ui->setupUi(this);
ui->aboutTextLabel->setText(QString("ZeroTier One\nVersion ")+ZeroTier::Node::versionString()+"\nQt Graphical User Interface\n\n(c)2011-2014 ZeroTier Networks LLC\n\nReleased under the terms of the GNU\nGeneral Public License v3.0, see: http://gplv3.fsf.org for terms.\n\nAuthor(s): Adam Ierymenko");
}
AboutWindow::~AboutWindow()

View File

@ -151,13 +151,6 @@
<bold>false</bold>
</font>
</property>
<property name="text">
<string>ZeroTier One GUI
(c)2012-2013 ZeroTier Networks LLC
Author(s): Adam Ierymenko
Version: 1.0</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>

View File

@ -106,16 +106,14 @@ void InstallDialog::on_networkReply(QNetworkReply *reply)
QApplication::exit(1);
return;
}
QProcess::execute(installHelperPath,QStringList());
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
QMessageBox::critical(this,"Installation Failed","Installation failed. Are you sure you entered your password correctly?",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
}
// Terminate the GUI and execute the install helper instead
::execl(installHelperPath.toStdString().c_str(),installHelperPath.toStdString().c_str(),(const char *)0);
// We only make it here if execl() failed
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
((QMainWindow *)this->parent())->setHidden(false);
this->close();
return;
#endif
} break;

View File

@ -69,6 +69,19 @@ MainWindow::MainWindow(QWidget *parent) :
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget* widget, widgets)
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
#ifdef __APPLE__
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
// If the service is not installed, download the installer and run it
// for the first time.
this->setEnabled(false);
InstallDialog *id = new InstallDialog(this);
id->setModal(true);
id->show();
this->setHidden(true);
return;
}
#endif
}
MainWindow::~MainWindow()
@ -90,21 +103,15 @@ void MainWindow::timerEvent(QTimerEvent *event)
std::string authToken;
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
#ifdef __APPLE__
//if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
if (false) {
if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
// Run the little AppleScript hack that asks for admin credentials and
// then installs the auth token file in the current user's home.
QMessageBox::information(this,"Authorization Required","You must authenticate to authorize this user to\nadministrate ZeroTier One on this computer.\n\n(This only needs to be done once.)",QMessageBox::Ok,QMessageBox::NoButton);
QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
if (!QFile::exists(authHelperPath)) {
// Allow this to also work from the source tree if it's run from there.
// This is for debugging purposes and shouldn't harm the live release
// in any way.
authHelperPath = QCoreApplication::applicationDirPath() + "/../../../../ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet";
if (!QFile::exists(authHelperPath)) {
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
}
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
}
QProcess::execute(authHelperPath,QStringList());
} else {

View File

@ -18,8 +18,8 @@
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <path to secret signing identity> <path to destination folder for .nfo and installer>"
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <path to secret signing identity>"
exit 1
fi
@ -29,16 +29,11 @@ if [ ! -e zerotier-idtool ]; then
fi
secret="$1"
dest="$2"
if [ ! -e "$secret" ]; then
echo "Can't find $secret"
exit 1
fi
if [ ! -d "$dest" ]; then
echo "Can't find $dest directory"
exit 1
fi
for inst in `ls ZeroTierOneInstaller-*-*-*_*_*`; do
echo "Found installer: $inst"
@ -51,6 +46,4 @@ for inst in `ls ZeroTierOneInstaller-*-*-*_*_*`; do
echo "signedBy=`cat $secret | cut -d : -f 1`" >>"$nfo"
echo "ed25519=`./zerotier-idtool sign $secret $inst`" >>"$nfo"
echo "url=http://download.zerotier.com/$inst" >>"$nfo"
cp $inst $nfo $dest
rm -f $nfo
done

View File

@ -0,0 +1,5 @@
#!/bin/bash
# Completely useless to outsiders. :)
scp ZeroTierOneInstaller-*-*-*_*_* nyarlathotep.zerotier.com:/www/download.zerotier.com/htdocs

View File

@ -23,7 +23,7 @@ if [ $dryRun -gt 0 ]; then
fi
zthome="/Library/Application Support/ZeroTier/One"
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne'`
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | sort | head -n 1`
if [ ! -d "$ztapp" ]; then
ztapp="/Applications/ZeroTier One.app"
fi

View File

@ -2,7 +2,7 @@
zthome="/Library/Application Support/ZeroTier/One"
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$zthome"
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne'`
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | sort | head -n 1`
# Clean all other stuff off the system if the user has trashed the .app
if [ -z "$ztapp" -o ! -d "$ztapp" ]; then

View File

@ -3,7 +3,7 @@
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
zthome="/Library/Application Support/ZeroTier/One"
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne'`
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | sort | head -n 1`
if [ "$UID" -ne 0 ]; then
echo "Must be run as root; try: sudo $0"

View File

@ -132,12 +132,8 @@ static inline const char *_mkUpdateUrl()
#endif
#ifdef __APPLE__
#ifdef TARGET_OS_IPHONE
// TODO
#else
return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo";
#define GOT_UPDATE_URL
#endif
#endif
// TODO: Windows