Skip to content

Commit b8b1516

Browse files
author
Artur Bać
committedMar 10, 2024
improve install script
1 parent d3aea8b commit b8b1516

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed
 

‎install.sh

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
11
#!/bin/bash
22

3-
# Define source and destination paths
4-
# SOURCE="build/debug/bin/kdevcxx_with_ai.so"
3+
# Source file
54
SOURCE="build/clang-release/bin/kdevcxx_with_ai.so"
6-
DESTINATION="/usr/lib64/qt5/plugins/kdevplatform/513/kdevcxx_with_ai.so"
75

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
931
sudo cp "$SOURCE" "$DESTINATION"
1032

11-
# Check if the copy operation was successful
33+
# Verify the copy operation
1234
if [ $? -eq 0 ]; then
13-
echo "Copy operation successful."
35+
echo "Plugin installation successful."
1436
else
15-
echo "Copy operation failed."
37+
echo "Plugin installation failed."
1638
fi
17-

0 commit comments

Comments
 (0)