pandora-scripts / pandora-skel: Add script to download PND-Manager to SD Card
authorMichael Mrozek <EvilDragon@openpandora.org>
Wed, 18 Dec 2013 03:10:02 +0000 (04:10 +0100)
committerMichael Mrozek <EvilDragon@openpandora.org>
Wed, 18 Dec 2013 03:10:02 +0000 (04:10 +0100)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_getpndmg.sh [new file with mode: 0644]
recipes/pandora-system/pandora-skel.bb
recipes/pandora-system/pandora-skel/GetPNDManager.desktop [new file with mode: 0644]

index 8635bc8..e0cc35f 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "bash sed gawk grep zenity"
 
-PR = "r155"
+PR = "r156"
 
 SRC_URI = " \
           file://op_paths.sh \
@@ -88,12 +88,14 @@ SRC_URI = " \
          file://op_xfcemenu.sh \
          file://op_hugetlb.sh \
          file://op_gamma.sh \
+         file://op_getpndmg.sh \
          file://op_dsp.sh \
 "
 
 do_install() {
           install -d ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_paths.sh ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${WORKDIR}/op_getpndmg.sh ${D}${prefix}/pandora/scripts/
          install -m 0755 ${WORKDIR}/op_osupgrade.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/
           install -m 0755 ${WORKDIR}/op_cpuspeed.sh ${D}${prefix}/pandora/scripts/
diff --git a/recipes/pandora-system/pandora-scripts/op_getpndmg.sh b/recipes/pandora-system/pandora-scripts/op_getpndmg.sh
new file mode 100644 (file)
index 0000000..d37cd39
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+DOWNLOAD() {
+rand="$RANDOM `date`"
+pipe="/tmp/pipe.`echo '$rand' | md5sum | tr -d ' -'`"
+mkfifo $pipe
+wget --tries=0 -c $1 2>&1 | while read data;do
+if [ "`echo $data | grep '^Length:'`" ]; then
+total_size=`echo $data | grep "^Length:" | sed 's/.*\((.*)\).*/\1/' | tr -d '()'` 
+fi
+if [ "`echo $data | grep '[0-9]*%' `" ];then 
+percent=`echo $data | grep -o "[0-9]*%" | tr -d '%'` 
+current=`echo $data | grep "[0-9]*%" | sed 's/\([0-9BKMG.]\+\).*/\1/' ` 
+speed=`echo $data | grep "[0-9]*%" | sed 's/.*\(% [0-9BKMG.]\+\).*/\1/' | tr -d ' %'` 
+remain=`echo $data | grep -o "[0-9A-Za-z]*$" ` 
+echo $percent
+echo "#Downloading PNDManager\n$current of $total_size ($percent%)\nSpeed : $speed/Sec\nEstimated time : $remain"
+fi
+done > $pipe &
+
+wget_info=`ps ax |grep "wget.*$1" |awk '{print $1"|"$2}'`
+wget_pid=`echo $wget_info|cut -d'|' -f1 `
+
+zenity --progress --auto-close --text="Connecting to Server...1\n\n\n" --width="350" --title="Downloading"< $pipe
+if [ "`ps -A |grep "$wget_pid"`" ];then
+kill $wget_pid
+fi
+rm -f $pipe
+}
+
+
+if selection=$(grep "/dev/mmcblk" /proc/mounts | cut -f 2 -d " " | sed 's/\\040/ /g' | zenity --title="Get PNDManager" --width="380" --height="250" --list --text="PNDManager is the recommended tool to easily install, update\n and delete programs on your Pandora.\n\nIt is not preinstalled on the Pandora but this tool\ncan automatically download it to your SD Card.\n\nYou can safely delete the icon from the desktop\nin case you do not need it anymore.\n\nPlease make sure you currently have a working internet connection\nand select the SD Card where you want to install it.\n\n" --column="Select card"); then
+       mkdir $selection/pandora
+       mkdir $selection/pandora/apps
+       cd $selection/pandora/apps/
+       DOWNLOAD "http://www.openpandora.org/downloads/pndmanager.pnd"
+       zenity --info --title="Finished" --text "You might have to remove/reinsert your SD Card to force a rescan and let PNDManager appear.\n\nIn case you aborted the download, restart this tool to resume.\n\nYou can safely delete the icon from the desktop in case you do not need it anymore."
+else
+       exit
+fi
index 4225df4..df42971 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 # /etc/skel is used by Shadow's useradd so you really have that installed for this to make sense ;)
 RDEPENDS = "shadow"
 
-PR = "r26"
+PR = "r27"
 
 SRC_URI = " \
   file://.xinitrc \     
@@ -23,6 +23,7 @@ SRC_URI = " \
 #  file://op_btenabled \
   file://PandoraQuickStart.pdf \
   file://PandoraQuickStart.desktop \
+  file://GetPNDManager.desktop \
   file://gtkrc-2.0 \
 "
 
@@ -48,6 +49,7 @@ do_install() {
   install -m 0644 ${WORKDIR}/snd-pcm-oss ${D}${sysconfdir}/modutils/snd-pcm-oss
 #  install -m 0644 ${WORKDIR}/op_btenabled ${D}${sysconfdir}/skel/.op_btenabled
   install -m 0755 ${WORKDIR}/PandoraQuickStart.desktop ${D}${sysconfdir}/skel/Desktop/PandoraQuickStart.desktop
+  install -m 0755 ${WORKDIR}/PandoraQuickStart.desktop ${D}${sysconfdir}/skel/Desktop/GetPNDManager.desktop
   install -m 0755 ${WORKDIR}/PandoraQuickStart.pdf ${D}${sysconfdir}/pandora/PandoraQuickStart.pdf
   
   install -d ${D}${sysconfdir}/skel/Applications/Settings/xfce4/xfconf/xfce-perchannel-xml
diff --git a/recipes/pandora-system/pandora-skel/GetPNDManager.desktop b/recipes/pandora-system/pandora-skel/GetPNDManager.desktop
new file mode 100644 (file)
index 0000000..d30fa77
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Download PND Manager
+Icon=gnome-apt
+StartupNotify=false
+Exec=/usr/pandora/scripts/op_getpndmg.sh
+Terminal=false
+Type=Application
+Categories=Utility