|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 |
| -# Define source and destination paths |
4 |
| -# SOURCE="build/debug/bin/kdevcxx_with_ai.so" |
| 3 | +# Source file |
5 | 4 | SOURCE="build/clang-release/bin/kdevcxx_with_ai.so"
|
6 |
| -DESTINATION="/usr/lib64/qt5/plugins/kdevplatform/513/kdevcxx_with_ai.so" |
7 | 5 |
|
8 |
| -# Use sudo to copy the file to the destination |
| 6 | +# Search for kdevclangsupport.so and update DESTINATION |
| 7 | +FOUND=$(find /usr -type f -name kdevclangsupport.so 2>/dev/null | head -n 1) |
| 8 | +if [[ -z "$FOUND" ]]; then |
| 9 | + echo "kdevelop plugin directory not found." |
| 10 | + exit 1 |
| 11 | +else |
| 12 | + DESTINATION="${FOUND/kdevclangsupport.so/kdevcxx_with_ai.so}" |
| 13 | +fi |
| 14 | + |
| 15 | +echo "The file $SOURCE will be copied to $DESTINATION using sudo mode, requiring elevated permissions." |
| 16 | +echo "Do you want to continue? [Y/N]" |
| 17 | +read -r CONFIRM |
| 18 | +if [[ "$CONFIRM" != "Y" && "$CONFIRM" != "y" ]]; then |
| 19 | + echo "Operation cancelled." |
| 20 | + exit 0 |
| 21 | +fi |
| 22 | + |
| 23 | +echo "Are you absolutely sure? What if I wipe out your system in sudo mode? [Y/N]" |
| 24 | +read -r CONFIRM_AGAIN |
| 25 | +if [[ "$CONFIRM_AGAIN" != "Y" && "$CONFIRM_AGAIN" != "y" ]]; then |
| 26 | + echo "Operation cancelled." |
| 27 | + exit 0 |
| 28 | +fi |
| 29 | + |
| 30 | +# Copy the file to the destination using sudo |
9 | 31 | sudo cp "$SOURCE" "$DESTINATION"
|
10 | 32 |
|
11 |
| -# Check if the copy operation was successful |
| 33 | +# Verify the copy operation |
12 | 34 | if [ $? -eq 0 ]; then
|
13 |
| - echo "Copy operation successful." |
| 35 | + echo "Plugin installation successful." |
14 | 36 | else
|
15 |
| - echo "Copy operation failed." |
| 37 | + echo "Plugin installation failed." |
16 | 38 | fi
|
17 |
| - |
|
0 commit comments