1
1
#! /bin/bash
2
- # TODO: update readme.
2
+
3
+ # Source logo and usage.
4
+ source ./lib/utils.sh
5
+
6
+ # Move other files in this dir to /home/$USER/filefighter/
7
+ SCRIPTS_LOCATION=" /home/$USER /filefighter"
8
+
9
+ # Move ffighter to this dir.
10
+ APPLICATION_LOCATION=" /usr/bin"
3
11
4
12
# Read in base dir for Path.
5
- rootDir=$( realpath $0 )
6
- rootDir=${rootDir/% Install.sh} # Very HACKY YES.
7
- newPATH=" PATH=$PATH :$rootDir "
8
-
9
- # Add main script to PATH.
10
- # Check files.
11
- profile=" /home/$USER /.bash_profile"
12
- login=" /home/$USER /.bash_login"
13
- rc=" /home/$USER /.bashrc"
14
-
15
- commandToRun=" "
16
- # Checking command.
17
- ffighter > /dev/null 2>&1
18
-
19
- if [ $? == 127 ]; then # command does not exist add it to path
20
- echo " Adding FileFighter Application to PATH..."
21
- if [[ -f " $profile " ]]; then
22
- echo " $newPATH " >> " $profile "
23
- commandToRun=" source $profile "
24
- elif [[ -f " $login " ]]; then
25
- echo " $newPATH " >> " $login "
26
- commandToRun=" source $login "
27
- elif [[ -f " $rc " ]]; then
28
- echo " $newPATH " >> " $rc "
29
- commandToRun=" source $rc "
30
- else
31
- echo " Couldn't add FileFighter Application to PATH. Please contact us at [email protected] ."
32
- echo " Or add following line to your PATH variable:"
33
- echo " $rootDir "
34
- exit 1
35
- fi
36
-
37
- echo " Adding FileFighter Application to PATH was successful."
38
- echo " Please run the following command to finish the installation."
39
- echo " "
40
- echo $commandToRun
41
- else
42
- echo " FileFighter Application already available"
43
- echo " Use: ffighter <args>."
13
+ DOWNLOAD_LOCATION=$( realpath $0 )
14
+ DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION/% Install.sh} # Very HACKY YES.
15
+
16
+ VERSION=" v1.6"
17
+ DATE=" 24.01.21"
18
+
19
+ echoLogo $VERSION $DATE " Initial Install"
20
+
21
+ if [ ! -d " /home/$USER " ]; then
22
+ echo " Home directory for the current user not found. If you are root, switch to a user with a directory under /home/"
23
+ exit 1
44
24
fi
25
+
26
+ if [ ! -d $SCRIPTS_LOCATION ]; then
27
+ echo " Creating Install Location under $SCRIPTS_LOCATION "
28
+ mkdir $SCRIPTS_LOCATION
29
+ fi
30
+
31
+ echo " Copying Scripts to new location..."
32
+ cd $DOWNLOAD_LOCATION
33
+ cp -r . $SCRIPTS_LOCATION
34
+
35
+ echo " Copying FileFighter Application to $APPLICATION_LOCATION ..."
36
+ echo " This may need administrator rights (sudo) if you are not root."
37
+ sudo cp $DOWNLOAD_LOCATION /ffighter $APPLICATION_LOCATION
38
+
39
+ echo " "
40
+ echo " Successfully installed FileFighter!"
41
+ echo " You can delete the downloaded files ($DOWNLOAD_LOCATION ) if you want."
42
+ echo " "
43
+ printUsage
0 commit comments