installer script does not quite work yet
parent
5d9fdf248e
commit
51bdcd12da
|
@ -1528,8 +1528,10 @@ void MainWindow::on_actionStartServer_triggered() {
|
|||
|
||||
void MainWindow::on_actionEnableCommandLine_triggered() {
|
||||
if (QMessageBox::question(this, tr("Enable command line access"),
|
||||
tr("<p>If you proceed, Mitsuba will create symbolic links in <tt>/usr/bin</tt> and <tt>/Library/Python/2.6/site-packages</tt> "
|
||||
"that make it possible to use the renderer via the command line and Python. Any old symlinks will simply be overwritten.</p><p>Proceed?</p>"),
|
||||
tr("<p>If you proceed, Mitsuba will create symbolic links in <tt>/usr/bin</tt> and <tt>/Library/Python/2.6/site-packages</tt>, "
|
||||
"which enable command line and Python usage. Note that you will have to "
|
||||
"repeat this process every time the Mitsuba application is moved.</p>"
|
||||
"<p>Create links?</p>"),
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
if (!create_symlinks())
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
#include <Authorization.h>
|
||||
#include <AuthorizationTags.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace mitsuba {
|
||||
extern std::string __ubi_bundlepath();
|
||||
};
|
||||
|
||||
bool create_symlinks() {
|
||||
AuthorizationFlags flags = kAuthorizationFlagDefaults;
|
||||
|
@ -23,8 +28,9 @@ bool create_symlinks() {
|
|||
AuthorizationFree(ref, kAuthorizationFlagDefaults);
|
||||
return false;
|
||||
}
|
||||
char *path = "/bin/bash";
|
||||
char *args[] = { "data/install-symlinks.sh", NULL };
|
||||
char *path = "/usr/bin/sudo";
|
||||
std::string scriptPath = mitsuba::__ubi_bundlepath() + "/data/install-symlinks.sh";
|
||||
char *args[] = { "bash", const_cast<char *>(scriptPath.c_str()), NULL };
|
||||
FILE *pipe = pipe = NULL;
|
||||
flags = kAuthorizationFlagDefaults;
|
||||
status = AuthorizationExecuteWithPrivileges(ref, path, flags, args, &pipe);
|
||||
|
|
Loading…
Reference in New Issue