summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprobe-hdmi/init.sh29
-rw-r--r--probe-hdmi/probe-hdmi.desktop2
-rwxr-xr-xprobe-hdmi/probe-hdmi.sh14
-rwxr-xr-xupdate-tool/cronjob-for-check-updates.sh19
4 files changed, 55 insertions, 9 deletions
diff --git a/probe-hdmi/init.sh b/probe-hdmi/init.sh
new file mode 100755
index 0000000..c5e6097
--- /dev/null
+++ b/probe-hdmi/init.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+export supertitle="Probe HDMI"
+source easybashgui
+
+INET_AVAILABLE=0
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+# =====================================================================================
+# Functions in order they get called #
+# =====================================================================================
+
+function check_internet() {
+ wait_seconds 2
+ wget -P $DIR http://google.com/robots.txt &> /dev/null
+ return_code=$?
+ [ $return_code -eq 0 ] && INET_AVAILABLE=1
+ rm $DIR/robots.txt
+}
+
+# ======================================================================================
+
+function pull_updates() {
+ # If internet available just merge the changes
+ [ $INET_AVAILABLE -eq 1 ] && cd $DIR && git pull>/dev/null 2>&1
+}
+
+check_internet
+pull_updates
+bash $DIR/probe-hdmi.sh&
diff --git a/probe-hdmi/probe-hdmi.desktop b/probe-hdmi/probe-hdmi.desktop
index 4b1140a..13760e1 100644
--- a/probe-hdmi/probe-hdmi.desktop
+++ b/probe-hdmi/probe-hdmi.desktop
@@ -3,7 +3,7 @@ Encoding=UTF-8
Keywords=Probe HDMI
Name=Probe HDMI
Comment=Probe HDMI
-Exec=bash /opt/FOSSEE-netbook-tools/probe-hdmi/probe-hdmi.sh &
+Exec=bash /opt/FOSSEE-netbook-tools/probe-hdmi/init.sh
Icon=/opt/FOSSEE-netbook-tools/probe-hdmi/hdmi.png
Terminal=false
Type=Application
diff --git a/probe-hdmi/probe-hdmi.sh b/probe-hdmi/probe-hdmi.sh
index b6e5429..ef748b6 100755
--- a/probe-hdmi/probe-hdmi.sh
+++ b/probe-hdmi/probe-hdmi.sh
@@ -17,6 +17,9 @@
# programs, which can be modified to work with other libraries too
source easybashgui
+export supertitle="Probe HDMI"
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
#Paths
fb1=/etc/X11/xorg.conf.fb1
@@ -31,7 +34,7 @@ if [ ! -z $(pidof X) ] ; then
while true
do
- password=$(zenity --title "Enter your password to continue" --password)
+ password=$(zenity --title "Probe HDMI" --password)
# zenity dialog button 'Cancel' returns 1, and 'Yes' returns 0.
[ $? -eq 1 ] && exit 0
echo $password | sudo -S echo "test">/dev/null
@@ -73,7 +76,12 @@ function probe_hdmi() {
kernel_resolution=$(cat /sys/class/graphics/fb1/modes | cut -d ':' -f2 | cut -d '-' -f1)
if [ $kernel_resolution == '1024x720p' ] && [ ! -f $xorg ]; then
-return_code_A=$(question -w 800 -h 200 "There are two possible settings, A and B. You are in Setting-(A) (default setting): You may need to connect the HDMI/HDMI-to-VGA cable to netbook and restart once.\\n\\nHDMI might work in setting-(A) with thick bottom bar.\\n The setting-(B) will make your bottom panel unvailable on netbook screen, but HDMI might work in full screen. \\nYour desktop will be reloaded, hence save your files. Select 'Ok' to try setting-(B), select 'Cancel' to continue Setting-(A). \\nYou may change from setting-(B) to setting-(A) anytime by revisiting this application" 2>&1)
+
+message -w 500 -h 400 "There are two possible settings, A and B. You are in Setting-A (default setting).\\nIt is recommended to connect HDMI/HDMI-to-VGA cable to netbook and restart. HDMI might work with thick bottom bar.\\n Select 'Ok' to continue"
+
+
+return_code_A=$(question -w 600 -h 300 "If setting-A doesn't work, you may try setting-B. The setting-B will make your bottom panel unavailable on netbook screen, but HDMI might work in full screen mode. Your desktop will be reloaded.\\nSelect 'Ok' to try setting-B, select 'Cancel' to continue Setting-A. \\nYou may change from setting-B to setting-A anytime by revisiting this application." 2>&1)
+
[ $return_code_A -eq 1 ] && exit 0
sudo cp -v $fb1 $xorg
try_lightdm_restart
@@ -83,7 +91,7 @@ fi
# ---------------------------------------------------------------------------------
if [ $kernel_resolution == '1024x720p' ] && [ -f $xorg ]; then
-return_code_B=$(question -w 350 -h 250 "You are in setting-(B): Do you wish to change to setting-(A)(default setting)? Select 'Ok' to switch to setting-(A). Select 'Cancel' to continue setting-(B)" 2>&1)
+return_code_B=$(question -w 350 -h 250 "You are in setting-B.\\nDo you wish to switch to setting-A(default setting)? Select 'Ok' to switch to setting-A(desktop will be reloaded). Select 'Cancel' to continue setting-B" 2>&1)
[ $return_code_B -eq 1 ] && exit 0
sudo rm -v $xorg
try_lightdm_restart
diff --git a/update-tool/cronjob-for-check-updates.sh b/update-tool/cronjob-for-check-updates.sh
index ca28b2e..53d5e85 100755
--- a/update-tool/cronjob-for-check-updates.sh
+++ b/update-tool/cronjob-for-check-updates.sh
@@ -1,13 +1,22 @@
#!/bin/bash
-# This script will be called by cronjob every hour
-
+# Run script daily at 4pm. To disable open 'crontab -e' as sudo/root and disable
+# 0 16 * * * /opt/FOSSEE-netbook-tools/update-tool/cronjob-for-check-updates.sh
+export DISPLAY=:0.0
+export XAUTHORITY=$HOME/.Xauthority
+user=$(echo $HOME|cut -d '/' -f3)
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-
cd $DIR
-[ $(git fetch --tags --dry-run 2>&1 | wc -l) -ge 1 ] && \
-notify-send "Updates available: menu -> FOSSEE-Tools -> FOSSEE-updates"
+# Just to find out the return code (The notify-send should not give output if
+# internet is down)
+return_text=$(git fetch --tags --dry-run 2>&1)
+# Check for return code, it will be 0 if internet is available
+[ $? -eq 0 ] && [ $(echo $return_text|wc -l) -ge 1 ] && \
+
+sudo -u $user /usr/bin/notify-send -i "path/to//opt/FOSSEE-netbook-tools/update-tool/patcher.png" \
+"FOSSEE Updates available" \
+"menu -> FOSSEE-Tools -> FOSSEE-updates"
exit 0