-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.sh
executable file
·40 lines (40 loc) · 1.16 KB
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
id | grep sudo >/dev/null
sudo="$?"
if [ "$sudo" == "0" ];then
##User is Sudo
sudo cp dns-fixer.sh /usr/bin/dns-fixer
cpfile="$?"
sudo chmod +x /usr/bin/dns-fixer
perm="$?"
if [ "$perm" == "0" ] && [ "$cpfile" == "0" ] ;then
echo -e "\033[92mThe Application Hase Been Installed Sucsessfully!"
exit 0
else
echo -e "\033[91mInstalltion Failed!"
exit 1
fi
else
##User Is'nt Sudo
read -p "Because you are not in the SUDO group, we have to copy the files in your /home directory. Do you give us that permission? (Y|n) " install_for_user
if [ "$install_for_user" == "Y" ] || [ "$install_for_user" == "y" ] || [ "$install_for_user" == "" ] ; then
mkdir -p "~/bin"
make_dir="$?"
cp dns-fixer.sh ~/bin/dns-fixer
copy_file="$?"
chmod +x ~/bin/dns-fixer
change_mode="$?"
if [ "$make_dir" == "0" ] && [ "$copy_file" == "0" ] && [ "$change_mode" == "0" ] ;then
PATH="$PATH:/home/$USER/bin"
echo "PATH="$PATH:/home/$USER/bin"" >> ~/.bashrc
echo -e "\033[92mThe Application Hase Been Installed for your User, Sucsessfully!"
exit 0
else
echo -e "\033[91mInstalltion Failed!"
exit 1
fi
else
echo "Abort."
exit 1
fi
fi