#! /bin/bash

rm -r /opt/tracker;

apt update;
apt upgrade -y;
apt install -y python3 python3-gi libwnck-3-dev nautilus python3-psutil python3-requests python3-xlib dmidecode gnome-screensaver xdotool python3-update-manager update-manager update-manager-core

mkdir /tmp/install

wget -O /tmp/install/user_create.sh https://apis.gramadigivikasana.in/trackers/linux/files/user_create.sh;
wget -O /tmp/install/tracker.txt https://apis.gramadigivikasana.in/trackers/linux/files/tracker.txt;
wget -O /tmp/install/serial_number.sh https://apis.gramadigivikasana.in/trackers/linux/files/serial_number.sh;
wget -O /tmp/install/deljob.sh https://apis.gramadigivikasana.in/trackers/linux/files/deljob.sh;
wget -O /tmp/install/addjob.sh https://apis.gramadigivikasana.in/trackers/linux/files/addjob.sh;
wget -O /tmp/install/remortdesk.sh https://apis.gramadigivikasana.in/trackers/linux/files/remortdesk.sh;
wget -O /tmp/install/afterinstall.sh https://apis.gramadigivikasana.in/trackers/linux/files/afterinstall.sh;

chmod +x /tmp/install/deljob.sh;
chmod +x /tmp/install/user_create.sh;
chmod +x /tmp/install/serial_number.sh;
chmod +x /tmp/install/remortdesk.sh;
chmod +x /tmp/install/addjob.sh;

/usr/bin/bash /tmp/install/user_create.sh;
/usr/bin/bash /tmp/install/deljob.sh;

mv /tmp/install/tracker.txt /tmp/install/tracker.py;

/usr/bin/bash /tmp/install/serial_number.sh;
rsync -avz /tmp/install/tracker.py /opt/tracker/;
/usr/bin/bash /tmp/install/addjob.sh;
/usr/bin/bash /tmp/install/remortdesk.sh;
/usr/bin/bash /tmp/install/afterinstall.sh;

rm -r /tmp/install