aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 21:37:57 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 21:37:57 +0530
commitfc1c852d9263fc43f27792f38a8e68674e944629 (patch)
treeb9d709ac8be32500660a8a672ffcd6929025b9de
parent471d0b43e3fa2f5f077ce9ad4824992058d26e0e (diff)
downloadshopno-os-log-sync-fc1c852d9263fc43f27792f38a8e68674e944629.tar.gz
shopno-os-log-sync-fc1c852d9263fc43f27792f38a8e68674e944629.zip
updating install | updating bin according to new function names
-rwxr-xr-xinstall51
-rw-r--r--[-rwxr-xr-x]src/bin/watcher7
2 files changed, 27 insertions, 31 deletions
diff --git a/install b/install
index 539e5f1..fbeb7f0 100755
--- a/install
+++ b/install
@@ -21,41 +21,38 @@ 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 of Watcher so removing those 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
-
# deleting folowing lines "[ -f /etc/xprofile ] && . /etc/xprofile/" and "[ -f ~/.xprofile ] && . ~/.xprofile"
-sed -i '/xprofile/d' ~/.xinitrc
-
-# checking wherther is ~/.xprofile is sourced in ~/.xintrc or not
-count1=$(grep -c "xprofile" $HOME/.xinitrc)
+if [ -f "$HOME/.xinitrc" ];
+then
+ sed -i '/xprofile/d' ~/.xinitrc
+ # checking wherther is ~/.xprofile is sourced in ~/.xintrc or not
+ count1=$(grep -c "xprofile" $HOME/.xinitrc)
+else
+ count1=0
+fi
# checking whether user have used watcher before as well as xprofile filed setup or not
-if [ -f "$HOME/.xprofile" ]; then
+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
+echo "[✔] Making sure that it will run at startup of the system"
+
+if [ $count2 = 0 ];
+then
+ echo "watcher --start &" >> $HOME/.xprofile
+fi
+
+if [ -f "$HOME/.xinitrc" ];
+then
+ if [ $count1 = 0 ] ;
+ then
+ echo "source ~/.xprofile" >> $HOME/.xinitrc
+ fi
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' "
+echo '''If you wanna just give a try (without restart), You can start taking logs (run watch_log.py) by 'watcher --start' '''
diff --git a/src/bin/watcher b/src/bin/watcher
index 2d4551e..d2392cd 100755..100644
--- a/src/bin/watcher
+++ b/src/bin/watcher
@@ -1,10 +1,9 @@
#!/usr/bin/python
-
import os
import sys
sys.path.insert(0, "/usr/share/Watcher/")
import watch_log as x
-from colored_text import Color
+from commands import Color
import commands as cmd
def help_option():
@@ -23,7 +22,7 @@ try:
if arg == "-ds" or arg == "--day-summary":
cmd.daily_summary()
elif arg == "-ws" or arg == "--week-summary":
- os.popen("python3 /usr/share/Watcher/week_analysis.py")
+
cmd.week_summary()
elif arg == "-h" or arg == "--help":
help_option()
@@ -31,7 +30,7 @@ try:
print("Log creations started... \nif you wanna stop it, use keyboard-shortcut (Ctrl+Shift+C)")
x.log_creation()
elif arg == "--version":
- print("Version: 1.0")
+ print("Version: 1.2")
else:
print(Color.RED("Wrong")+" [OPTION] choosen. Have a look at the Options!!\n")
print(Color.YELLOW("OPTIONS"))