Add support for OpenWRT
[pulga.git] / install_pulga.sh
blobcf3f84d3f29958c58c4228c6cb3591e12064e77e
1 #!/bin/bash
3 # the binary is going to be installed to the following dir:
4 INSTALL_PATH="$HOME/.local/bin"
6 # make the directory if it doesn't exist already
7 if [ -d $INSTALL_PATH ]; then
8 echo "The directory: \"$INSTALL_PATH\" already exists"; # nothing to do
9 else
10 mkdir $INSTALL_PATH -pv; # p so it's recursive (.local may not exist) and
11 # v so it prints it to the terminal screen
14 # check if .local/bin is in the path env variable
15 if [ $(echo $PATH | grep -i $INSTALL_PATH) ] ; then
16 echo "The directory is already in the PATH variable, cool!"; # nothing to do
17 else
18 echo "The directory is not in the PATH variable, I'll add it for you...";
19 echo "export PATH=$PATH:$INSTALL_PATH" >> ~/.profile; # the profile file will be
20 # executed on user login
21 export PATH="$PATH:$INSTALL_PATH"; # export it for the current terminal session too
22 echo "Done!";
25 # compile the thing
26 echo "Compiling pulga...";
27 cargo build --release;
29 # move the binary to the directory previously created
30 echo "Moving the pulga binary...";
31 cp target/release/pulga $INSTALL_PATH && \
32 chmod +x $INSTALL_PATH/pulga; # make it executable, just in case...
34 # notify the user when the installation is done, and what to do next
35 echo " Try running the 'pulga' command now.";