mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
DARWIN: Convert prefpane start/stop to privhelper
Convert the logic to "start/stop OpenAFS" in the prefpane to use privhelper, so it can work with macOS 10.8+. Specifically, define these new privhelper tasks: - afsd_start - afsd_stop And convert our start/stop-related code in the prefpane to use them. Change-Id: I4cc5b500fb09b83a4007e2c7c5045e93fe1f4ced Reviewed-on: https://gerrit.openafs.org/15958 Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
parent
89eafda960
commit
56915e96d8
@ -1077,12 +1077,8 @@
|
||||
// -------------------------------------------------------------------------------
|
||||
-(void) shutdown
|
||||
{
|
||||
NSString *rootHelperApp = [[NSBundle bundleForClass:[self class]] pathForResource:@"afshlp" ofType:@""];
|
||||
@try {
|
||||
const char *stopArgs[] = {AFS_DAEMON_STARTUPSCRIPT, "stop", 0L};
|
||||
[[AuthUtil shared] execUnixCommand:[rootHelperApp fileSystemRepresentation]
|
||||
args:stopArgs
|
||||
output:nil];
|
||||
[TaskUtil executePrivTask:"afsd_stop"];
|
||||
}
|
||||
@catch (NSException * e) {
|
||||
@throw e;
|
||||
@ -1097,12 +1093,8 @@
|
||||
// -------------------------------------------------------------------------------
|
||||
-(void) startup
|
||||
{
|
||||
NSString *rootHelperApp = [[NSBundle bundleForClass:[self class]] pathForResource:@"afshlp" ofType:@""];
|
||||
@try {
|
||||
const char *startArgs[] = {AFS_DAEMON_STARTUPSCRIPT, "start", 0L};
|
||||
[[AuthUtil shared] execUnixCommand:[rootHelperApp fileSystemRepresentation]
|
||||
args:startArgs
|
||||
output:nil];
|
||||
[TaskUtil executePrivTask:"afsd_start"];
|
||||
}
|
||||
@catch (NSException * e) {
|
||||
@throw e;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define PRIVHELPER_ID "org.openafs.privhelper"
|
||||
#define AFS_ID "org.openafs.filesystems.afs"
|
||||
#define AFS_PLIST "/Library/LaunchDaemons/org.openafs.filesystems.afs.plist"
|
||||
#define AFS_RC "/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.rc"
|
||||
|
||||
/*
|
||||
* This is the code signing requirement imposed on anyone that connects to our
|
||||
@ -217,6 +218,10 @@ RunCommand(int log_failure, const char *arg1, const char *arg2,
|
||||
* - startup_check: Run "launchctl list" to check whether OpenAFS is configured
|
||||
* to run at startup. If it is, return 0; otherwise, return nonzero.
|
||||
*
|
||||
* - afsd_start: Run "afs.rc start" to start the OpenAFS client.
|
||||
*
|
||||
* - afsd_stop: Run "afs.rc stop" to stop the OpenAFS client.
|
||||
*
|
||||
* @param[in] task The name of the requested task.
|
||||
* @param[in] event The XPC dictionary containing other task-specific
|
||||
* arguments.
|
||||
@ -238,6 +243,12 @@ ProcessRequest(const char *task, xpc_object_t event)
|
||||
|
||||
} else if (strcmp(task, "startup_check") == 0) {
|
||||
return RunCommand(0, LAUNCHCTL, "list", AFS_ID, NULL);
|
||||
|
||||
} else if (strcmp(task, "afsd_start") == 0) {
|
||||
return RunCommand(1, AFS_RC, "start", NULL, NULL);
|
||||
|
||||
} else if (strcmp(task, "afsd_stop") == 0) {
|
||||
return RunCommand(1, AFS_RC, "stop", NULL, NULL);
|
||||
}
|
||||
|
||||
syslog(LOG_WARNING, "%s: Received unknown task '%s'", PRIVHELPER_ID, task);
|
||||
|
Loading…
Reference in New Issue
Block a user