mirror of https://github.com/BOINC/boinc.git
Mac Installer: command-line installs test for existence of files /tmp/nonadminusersok.txt and /tmp/setboincsaver.txt
svn path=/branches/boinc_core_release_6_12/; revision=22731
This commit is contained in:
parent
377229e169
commit
8c4cbcd21b
|
@ -7833,3 +7833,18 @@ Charlie 19 Nov 2010
|
|||
|
||||
mac_installer/
|
||||
PostInstall.cpp
|
||||
|
||||
Charlie 19 Nov 2010
|
||||
- Mac Installer: It turns out that the command-line installer clears all
|
||||
environment variables, so instead of checking environment variables
|
||||
during command-line installs, we check for the existence of files
|
||||
/tmp/nonadminusersok.txt and /tmp/setboincsaver.txt. In normal GUI
|
||||
installs, these are ignored and the normal BOINC installer dialogs
|
||||
are used to determine these options. See the comments at the top of
|
||||
PostInstall.cpp for details of doing command-line installs on remote
|
||||
Macs.
|
||||
|
||||
mac_installer/
|
||||
PostInstall.cpp
|
||||
postinstall
|
||||
postupgrade
|
||||
|
|
|
@ -17,15 +17,40 @@
|
|||
|
||||
/* PostInstall.cpp */
|
||||
|
||||
// SUPPORTED ENVIRONMENT VARIABLES:
|
||||
// COMMAND_LINE_INSTALL set if running the installer from the command line;
|
||||
// suppresses all dialogs. If set, the following 2
|
||||
// environment variables are also recognized:
|
||||
// Notes on command-line installation to a remote Mac:
|
||||
//
|
||||
// NONADMINUSERSOK Allow users without administrator privileges to
|
||||
// run BOINC Manager
|
||||
// When the installer is run from the Finder, this Postinstall.app will
|
||||
// display up to two dialogs, asking the user whether or not to:
|
||||
// [1] allow non-administrative users to run the BOINC Manager
|
||||
// (asked only if this Mac has any non-administrative users)
|
||||
// [2] set BOINC as the screensaver for all users who can run BOINC
|
||||
// (asked only if BOINC screensaver is not already set for them)
|
||||
//
|
||||
// SETBOINCSAVER Set BOINCSaver as screensaver for all BOINC users
|
||||
// The installer can also be run from the command line. This is useful
|
||||
// for installation on remote Macs. However, there is no way to respond
|
||||
// to dialogs during a command-line install.
|
||||
//
|
||||
// The command-line installer sets the following environment variable:
|
||||
// COMMAND_LINE_INSTALL=1
|
||||
// The postinstall script, postupgrade script, and this Postinstall.app
|
||||
// detect this environment variable and do the following:
|
||||
// * Redirect the Postinstall.app log output to a file
|
||||
// /tmp/BOINCInstallLog.txt
|
||||
// * Suppress the 2 dialogs
|
||||
// * test for the existence of a file /tmp/nonadminusersok.txt; if the
|
||||
// file exists, allow non-administrative users to run BOINC Manager
|
||||
// * test for the existence of a file /tmp/setboincsaver.txt; if the
|
||||
// file exists, set BOINC as the screensaver for all BOINC users.
|
||||
//
|
||||
// Example: To install on a remote Mac from the command line, allowing
|
||||
// non-admin users to run the BOINC Manager and setting BOINC as the
|
||||
// screensaver:
|
||||
// * First SCP the "BOINC Installer.pkg" to the remote Mac's /tmp
|
||||
// directory, then SSh into the remote mac and enter the following
|
||||
// $ touch /tmp/nonadminusersok.txt
|
||||
// $ touch /tmp/setboincsaver.txt
|
||||
// $ sudo installer -pkg "/tmp/BOINC Installer.pkg" -tgt /
|
||||
// $ sudo reboot
|
||||
//
|
||||
|
||||
#define CREATE_LOG 1 /* for debugging */
|
||||
|
@ -157,11 +182,17 @@ int main(int argc, char *argv[])
|
|||
receiptNameEscaped[2] = "/Library/Receipts/Progress\\ Thru\\ Processors.pkg";
|
||||
|
||||
::GetCurrentProcess (&ourProcess);
|
||||
|
||||
|
||||
puts("Starting PostInstall app\n");
|
||||
fflush(stdout);
|
||||
// getlogin() gives unreliable results under OS 10.6.2, so use environment
|
||||
strncpy(loginName, getenv("USER"), sizeof(loginName)-1);
|
||||
printf("login name = %s\n", loginName);
|
||||
|
||||
if (getenv("COMMAND_LINE_INSTALL") != NULL) {
|
||||
gCommandLineInstall = true;
|
||||
puts("command-line install\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
err = Gestalt(gestaltSystemVersion, &OSVersion);
|
||||
|
@ -343,6 +374,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
#ifdef SANDBOX
|
||||
err = CheckLogoutRequirement(&finalInstallAction);
|
||||
printf("CheckLogoutRequirement returned %d\n", finalInstallAction);
|
||||
|
||||
if (finalInstallAction == launchWhenDone) {
|
||||
// Wait for BOINC's RPC socket address to become available to user boinc_master, in
|
||||
|
@ -473,7 +505,6 @@ int DeleteReceipt()
|
|||
|
||||
Initialize();
|
||||
err = CheckLogoutRequirement(&finalInstallAction);
|
||||
|
||||
err = FindProcess ('APPL', 'xins', &installerPSN);
|
||||
if (err == noErr)
|
||||
err = GetProcessPID(&installerPSN , &installerPID);
|
||||
|
@ -552,7 +583,7 @@ OSStatus CheckLogoutRequirement(int *finalAction)
|
|||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
printf("In CheckLogoutRequirement: isMember=%d, currentUserCanRunBOINC=%d\n", (int)isMember, (int)currentUserCanRunBOINC);
|
||||
if (!isMember && !currentUserCanRunBOINC) {
|
||||
*finalAction = nothingrequired;
|
||||
return noErr;
|
||||
|
@ -939,6 +970,7 @@ OSErr UpdateAllVisibleUsers(long brandID)
|
|||
FILE *f;
|
||||
OSStatus err;
|
||||
Boolean isGroupMember;
|
||||
struct stat sbuf;
|
||||
#ifdef SANDBOX
|
||||
char *p;
|
||||
short i;
|
||||
|
@ -1064,7 +1096,11 @@ OSErr UpdateAllVisibleUsers(long brandID)
|
|||
puts("[2] All non-admin users are already members of group boinc_master\n");
|
||||
} else {
|
||||
if (gCommandLineInstall) {
|
||||
if (getenv("NONADMINUSERSOK") != NULL) {
|
||||
err = stat("/tmp/nonadminusersok.txt", &sbuf);
|
||||
if (err == noErr) {
|
||||
puts("nonadminusersok.txt file detected\n");
|
||||
fflush(stdout);
|
||||
unlink("/tmp/nonadminusersok.txt");
|
||||
allowNonAdminUsersToRunBOINC = true;
|
||||
currentUserCanRunBOINC = true;
|
||||
saverAlreadySetForAll = false;
|
||||
|
@ -1088,7 +1124,11 @@ OSErr UpdateAllVisibleUsers(long brandID)
|
|||
|
||||
if (! saverAlreadySetForAll) {
|
||||
if (gCommandLineInstall) {
|
||||
if (getenv("SETBOINCSAVER") != NULL) {
|
||||
err = stat("/tmp/setboincsaver.txt", &sbuf);
|
||||
if (err == noErr) {
|
||||
puts("setboincsaver.txt file detected\n");
|
||||
fflush(stdout);
|
||||
unlink("/tmp/setboincsaver.txt");
|
||||
setSaverForAllUsers = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
##
|
||||
# post-Install Script for Macintosh BOINC Manager for OS X revised 2/10/10
|
||||
# post-Install Script for Macintosh BOINC Manager for OS X revised 11/22/10
|
||||
##
|
||||
|
||||
echo "initial directory = $PWD"
|
||||
|
@ -17,9 +17,14 @@ if [ -f "Contents/Resources/acct_mgr_url.xml" ]; then
|
|||
cp -fp Contents/Resources/acct_mgr_url.xml "/Library/Application Support/BOINC Data/acct_mgr_url.xml"
|
||||
fi
|
||||
|
||||
# Run the Postinstall Application
|
||||
Run the Postinstall Application
|
||||
if [ "${COMMAND_LINE_INSTALL}" = "1" ]; then
|
||||
rm -f /tmp/BOINCInstallLog.txt
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part1 >> /tmp/BOINCInstallLog.txt
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part2 & >> /tmp/BOINCInstallLog.txt
|
||||
else
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part1
|
||||
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part2 &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
##
|
||||
# post-Upgrade Script for Macintosh BOINC Manager for OS X revised 2/10/10
|
||||
# post-Upgrade Script for Macintosh BOINC Manager for OS X revised 11/22/10
|
||||
##
|
||||
|
||||
echo "initial directory = $PWD"
|
||||
|
@ -18,8 +18,13 @@ if [ -f "Contents/Resources/acct_mgr_url.xml" ]; then
|
|||
fi
|
||||
|
||||
# Run the Postinstall Application
|
||||
if [ "${COMMAND_LINE_INSTALL}" = "1" ]; then
|
||||
rm -f /tmp/BOINCInstallLog.txt
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part1 >> /tmp/BOINCInstallLog.txt
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part2 & >> /tmp/BOINCInstallLog.txt
|
||||
else
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part1
|
||||
|
||||
Contents/Resources/PostInstall.app/Contents/MacOS/PostInstall -part2 &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue