Browse Source

make it a LaunchAgent

works_for_me
Volker Birk 2 years ago
parent
commit
c67aaafbbb
3 changed files with 34 additions and 2 deletions
  1. +16
    -1
      pEpMacOSAdapter/Makefile
  2. +16
    -0
      pEpMacOSAdapter/foundation.pEp.adapter.macOS.plist
  3. +2
    -1
      pEpMacOSAdapter/main.m

+ 16
- 1
pEpMacOSAdapter/Makefile View File

@ -24,6 +24,7 @@ else
endif
TARGET=foundation.pEp.adapter.macOS
INSTALL_TARGET=/Library/Application Support/pEp
ALL_SOURCE=$(wildcard *.m) $(wildcard *.mm)
DEPENDS=$(subst .m,.d,$(subst .mm,.d,$(ALL_SOURCE)))
@ -57,7 +58,21 @@ endif
%.o: %.mm
$(CXX) $(CXXFLAGS) -c -o $@ $^
.PHONY: clean
.PHONY: clean uninstall install unload load
load:
launchctl load /Library/LaunchAgents/foundation.pEp.adapter.macOS.plist
unload:
launchctl unload /Library/LaunchAgents/foundation.pEp.adapter.macOS.plist
install:
sudo install -c foundation.pEp.adapter.macOS "$(INSTALL_TARGET)/foundation.pEp.adapter.macOS"
sudo install -c foundation.pEp.adapter.macOS.plist "/Library/LaunchAgents/foundation.pEp.adapter.macOS.plist"
uninstall:
sudo rm -f "$(INSTALL_TARGET)/foundation.pEp.adapter.macOS"
sudo rm -f "/Library/LaunchAgents/foundation.pEp.adapter.macOS.plist"
clean:
rm -f *.o $(TARGET)

+ 16
- 0
pEpMacOSAdapter/foundation.pEp.adapter.macOS.plist View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- Copyleft (c) 2020 by p≡p foundation -->
<!-- this file is under GNU General Public License 3.0 -->
<dict>
<key>Label</key>
<string>foundation.pEp.adapter.macOS</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Application Support/pEp/foundation.pEp.adapter.macOS</string>
</array>
<key>LimitLoadToSessionType</key>
<string>Aqua</string>
</dict>
</plist>

+ 2
- 1
pEpMacOSAdapter/main.m View File

@ -48,6 +48,7 @@ int main(int argc, const char *argv[])
// Set up the one NSXPCListener for this service. It will handle all incoming connections.
NSXPCListener *listener = [[NSXPCListener alloc] initWithMachServiceName:@"foundation.pEp.adapter.macOS"];
listener.delegate = delegate;
[listener resume];
return 0;
}

Loading…
Cancel
Save