[rkward] macports: added check for uninstaller setup to startup script

m.eik michalke null at kde.org
Tue Apr 10 13:50:55 UTC 2018


Git commit 95b64367c38146ecaf88c0fe8a2e1a31e530f324 by m.eik michalke.
Committed on 10/04/2018 at 13:50.
Pushed by meikm into branch 'master'.

added check for uninstaller setup to startup script

  - it's only being inserted into the startup script if installed via bundle package

M  +19   -4    macports/postinstall_with_uninstall

https://commits.kde.org/rkward/95b64367c38146ecaf88c0fe8a2e1a31e530f324

diff --git a/macports/postinstall_with_uninstall b/macports/postinstall_with_uninstall
index 4a8a43f4..036d33b4 100755
--- a/macports/postinstall_with_uninstall
+++ b/macports/postinstall_with_uninstall
@@ -50,9 +50,24 @@ EOF
   </dict>
 </plist>
 EOF
-  # link watch job
-  sudo -u "${INSTALLER_USER}" mkdir -p "~/Library/LaunchAgents"
-  sudo -u "${INSTALLER_USER}" ln -sf "${INSTDIR}/share/rkward/macOS/org.macports.kf5-rkward.plist" "~/Library/LaunchAgents/org.macports.kf5-rkward.plist"
-  sudo -u "${INSTALLER_USER}" launchctl load -w "$HOME/Library/LaunchAgents/org.macports.kf5-rkward.plist"
+  # add watch job agent to startup script
+  if [ $(file "$2/Applications/rkward.app/Contents/MacOS/rkward.rbackend" | grep text) ] ; then
+    sed -i -e "1 a \
+AGENT=\"org.macports.kf5-rkward\" \n\
+AGENTSDIR=\"~/Library/LaunchAgents\" \n\
+PLISTSOURCE=\"${INSTDIR}/share/rkward/macOS/\${AGENT}.plist\" \n\
+PLISTTARGET=\"\${AGENTSDIR}/\${AGENT}.plist\" \n\
+if [ -f \"\${PLISTSOURCE}\" ] ; then \n\
+  if ! [ -d \"\${AGENTSDIR}\" ] ; then \n\
+    mkdir -p \"\${AGENTSDIR}\" \n\
+  fi \n\
+  if ! [ -f \"\${PLISTTARGET}\" ] ; then \n\
+    ln -sf \"\${PLISTSOURCE}\" \"\${PLISTTARGET}\" \n\
+  fi \n\
+  if ! [ \$(launchctl list | grep \${AGENT}) ] ; then \n\
+    launchctl load -w \"\${PLISTTARGET}\" \n\
+  fi \n\
+fi" "$2/Applications/rkward.app/Contents/MacOS/rkward.rbackend"
+  fi
 fi
 exit 0



More information about the rkward-tracker mailing list