Add macOS launchd files for automatic syncing

pull/328/head^2
Andrew Udvare 2020-11-08 02:25:17 -05:00
parent ffb744a59b
commit 346da4cf82
No known key found for this signature in database
GPG Key ID: 1AFD9AFC120C26DD
4 changed files with 81 additions and 0 deletions

View File

@ -23,5 +23,14 @@ if ( HAVE_SYSTEMD )
add_subdirectory( systemd )
endif( HAVE_SYSTEMD )
find_program(
HAVE_LAUNCHD launchd
PATHS /sbin
NO_DEFAULT_PATH
)
if ( HAVE_LAUNCHD )
add_subdirectory( launchd )
endif( HAVE_LAUNCHD )
add_subdirectory( libgrive )
add_subdirectory( grive )

27
launchd/CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
SET(GRIVE_SYNC_SH_BINARY "${CMAKE_INSTALL_PREFIX}/lib/grive/grive-sync.sh")
CONFIGURE_FILE(
com.github.vitalif.grive2.grive-changes.plist.in
com.github.vitalif.grive2.grive-changes.plist
@ONLY
)
CONFIGURE_FILE(
com.github.vitalif.grive2.grive-timer.plist.in
com.github.vitalif.grive2.grive-timer.plist
@ONLY
)
install(
FILES
${CMAKE_BINARY_DIR}/launchd/com.github.vitalif.grive2.grive-changes.plist
${CMAKE_BINARY_DIR}/launchd/com.github.vitalif.grive2.grive-timer.plist
DESTINATION
lib/launchd
)
install(
PROGRAMS
../systemd/grive-sync.sh
DESTINATION
lib/grive
)

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.vitalif.grive2.grive-changes</string>
<key>ProgramArguments</key>
<array>
<string>@GRIVE_SYNC_SH_BINARY@</string>
<string>listen</string>
<string>RELATIVE PATH FROM $HOME TO SYNC HERE</string>
</array>
<key>RunAtLoad</key>
<true />
<key>StandardOutPath</key>
<!-- Change HOME below to your $HOME path, e.g. /Users/name -->
<string>HOME/Library/Logs/grive2.log</string>
<key>StandardErrorPath</key>
<string>HOME/Library/Logs/grive2.log</string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.vitalif.grive2.grive-timer</string>
<key>ProgramArguments</key>
<array>
<string>@GRIVE_SYNC_SH_BINARY@</string>
<string>sync</string>
<string>RELATIVE PATH FROM $HOME TO SYNC HERE</string>
</array>
<key>RunAtLoad</key>
<true />
<key>StartInterval</key>
<!-- Every 5 minutes -->
<integer>300</integer>
<key>StandardOutPath</key>
<!-- Change HOME below to your $HOME path, e.g. /Users/name -->
<string>HOME/Library/Logs/grive2.log</string>
<key>StandardErrorPath</key>
<string>HOME/Library/Logs/grive2.log</string>
</dict>
</plist>