home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash
- exit 0
-
- INFO_PLIST="/Applications/NoMachine.app/Contents/Info.plist"
-
- if [ -f "${INFO_PLIST}" ];
- then
- version=`awk '/CFBundleShortVersionString/ {getline; print $0;}' /Applications/NoMachine.app/Contents/Info.plist | sed -e 's/.*<string>//' -e 's/<\/string>.*//'`
-
- if [ "x${version}" != "x4.0.370" ];
- then
- #update is not allowed; skip launching nxlaunchconf
- exit 0
- fi
- fi
-
- RESOURCES=/Applications/NoMachine.app/Contents/Resources/
- PLIST=com.nomachine.nxlaunchconf.plist
- USERNAME=`ps aux | grep loginwindow.app | grep -v grep | grep -m 1 loginwindow.app | awk '{print $1}' | head -n 1`
-
- NXLAUNCHCHECK=`launchctl list | grep com.nomachine.nxlaunchconf`
-
- if [ "x${NXLAUNCHCHECK}" != "x" ];
- then
- launchctl remove com.nomachine.nxlaunchconf
- fi
-
- sed "s|#USERNAME#|$USERNAME|" ${RESOURCES}/${PLIST} > ${RESOURCES}/${PLIST}.tmp
- mv ${RESOURCES}/${PLIST}.tmp ${RESOURCES}/${PLIST}
- sed "s|#ARG#|$0\.noconf|" ${RESOURCES}/${PLIST} > ${RESOURCES}/${PLIST}.tmp
- mv ${RESOURCES}/${PLIST}.tmp ${RESOURCES}/${PLIST}
- chown root ${RESOURCES}/${PLIST}
- launchctl load ${RESOURCES}/${PLIST}
-
- exit 0
-