aboutsummaryrefslogtreecommitdiff
path: root/install
blob: 1ea78fc2c52f64ac46dadf288bcef75cfb3fb8fe (plain) (blame)
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
#!/bin/bash

echo "[*] Thanks for landing here."
sleep 2s
echo "[*] First off all Watcher uses very less resources like almost 10 MBs."
sleep 3s
echo "[*] Also some of the features are in development AFK is one of them"
sleep 2s
echo "[*] So let's start installtion process... "

sudo cp -r ./src/Watcher /usr/share/
sudo cp -r ./src/bin/watcher /usr/local/bin/
sudo chmod +x /usr/local/bin/watcher

# making directory for log-files (where all you daily logs are stored)
mkdir -p ~/.cache/Watcher/
mkdir -p ~/.cache/Watcher/raw_data/
mkdir -p ~/.cache/Watcher/Analysis/

# resolving confilict with previous version of watcher
if [ -f "$HOME/.config/systemd/user/watcher.service" ]; then
    systemctl --user disable --now watcher.service
    rm -rf $HOME/.config/systemd/user/watcher.service
elif [ -f "$HOME/.local/bin/watcher" ]; then
    rm -rf $HOME/.local/bin/watcher

# checking wherther is ~/.xprofile is sourced in ~/.xintrc or not
count1=$(grep -c "xprofile" $HOME/.xinitrc)
# checking whether user have used watcher before as well as xprofile filed setup or not
if [ -f "$HOME/.xprofile" ]; then
    count2=$(grep -c "watcher --start" $HOME/.xprofile)
else
    count2=0
fi

if [[ $count1 > 0 ]];then
    if [[ $count2 = 0 ]];then
        echo "killall watcher" >> $HOME/.xprofile
        echo "watcher --start &" >> $HOME/.xprofile
    fi
else
    echo "[ -f /etc/xprofile ] && . /etc/xprofile" >> $HOME/.xinitrc
    echo "[ -f ~/.xprofile ] && . ~/.xprofile" >> $HOME/.xinitrc
fi

echo "Now you can use Watcher after restart. and see you around if anything goes wrong do PR or smth else"

[ -f ~/.xprofile ] && . ~/.xprofile