#!/bin/bash ####### (Judicial Laptop Utility Script version 1.0)##################### #### This Script provide easy solutions of complex System Problems ###### ### This script is created by Arvind Pal, SSO, eCourts (MP)############## ### Please Do not modify this script for Judicial Laptop Purposes######## snaptool() ## snapshot mounting function { echo '#!/bin/bash' > /usr/bin/mounter echo 'sblast=`tail -1 /var/log/last-successful-snapshot` '>>/usr/bin/mounter echo 'rm -f /home/judge/Desktop/"Data Backup of $sblast" '>>/usr/bin/mounter echo '/sbin/cryptsetup luksOpen /dev/homevg/home-snapshot home-snapshot --key-file /etc/enc/mkey.enc'>> /usr/bin/mounter echo 'if [ $? -eq 0 ]; then'>>/usr/bin/mounter echo 'gdialog --infobox "Partition Unlocked Successful!" '>>/usr/bin/mounter echo "else">>/usr/bin/mounter echo 'gdialog --infobox "Partition already Unlocked, Please restart system and try Again!" '>>/usr/bin/mounter echo "exit">>/usr/bin/mounter echo "fi">>/usr/bin/mounter echo 'mount -r /dev/mapper/home-snapshot /snapshot' >>/usr/bin/mounter echo 'ln -s /snapshot /home/judge/Desktop/"Data Backup of $sblast"' >>/usr/bin/mounter /bin/chmod 777 /usr/bin/mounter /bin/chown judge:judge /usr/bin/mounter echo "ALL ALL = NOPASSWD:/usr/bin/mounter" >> /etc/sudoers echo "gdialog --infobox \"Data_Backup Mounted Successfully!\" " >>/usr/bin/mounter gdialog --infobox "Mounter file Created successfully!!" } restore_panel() ## panel restore function { gconftool-2 --shutdown rm -rf /home/judge/.gconf cp -r /opt/ecourts/judge-profile/judge/.gconf/ /home/judge/ chown -R judge:judge /home/judge/.gconf pkill gnome-panel if [ $? -eq 0 ]; then gdialog --infobox "Panel Restore Successfuly" exit else gdialog --infobox "Panel Restore process failed " exit fi } ####Choice Menu echo "*******************************************************" echo "Wel-Come to Judicial Laptop Utility Script" echo "*******************************************************" echo " The Choices are::" echo "*******************************************************" echo " Press 1 for Snap Mounter Utility !!" echo "*******************************************************" echo " Press 2 for Panel Restore Utility !!" echo "*******************************************************" echo " Press 0 for Exit!!" echo "*******************************************************" echo " Please Enter Your Choice!!" read ans case $ans in ######################################################################## 0) gdialog --infobox "Are you really want Exit!!" exit ;; ######################################################################## 1) gdialog --infobox "You Want to install Snap Mounter Utility!!" if [ -f /usr/bin/mounter ]; then gdialog --infobox "Snap Mounter file has been Already Created!!" exit else snaptool fi ;; ######################################################################## 2) gdialog --infobox "You Want to Restore Panel!" restore_panel ;; ######################################################################## *) gdialog --infobox "Sorry!! this is not valid choice!" ;; esac