XNSim/Release/XNSetEnvironment.sh

33 lines
1.4 KiB
Bash
Raw Normal View History

2025-04-28 12:25:20 +08:00
#!/bin/bash
CURRENT_PATH=$(pwd)
mkdir -p "$CURRENT_PATH/shell"
if [ -f "$CURRENT_PATH/shell/XNCore.sh" ]; then
rm "$CURRENT_PATH/shell/XNCore.sh"
fi
if [ -f "$CURRENT_PATH/shell/XNCore.conf" ]; then
rm "$CURRENT_PATH/shell/XNCore.conf"
fi
echo "export XNCore=${CURRENT_PATH}" >> "$CURRENT_PATH/shell/XNCore.sh"
echo "export PATH=\$XNCore:\$PATH" >> "$CURRENT_PATH/shell/XNCore.sh"
echo "export LD_LIBRARY_PATH=\$XNCore/lib:\$LD_LIBRARY_PATH" >> "$CURRENT_PATH/shell/XNCore.sh"
echo "export QT_QPA_PLATFORM=xcb" >> "$CURRENT_PATH/shell/XNCore.sh"
echo "export QT_PLUGIN_PATH=\$XNCore/platforms" >> "$CURRENT_PATH/shell/XNCore.sh"
chmod +x "$CURRENT_PATH/shell/XNCore.sh"
echo "$CURRENT_PATH/lib" >> "$CURRENT_PATH/shell/XNCore.conf"
echo "$CURRENT_PATH/Models" >> "$CURRENT_PATH/shell/XNCore.conf"
echo "$CURRENT_PATH/Services" >> "$CURRENT_PATH/shell/XNCore.conf"
sudo cp "$CURRENT_PATH/shell/XNCore.sh" /etc/profile.d/
sudo cp "$CURRENT_PATH/shell/XNCore.conf" /etc/ld.so.conf.d/
sudo ldconfig
sudo setcap cap_sys_nice+ep $CURRENT_PATH/XNEngine
read -p "Do you want to log out immediately to apply the environment variables? (y/n) " choice
if [[ "$choice" == "y" ]]; then
echo "Logging out..."
# Command to log out the user (this may vary based on the system)
gnome-session-quit --logout --no-prompt
else
echo "You can log out later to apply the changes."
fi