Check-in [d738537e7f]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:d738537e7ff00651ea5a691ac872b34f051de8a7
Date: 2012-01-19 04:32:31
User: BarryK
Comment:'partview' script rewritten, now generates svg image. use woof partview instead of external partview pet as that is written in perl

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/usr/sbin/partview

@@ -1,69 +1,40 @@
 #!/bin/ash
-#Barry Kauler 2009. A first go, not very efficient generating gif images.
-#v431 clarf: bugfix, old kernel without libata drivers.
-
-#modified version of technosaurus' genhbar - public domain
-genhbar() {
-FGCOLOR=\#f00
-BGCOLOR=\#0f0
-WIDTH=100
-HEIGHT=14
-BARSTRING=""
-#need to reset these because I should have used for instead of while loops
-q=0
-y=0
-#get values from input
-for x in $@; do
-case $x in
-   name*)
-      FILENAME=`echo $x |cut -d = -f 2`
-      ;;
-   *%)
-      PERCENT=`echo $x |cut -d % -f 1`
-      ;;
-   *)
-      echo "usage "$0" XX% name=filename"
-      ;;
-esac
-done
-
-#generate one line of the image
-BARMAX=$(($WIDTH*$PERCENT/100))
-while [ "$q" -lt $BARMAX ]; do
-    q=$(($q + 1))
-    BARSTRING=${BARSTRING}1
-done
-while [ "$q" -le $WIDTH ]; do
-    BARSTRING=${BARSTRING}0
-    q=$(($q + 1))
-done
-
-#write to file
-echo '/* XPM */' >${FILENAME}.xpm
-echo 'static char *'$FILENAME'_xpm[] = {' >>${FILENAME}.xpm
-echo '"'$WIDTH $HEIGHT '2 1",' >>${FILENAME}.xpm
-echo '"0 c '$BGCOLOR'",' >>${FILENAME}.xpm
-echo '"1 c '$FGCOLOR'",' >>${FILENAME}.xpm
-
-while [ "$y" -le $HEIGHT ]; do
-echo '"'$BARSTRING'"' >>${FILENAME}.xpm
-    y=$(($y + 1))
-done
-
-echo '};' >>${FILENAME}.xpm
-}
-
-
-DISKLIST="`probedisk2`"
-PARTSLIST="`probepart -k 2> /dev/null | grep '^/dev/' | grep -E 'iso9660|ext2|ext3|ext4|reiserfs|msdos|vfat|ntfs|minix' | cut -f 1-3 -d '|' | tr '\n' ' '`"
-
-#PARTINFO="<hbox><text><label>Free</label></text><pixmap><input file>/usr/share/pixmaps/partview_top.gif</input></pixmap></hbox>"
-
-#Fast enough now that this is not needed?
-#xmessage -center -bg orange -buttons "" "Please wait, processing..." &
-#XPID=$!
+#Barry Kauler 2012
+#GPL v3 (/usr/share/doc/legal)
+
+yaf-splash -bg orange -fg black -close never -fontsize large -text "Please wait, probing drives..." &
+yPID=$!
+
+GTKDIALOGEXE="gtkdialog"
+[ "`which gtkdialog4`" != "" ] && GTKDIALOGEXE="gtkdialog4"
+
+XLEFT2=84; YBOX=26; BOXWIDTH=240 #294
+
+echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg
+   id="svg1"
+   xmlns="http://www.w3.org/2000/svg"
+>' > /tmp/partview_display_svg
+
+echo  "<text
+     xml:space=\"preserve\"
+     style=\"fill:black;stroke:none;font-family:Nimbus Mono L;font-style:normal;font-weight:bold;font-size:26;fill-opacity:1;stroke-opacity:1;stroke-width:3pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;\"
+     x=\"$(($XLEFT2 + 12))\"
+     y=\"18\">size
+  </text>
+  <text
+     xml:space=\"preserve\"
+     style=\"fill:black;stroke:none;font-family:Nimbus Mono L;font-style:normal;font-weight:bold;font-size:26;fill-opacity:1;stroke-opacity:1;stroke-width:3pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;\"
+     x=\"$(($XLEFT2 + $BOXWIDTH + 6))\"
+     y=\"18\">free
+  </text>" >> /tmp/partview_display_svg
+
+
+PARTSLIST="`probepart -k 2> /dev/null | grep '^/dev/' | grep -E 'iso9660|ext2|ext3|ext4|reiserfs|msdos|vfat|ntfs|minix' | cut -f 1-3 -d '|' | tr '\n' ' '`"
 
 for APART in $PARTSLIST
 do
  MNTSTATUS='(currently mounted)'
  ATAG="`echo -n "$APART" | cut -f 1 -d '|' | cut -f 3 -d '/'`"
@@ -96,38 +67,88 @@
    umount /dev/$ATAG
   else
    continue
   fi
  fi
- #[ "$AFS" ] && echo "${ATAG} \"Filesystem: $AFS  Size: ${ASIZE}M  Free: ${AFREE}M ${MNTSTATUS}\" \\" >> /tmp/schoices.txt #v3.01 added precaution.
+
+ #
+
  AFREE=`expr $ASIZE - $AUSED`
- nAUSED=`expr 100 \* $AUSED \/ $ASIZE` #normalise.
+ nAUSED=`expr $BOXWIDTH \* $AUSED \/ $ASIZE` #normalise.
+ [ $nAUSED -eq 0 ] && nAUSED=1
  #process size...
  if [ $AFREE -gt 1048576 ];then #1024*1024
-  ONESIZE="`dc $AFREE 1048576 \/ p`"
-  ONESIZE="`printf "%.1f" $ONESIZE`G"
+  ONEFREE="`dc $AFREE 1048576 \/ p`"
+  ONEFREE="`printf "%.1f" $ONEFREE`G"
  else
   if [ $AFREE -gt 99 ];then
-   ONESIZE="`expr $AFREE \/ 1024`M"
+   ONEFREE="`expr $AFREE \/ 1024`M"
+  else
+   ONEFREE="`dc $AFREE 1024 \/ p`"
+   ONEFREE="`printf "%.1f" $ONEFREE`M"
+  fi
+ fi
+ if [ $ASIZE -gt 1048576 ];then #1024*1024
+  ONESIZE="`dc $ASIZE 1048576 \/ p`"
+  ONESIZE="`printf "%.1f" $ONESIZE`G"
+ else
+  if [ $ASIZE -gt 99 ];then
+   ONESIZE="`expr $ASIZE \/ 1024`M"
   else
-   ONESIZE="`dc $AFREE 1024 \/ p`"
-   ONESIZE="`printf "%.1f" $AFREE`M"
+   ONESIZE="`dc $ASIZE 1024 \/ p`"
+   ONESIZE="`printf "%.1f" $ONESIZE`M"
   fi
  fi
- echo "$ONESIZE" > /tmp/partview_used_${ATAG}
- genhbar ${nAUSED}%  name=/tmp/partview_${ATAG}
- #add to gui...
- PARTINFO="${PARTINFO}
-<hbox><text><label>${ATAG} ${ONESIZE}</label></text><pixmap><input file>/tmp/partview_${ATAG}.xpm</input></pixmap></hbox>"
- #echo "ATAG=$ATAG ASIZE=$ASIZE AFREE=$AFREE"
+
+ echo "  <rect
+     style=\"fill:#00ff00;fill-opacity:1;fill-rule:evenodd;stroke-width:1.25;stroke:#0000ff;stroke-opacity:1;stroke-dasharray:none;\"
+     width=\"${BOXWIDTH}\"
+     height=\"31.0\"
+     x=\"$XLEFT2\"
+     y=\"${YBOX}\" />
+  <rect
+     style=\"fill:#ff0000;fill-rule:evenodd;stroke:none;stroke-width:0.820816;fill-opacity:1;\"
+     width=\"${nAUSED}\"
+     height=\"31.0\"
+     x=\"${XLEFT2}\"
+     y=\"${YBOX}\" />
+" >> /tmp/partview_display_svg
+
+ echo  "<text
+     xml:space=\"preserve\"
+     style=\"fill:black;stroke:none;font-family:Nimbus Mono L;font-style:normal;font-weight:bold;font-size:26;fill-opacity:1;stroke-opacity:1;stroke-width:3pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;\"
+     x=\"2\"
+     y=\"$(($YBOX + 23))\">${ATAG}
+  </text>
+  <text
+     xml:space=\"preserve\"
+     style=\"fill:black;stroke:none;font-family:Nimbus Mono L;font-style:normal;font-weight:bold;font-size:26;fill-opacity:1;stroke-opacity:1;stroke-width:3pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;\"
+     x=\"$(($XLEFT2 + 12))\"
+     y=\"$(($YBOX + 23))\">${ONESIZE}
+  </text>
+  <text
+     xml:space=\"preserve\"
+     style=\"fill:black;stroke:none;font-family:Nimbus Mono L;font-style:normal;font-weight:bold;font-size:26;fill-opacity:1;stroke-opacity:1;stroke-width:3pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;\"
+     x=\"$(($XLEFT2 + $BOXWIDTH + 6))\"
+     y=\"$(($YBOX + 23))\">${ONEFREE}
+  </text>" >> /tmp/partview_display_svg
+
+
+ YBOX=`expr $YBOX + 40`
+
 done
 
-#kill $XPID
+echo '</svg>' >> /tmp/partview_display_svg
+
+kill $yPID
 
 export MAIN_DIALOG="<window title=\"Partview\" icon-name=\"gtk-harddisk\">
  <vbox>
-  ${PARTINFO}
+  <pixmap><input file>/tmp/partview_display_svg</input></pixmap>
+  <hbox><button ok></button></hbox>
  </vbox>
 </window>"
-gtkdialog3 --program=MAIN_DIALOG
+${GTKDIALOGEXE} --center --program=MAIN_DIALOG
+
+
 
 ###END###

Changes to woof-distro/Packages-puppy-noarch-official

@@ -41,11 +41,11 @@
 linux_firewall-2.0rc9-puppy2|linux_firewall|2.0rc9-puppy2||Network|132K||linux_firewall-2.0rc9-puppy2.pet||Firewall||||
 linux_firmware_dvb-1.20|linux_firmware_dvb|1.20||BuildingBlock|48K||linux_firmware_dvb-1.20.pet||dvb usb kernel firmware||||
 mplayer_codecs_basic-20071007|mplayer_codecs_basic|20071007||Multimedia|612K||mplayer_codecs_basic-20071007.pet||minimum essential codecs||||
 mscw-1|mscw|1||Setup|36K||mscw-1.pet|+alsa-lib,+gtkdialog3|Multiple Sound Card Wizard||||
 net_setup-20111016|net_setup|20111016||Setup|352K||net_setup-20111016.pet|+gtkdialog3|Network Wizard||||
-partview-2.2-1|partview|2.2-1||Filesystem|40K||partview-2.2-1.pet||Partview free space in drives||||
+partview-2.2-2|partview|2.2-2||Filesystem|40K||partview-2.2-2.pet||Partview free space in drives||||
 pawdioconverter-1.2|pawdioconverter|1.2||Multimedia|208K||pawdioconverter-1.2.pet|+gtkdialog3,+sox|PawdioConverter audio conversion||||
 pbackup-3.1.9|pbackup|3.1.9||Utility|240K||pbackup-3.1.9.pet|+xdialog,+gtkdialog3,+dvd+rwtools,+cdrkit,+curl|Pbackup Backup and Sync||||
 pburn-3.4.1|pburn|3.4.1||Multimedia|336K||pburn-3.4.1.pet|+pfilesearch,+cdrkit,+dvd+rwtools,+gtkdialog4,+normalize,+vcdimager|Pburn CD/DVD/Blu-ray writer||||
 pcd-1.5|pcd|1.5||Multimedia|72K||pcd-1.5.pet|+gtkdialog3,+cdrkit|pCD CD-audio player||||
 pcdripper-3.9.3|pcdripper|3.9.3||Multimedia|96K||pcdripper-3.9.3.pet|+xdialog,+gtkdialog3,+cdrkit|Audio CD song ripper||||

Changes to woof-distro/x86/racy/testing/DISTRO_PKGS_SPECS-puppy-wary5

@@ -475,11 +475,11 @@
 yes|orc|orc|exe,dev,doc,nls
 yes|osmo|osmo|exe,dev,doc,nls
 yes|pango|pango|exe,dev,doc,nls
 yes|panoramixproto|panoramixproto|exe>dev,dev,doc,nls
 yes|parted|parted|exe,dev,doc,nls
-yes|partview||exe
+no|partview||exe
 yes|patch|patch|exe>dev,dev,doc,nls
 yes|patchutils|patchutils|exe>dev,dev,doc,nls
 no|pawdioconverter||exe
 yes|pbackup||exe
 yes|pburn||exe

Changes to woof-distro/x86/wary/testing/DISTRO_PKGS_SPECS-puppy-wary5

@@ -475,11 +475,11 @@
 yes|orc|orc|exe,dev,doc,nls
 yes|osmo|osmo|exe,dev,doc,nls
 yes|pango|pango|exe,dev,doc,nls
 yes|panoramixproto|panoramixproto|exe>dev,dev,doc,nls
 yes|parted|parted|exe,dev,doc,nls
-yes|partview||exe
+no|partview||exe
 yes|patch|patch|exe>dev,dev,doc,nls
 yes|patchutils|patchutils|exe>dev,dev,doc,nls
 no|pawdioconverter||exe
 yes|pbackup||exe
 yes|pburn||exe