#!/bin/bash echo "[✔] First of all Thanks for dropping by!." sleep 1s echo "[✔] And...FYI Watcher uses very less resources like almost 10 MBs." sleep 2s echo "[✔] Also some of the features are in development AFK is one of them" sleep 2s echo "[✔] So let's start installation process... " sudo cp -r ./src/Watcher /usr/share/ echo "[✔] Copying Watcher to /usr/share/" sudo cp -r ./src/bin/watcher /usr/local/bin/ echo "[✔] Copying watcher executable to /usr/local/bin/" sudo chmod +x /usr/local/bin/watcher echo "[✔] Making it executable by giving giving it permission" # making directory for log-files (where all you daily logs are stored) mkdir -p ~/.cache/Watcher/ echo "[✔] To store raw_data making directory as ~/.cache/Watcher" mkdir -p ~/.cache/Watcher/raw_data/ mkdir -p ~/.cache/Watcher/Analysis/ # resolving confilict with previous version of watcher echo "[✔] Checking whether you had installed previous version so removing conflicts if yes" 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 fi # 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 echo "[✔] Making sure that it will run at starting of each xsession afterward" if [ $count1 = 0 ] & [ $count2 = 0 ];then sed -i '/bin/a \source ~/.xprofile' ~/.xinitrc echo "killall watcher" >> $HOME/.xprofile echo "watcher --start &" >> $HOME/.xprofile elif [ $count1 > 0 ] & [ $count2 = 0 ];then echo "killall watcher" >> $HOME/.xprofile echo "watcher --start &" >> $HOME/.xprofile elif [ $count2 > 0 ] & [ $count1 = 0 ];then sed -i '/bin/a \source ~/.xprofile' ~/.xinitrc fi echo "" echo "Now you can use Watcher after restart. And see you around" echo "If anything goes wrong do PR or open issue" echo "If you wanna just give a try (without restart), You can start taking logs (run watch_log.py) by 'watcher --start' "