Files
easyzsh/install_merlin_worker.sh

37 lines
1.3 KiB
Bash

#!/bin/bash
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s merlin_worker
# Check if ~/.bashrc exists and contains PYTHONPATH export
if [ -f "$HOME/.bashrc" ]; then
# Extract PYTHONPATH from ~/.bashrc (look for export PYTHONPATH=...)
BASHRC_PYTHONPATH=$(grep -E "^export PYTHONPATH=" "$HOME/.bashrc" | tail -1)
if [ -n "$BASHRC_PYTHONPATH" ]; then
echo "Found PYTHONPATH in ~/.bashrc: $BASHRC_PYTHONPATH"
# Path to the merlin_worker.zsh file
MERLIN_CONFIG="$HOME/.config/zshrc/merlin_worker.zsh"
if [ -f "$MERLIN_CONFIG" ]; then
# Create a backup
cp "$MERLIN_CONFIG" "$MERLIN_CONFIG.backup"
# Replace the last PYTHONPATH line in merlin_worker.zsh with the one from ~/.bashrc
# First, remove existing PYTHONPATH lines
sed -i '/^export PYTHONPATH=/d' "$MERLIN_CONFIG"
# Then append the PYTHONPATH from ~/.bashrc
echo "$BASHRC_PYTHONPATH" >> "$MERLIN_CONFIG"
echo "Updated PYTHONPATH in $MERLIN_CONFIG with value from ~/.bashrc"
else
echo "Warning: $MERLIN_CONFIG not found"
fi
else
echo "No PYTHONPATH export found in ~/.bashrc"
fi
else
echo "~/.bashrc not found"
fi