Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 04 May 2016, 13:34
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
Karl Godt

Joined: 20 Jun 2010
Posts: 4173
Location: Kiel,Germany

PostPosted: Thu 18 Apr 2013, 20:57    Post subject:  /usr/sbin/partview2  

Here is an attempt to speed up partview, which is launched by clicking the free space (frememapplet*) icon in the tray.

Main difference is the use of mount-FULL and umount-FULL PLUS option -o ro .
I think that it is not necessary to run ntfs-3g rw onto ntfs partitions, just to check for free space .
The downside is, that the drive icons don't get their dots all of the way. But that does not matters to me.

I bloated the code a little bit to use random coloration if /usr/*/X11/rgb.txt is available .

* Another attempt by technosaurus with xpm from 4.4 Alpha 1 times .

This partview still uses the old .gif format . I have tested recent partview and it uses some odd

case $ATAG in
[ "`dvd+rw-mediainfo /dev/${ATAG} 2>&1 | grep 'non-DVD'`" != "" ] && ASIZE=700000

lines to say that my 74MB sr3 USB MODEM iso9960 driver ROM Chip would have 4GB free of 4GB Laughing

[ My pup-430 partview had no header about the author. ]
It uses bash instead of ash for ash time function does not work on functions Crying or Very sad

# Karl Reimer Godt April 2013
# Rewrite for Puppy Linux /usr/sbin/partview shellscript .
# Main change : Using mount/umount-FULL -o ro to speed up reasonably,
# df -k|-m /mnt/data instead of df -k|-m | grep PATTERN ,
# support for running outside X , using random foreground colors.
# Minor changes : FREEK code rearranged and renamed FREEM + using -m option to probepart and df,
# dropped test for size-changes cos echo + diff + cp code is as heavy as ppmrough + ppmtogif,
# while + read instead of for loop,
# grep -vE 'unwanted|fs' instead of grep -E 'known|fs' .
# add homogeneous=\"true\" to hbox'es + rearrange text in hbox'es,
# check for gtkdialog2|3|4 and present rough xmessage instead if v2 .

# 04 put in LANG=C for dc command
# 03 added xmessage fallback, added random color
# 02 was wo random color, added check for gtkdialog2|3|4
# 01 was code cleanup, added ability to run in kernel console
# 00 was still -k , used jobs which does not work in 'not a tty'

[ "$DISPLAY" ] && {
    xmessage -center -bg orange -buttons "" "Please wait, processing. Don't mount or unmount any drives..." &
    xPID=$! ; }


mkdir -p /mnt/data

mkdir -p $pic_dir
cd $tmpDir

DISK_FREE=`df -m`
PARTS=`probepart -m 2> /dev/null | grep '^/dev/' | grep -vE "none|Extended|Ext'd|swap|not inserted|unknown|squashfs" | cut -f 1-3 -d '|'`

if [ "$DISPLAY" ] ; then
PARTINFO="<hbox homogeneous=\"true\"><text><label>Partitions</label></text><pixmap><input file>$tmpDir/partview_top.gif</input></pixmap><text><label>Free</label></text></hbox>"
RGB_FILE=`ls -1 /usr/*/X11/rgb.txt | head -n1`
[ "$RGB_FILE" ] && { COLORS=`cat "$RGB_FILE" | grep -viE 'snow|grey|gray|white|ivory'`
HOW_MANY=`echo "$COLORS" | wc -l`
#COLOR=`echo "$COLORS" | sed -n "$COLOR_NR p" | awk '{print $4}'`
COLOR=`echo "$COLORS" | sed -n "$COLOR_NR p" | sed "s%\([[:blank:][:digit:]]*\)\(.*\)%\2%"`
[ "$COLOR" ] || COLOR=red
echo "COLOR=$COLOR'"
ppmrough -width 100 -height 16 -var 1 -bg "$COLOR" -fg grey80 -left 0 | ppmlabel -background transparent -color "$COLOR" -size 10 -y 13 -x 0 -text "Used" -background transparent -color "$COLOR" -size 10 -y 13 -x 1 -text "Used" | ppmtogif > $tmpDir/partview_top.gif


echo -e "Partition    Fs   Size_MiB MNTD Used_MiB Free_Space"

time while read device fs size ; do
[ "$device" -a "$fs" -a "$size" ] || continue
echo -n "'$device' '$fs' '$size' "
MST='';echo "$DISK_FREE" | grep -q -w "$device" && MST=ON || MST=OFF;echo -n "'$MST' "

if [ "$MST" = OFF ]; then
 [ ! "${fs//[FfAaTt0-9]/}" ] && fs=vfat
 #mount -t $fs $device /mnt/data
 mount-FULL -t $fs -o ro $device /mnt/data
 [ $? = 0 ] || continue
 USEDM=`df -m /mnt/data | grep -m1 -w "$device" | awk '{print $3}'`
 #umount $device
 umount-FULL -r $device
 USEDM=`echo "$DISK_FREE" |grep -m1 -w "$device" |awk '{print $3}'`
echo -n "'$USEDM' "
FREEM=$((size - USEDM))
if [ "$FREEM" -gt 1024 ];then #1024
  LANG=C ONEFREE=`dc $FREEM 1024 \/ p`
  LANG=C ONEFREE="`printf "%.1f" $ONEFREE`G"
elif [ "$FREEM" -gt 3 ];then
echo "'$ONEFREE'"

if [ "$DISPLAY" ] ; then
ppmrough -width 100 -height 14 -var 1 -bg "$COLOR" -fg grey80 -left $(((100*USEDM)/size)) | ppmtogif > $pic_dir/partview_${device//\//_}.gif

<hbox homogeneous=\"true\"><text><label>${device##*/}</label></text><pixmap><input file>$pic_dir/partview_${device//\//_}.gif</input></pixmap><text><label>${ONEFREE}</label></text></hbox>"

$(echo "$PARTS")


[ "$DISPLAY" ] || exit

kill $xPID

which gtkdialog3 && GTKDIALOG_EXE=gtkdialog3 || { which gtkdialog4 && GTKDIALOG_EXE=gtkdialog4 || xmessage -timeout 10 -bg "$COLOR" "
gtkdialog version 3 or 4 needed.

`echo \"$PARTINFO\" | grep -o '<label>[^>]*</label>'`
"; }

WINDOW_ATR=" title=\"Partview $COLOR\" icon-name=\"gtk-harddisk\""


Back to top
View user's profile Send private message 
Ted Dog

Joined: 13 Sep 2005
Posts: 4010
Location: Heart of Texas

PostPosted: Sat 20 Apr 2013, 02:08    Post subject:  

Wish we knew how to burn to that fake iso part of usb modems, I once had a switchmode usb modem that had a puppylinux sized iso section for its windows drivers.
I would think it convenient to be able to use puppylinux as a booter that then would go online and pull the correct updated windows driver.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0387s ][ Queries: 12 (0.0044s) ][ GZIP on ]