mirror of
https://github.com/EnderIce2/rpc-bridge.git
synced 2025-05-25 22:14:38 +00:00
Modified README and added warning in bridge.c
This commit is contained in:
parent
8dd5952a64
commit
dcd9cf520e
@ -52,7 +52,8 @@ Logs are stored in `C:\windows\logs\bridge.log`.
|
||||
|
||||
## macOS
|
||||
|
||||
On macOS, follow [these instructions](https://enderice2.github.io/rpc-bridge/installation.html#macos).
|
||||
The steps to install are almost the same. The only difference is that if you want the service to work, you will have to use [this script](macos.sh) to install a launch agent that will symlink the `$TMPDIR` to a static path (`/tmp/rpc-bridge/tmpdir`).
|
||||
To do so, download it, make it executable (`chmod +x macos.sh`) and run `./macos.sh install`. You can uninstall the agent by running `./macos.sh uninstall`.
|
||||
|
||||
## Compiling from source
|
||||
|
||||
|
2
bridge.c
2
bridge.c
@ -262,7 +262,7 @@ void ConnectToSocket(int fd)
|
||||
DWORD dwAttrib = GetFileAttributes(runtime);
|
||||
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
print("IPC directory does not exist: %s\n", runtime);
|
||||
print("IPC directory does not exist: %s. If you're on MacOS, see the github guide on how to install the launchd service.\n", runtime);
|
||||
// Handle the case where the directory doesn't exist
|
||||
// For example, create the directory
|
||||
if (!RunningAsService)
|
||||
|
88
macos.sh
Normal file
88
macos.sh
Normal file
@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define target directory
|
||||
TARGET_DIR=/tmp/rpc-bridge/tmpdir
|
||||
P_DIR=$(dirname "$TARGET_DIR")
|
||||
FILE_PATH=$P_DIR/link
|
||||
|
||||
# Function to create the symlink and launch agent
|
||||
function install_link() {
|
||||
|
||||
if [ ! -d "$P_DIR" ]; then
|
||||
mkdir -p "$P_DIR"
|
||||
fi
|
||||
|
||||
cat << EOF > "$FILE_PATH"
|
||||
#!/bin/bash
|
||||
TARGET_DIR=/tmp/rpc-bridge/tmpdir
|
||||
if [ ! -d "\$TARGET_DIR" ]; then
|
||||
mkdir -p "\$TARGET_DIR"
|
||||
fi
|
||||
rm -rf "\$TARGET_DIR"
|
||||
ln -s "\$TMPDIR" "\$TARGET_DIR"
|
||||
EOF
|
||||
|
||||
chmod +x "$FILE_PATH"
|
||||
|
||||
# Launch agent plist file path
|
||||
PLIST_FILE=~/Library/LaunchAgents/com.rpc-bridge.tmp-symlink.plist
|
||||
|
||||
# Create the launch agent plist with escaped variable
|
||||
cat << EOF > "$PLIST_FILE"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST File Format//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.rpc-bridge.tmp-symlink</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>$FILE_PATH</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Load the launch agent
|
||||
launchctl load "$PLIST_FILE"
|
||||
echo "Symlink created and launch agent installed."
|
||||
}
|
||||
|
||||
# Function to remove the symlink and launch agent (unchanged)
|
||||
function remove_link() {
|
||||
# Remove the symlink
|
||||
rm -rf "$TARGET_DIR"
|
||||
|
||||
# Launch agent plist file path
|
||||
PLIST_FILE=~/Library/LaunchAgents/com.rpc-bridge.tmp-symlink.plist
|
||||
|
||||
# Unload the launch agent
|
||||
launchctl unload "$PLIST_FILE"
|
||||
|
||||
# Remove the files
|
||||
rm -f "$PLIST_FILE"
|
||||
rm -f "$FILE_PATH"
|
||||
echo "Symlink removed and launch agent uninstalled."
|
||||
}
|
||||
|
||||
# Check for user input
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 (install|remove)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Action based on user input
|
||||
case $1 in
|
||||
install)
|
||||
install_link
|
||||
;;
|
||||
remove)
|
||||
remove_link
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument. Please use 'install' or 'remove'."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
x
Reference in New Issue
Block a user