Last active
August 27, 2024 13:30
-
-
Save vcheckzen/a964af9d2c39d8f8f855fe4c06f4e005 to your computer and use it in GitHub Desktop.
Patch bins to write syslog to another place other than /dev/log
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
#!/bin/sh | |
# https://unix.stackexchange.com/questions/277202/use-a-different-socket-than-dev-log-system-wide | |
# https://blog.daveeddy.com/2018/09/26/logging-for-runit-on-void-linux-with-svlogger/ | |
# Define the new and old log paths | |
NEW_LOG_PATH="/ved/log" | |
OLD_LOG_PATH="/dev/log" | |
# Function to patch binaries | |
patch_binaries() { | |
echo "Patching binaries to use $NEW_LOG_PATH instead of $OLD_LOG_PATH..." | |
# Find and patch binaries, excluding /dev, /proc, and /sys | |
find / -path /dev -prune -o -path /proc -prune -o -path /sys -prune -o -type f \( -perm -111 \) -exec sed -i --binary -e "s|$OLD_LOG_PATH|$NEW_LOG_PATH|g" {} \; | |
echo "Binary patching completed." | |
} | |
# Function to patch libraries | |
patch_libraries() { | |
echo "Patching libraries to use $NEW_LOG_PATH instead of $OLD_LOG_PATH..." | |
# Find and patch libraries, excluding /dev, /proc, and /sys | |
find / -path /dev -prune -o -path /proc -prune -o -path /sys -prune -o -type f \( -name 'libc-*.so' -o -name '*.so*' \) -exec sed -i --binary -e "s|$OLD_LOG_PATH|$NEW_LOG_PATH|g" {} \; | |
echo "Library patching completed." | |
} | |
# Run the patching functions | |
patch_binaries | |
patch_libraries | |
echo "Patching process completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment