Skip to content

Commit a85d29d

Browse files
committed
Added sudo to move the binary to /usr/bin
1 parent 8ce3db1 commit a85d29d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

install.sh

+12-10
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,38 @@ install_sfml() {
4444

4545
main() {
4646
# Select option
47+
4748
echo "Where do you want to install the visualizer?"
48-
echo "1.- Compile and leave the executable in this folder"
49-
echo "2.- Compile and move the executable into /usr/bin"
49+
echo "1.- Compile and leave the executable in this directory"
50+
echo "2.- Compile and move the executable into /usr/bin (requires root)"
5051
echo ""
5152
read -n 1 -p "Option: " option
5253
echo ""
5354
echo ""
5455

55-
# Compile
56+
# 1: Compile
5657
if [ "$option" = "1" ]; then
5758
compile
5859

5960
echo "Done!"
6061
exit
6162

62-
# Compile and move binary to /usr/bin
63+
# 2: Compile and move binary to /usr/bin
6364
elif [ "$option" = "2" ]; then
64-
# Check if has been runned as sudo
65-
if [ "$EUID" -ne 0 ]
66-
then echo "Please, run as root! (sudo ./install.sh)"
67-
exit
68-
fi
6965

7066
compile
7167

7268
# Move executable to /usr/bin
7369
echo Moving executable into /usr/bin...
74-
mv ./sorting-visualizer /usr/bin
70+
sudo mv ./sorting-visualizer /usr/bin
7571
echo Done!
7672
exit
73+
74+
# -: Not a valid option
75+
else
76+
echo "Select a valid option!"
77+
exit
78+
7779
fi
7880
}
7981

0 commit comments

Comments
 (0)