-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·62 lines (54 loc) · 1.56 KB
/
install
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/bash
# Set permissions
chmod 755 -R .
mkdir -p ~/.config # Create config directory if it doesn't exist
touch ~/.config/mnt.ini # Create config file if it doesn't exist
# Create a directory where additional files will be stored
sudo mkdir -p /usr/lib/mnt
sudo rm -rf /usr/lib/mnt/langs # Delete old dictionaries
sudo cp -r langs /usr/lib/mnt/langs # Copy dictionaries
sudo chmod 755 /usr/lib/mnt -R # Set permissions
# Fill in the configuration file with data from the template
if [[ -z $(cat ~/.config/mnt.ini) ]] # If config file is empty
then
source configure
else
echo -n The configuration file already exists, \
do you want to overwrite it? [Y/n] "" && read ans
if [[ $(echo $ans | tr [:upper:] [:lower:]) =~ ^y.*$ ]]
then
echo
./configure
echo
fi
fi
# Check dependencies
echo -e "\nChecking dependencies:"
OK=true
for var in whiptail sudo
do
if [[ -z $(command -v $var) ]]
then
OK=false
echo -e " \033[31m[X] $var\033[0m"
else
echo -e " \033[32m[✔] $var\033[0m"
fi
done
if [[ $OK == true ]]
then
echo -e "All dependencies are already installed\n"
else
echo -e "There are missing dependencies.
Please install them with your distribution's package manager\n"
fi
if [[ -z $(command -v mnt) ]]
then
# Copy program to binary directory
sudo cp ./mnt /usr/bin/
sudo chmod 755 /usr/bin/mnt
echo 'The program has been successfully installed on your computer'
else # If already installed
echo 'mnt already installed'
fi
exit 0 # The program worked without errors