meta: add homebrew package for macOS

pull/48/head
Jake McGinty 2021-04-09 16:22:50 +09:00
parent 6b6cb07690
commit eedb5758c9
2 changed files with 9 additions and 65 deletions

View File

@ -172,7 +172,15 @@ sudo apt install ./innernet*.deb
### macOS
```sh
./macos/install.sh
brew install tonarino/innernet/innernet
```
### Cargo
```sh
git checkout https://github.com/tonarino/innernet
cd innernet
cargo install --path client
```
## Development

View File

@ -1,64 +0,0 @@
#!/usr/bin/env bash
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)"
info() {
TERM=${TERM:-dumb} echo -e "$(tput setaf 4)- $@$(tput sgr0)" 1>&2
}
cmd() {
echo "[#] $*" >&2
"$@"
}
set -e
info "building innernet binary."
cmd cargo build --release --bin innernet
info "installing innernet binary."
cmd sudo cp -f $ROOT_DIR/target/release/innernet /usr/local/bin
cmd sudo ln -s /usr/local/bin/innernet /usr/local/bin/inn
if ! which wg > /dev/null; then
info "installing wireguard."
cmd brew install wireguard-tools
fi
info "installing launch daemon for innernet daemon script."
echo "\
<?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>no.tonari.innernet</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/innernet</string>
<string>fetch</string>
<string>--daemon</string>
<string>--interval</string>
<string>60</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/innernet.log</string>
<key>StandardErrorPath</key>
<string>/var/log/innernet.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
</dict>
</plist>
" | cmd sudo tee /Library/LaunchDaemons/no.tonari.innernet.plist
cmd sudo launchctl enable system/no.tonari.innernet
cmd sudo launchctl bootstrap system /Library/LaunchDaemons/no.tonari.innernet.plist