Page 3 of 3

Posted: Mon 25 Apr 2011, 14:23
by akash_rawal
I got a nice way to differentiate between Windows Vista and 7.
After searching a lot I found the source code of os-prober-1.44 and in it found an easy way to read /Boot/BCD binary file to determine Windows OSes booting from it.
In file os-probes/mounted/x86/20microsoft:

Code: Select all

# Vista (previously Longhorn)
if item_in_dir -q bootmgr "$2" && boot="$(item_in_dir boot "$2")" &&
   bcd="$(item_in_dir bcd "$2/$boot")"; then
	if grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
		long="Windows 7 (loader)"
	elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
		long="Windows Vista (loader)"
	elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
		long="Windows Server 2008 R2 (loader)"
	elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
		long="Windows Server 2008 (loader)"
	elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
		long="Windows Recovery Environment (loader)"
	elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
		long="Windows Recovery Environment (loader)"
	else
		long="Windows Vista (loader)"
	fi
	short=Windows
# 2000/XP/NT4.0
elif ...
There is one mistake though, "grep -qs" should be replaced by "grep -ao".
Now just wait for a week or two, my program will be out.

Done

Posted: Thu 19 May 2011, 12:42
by akash_rawal
I have written the program successfully.
It is here: http://www.murga-linux.com/puppy/viewto ... 405#524405
Please check whether detection of MSDOS/Win95/98/ME works properly. I cannot do it becauseI don't have one. I have an old windows 98SE setup disk but VirtualBox cannot boot it.

4. Shutting down puppy by power button

Posted: Thu 09 Jun 2011, 13:35
by akash_rawal
4. Shutting down puppy by power button

This one is pretty easy.
Just wrote a small shell script of just 5 lines:

Code: Select all

#!/bin/sh
cat /proc/acpi/event |
while read line; do
	wmpoweroff
done
You may want to replace "wmpoweroff" with your favorite shutdown manager like PupShutdown.

Posted: Sat 11 Jun 2011, 02:45
by SimpleWater
I have one, how about a hibernate, standby, sleep or whatever you call it mode. I use that in windows all the time, to save energy you know?

Posted: Sat 11 Jun 2011, 06:24
by akash_rawal
SimpleWater wrote: I have one, how about a hibernate, standby, sleep or whatever you call it mode. I use that in windows all the time, to save energy you know?
Sorry I forgot :oops: I was too busy in maintaining Boot Loader Manager.

There is acpitool which can put your computer to standby using a simple command:

Code: Select all

acpitool -s
However this doesn't work directly for my desktop, so I wrote a wrapper script:
/usr/bin/acpitool:

Code: Select all

#!/bin/sh
if test -n "`echo "$@" | grep -i -- "-s"`"; then
	rmmod uhci_hcd
	rmmod ehci_hcd
	acpitool_ren $@
	modprobe uhci_hcd
	modprobe ehci_hcd
else
	acpitool_ren $@
fi

(assuming that you have renamed actual /usr/bin/acpitool to /usr/bin/acpitool_ren)

PupShutdown is a great shutdown manager which has option for both standby and hibernate but the GUI says:
Image
And when I try to hibernate it just says that hibernation support was not detected.
However standby option works properly
Anyone knows how to enable hibernation?

Posted: Sat 11 Jun 2011, 11:24
by stu90
Hi akash_rawal,

What windows manager and theme are you running in that screen shot above?

i like! :D

Posted: Sat 11 Jun 2011, 12:43
by akash_rawal
stu90 wrote:Hi akash_rawal,

What windows manager and theme are you running in that screen shot above?

i like! :D
I am using:
  • Wallpaper: See the world.jpg
  • Window manager: Beryl, with Emerald decorator
  • Window decorator theme: A-New-Hope (see attachment)
  • Gtk theme: A-New-Hope (see attachment)

Posted: Sat 11 Jun 2011, 13:19
by stu90
akash_rawal wrote:
stu90 wrote:Hi akash_rawal,

What windows manager and theme are you running in that screen shot above?

i like! :D
I am using:
  • Wallpaper: See the world.jpg
  • Window manager: Beryl, with Emerald decorator
  • Window decorator theme: A-New-Hope (see attachment)
  • Gtk theme: A-New-Hope (see attachment)
Thanks akash_rawal - i never herd of Beryl before - looks sweet. :)

cheers.

Re: 4. Shutting down puppy by power button

Posted: Sun 14 Aug 2011, 00:15
by recobayu
thank you very much akash, now my luci 258 has label on drive icon.
how if the longer label cut to the wide of icon, for example "somethingdriveiconlabel" tobe "someth..."
maybe it is better.
:wink:
akash_rawal wrote:4. Shutting down puppy by power button

This one is pretty easy.
Just wrote a small shell script of just 5 lines:

Code: Select all

#!/bin/sh
cat /proc/acpi/event |
while read line; do
	wmpoweroff
done
You may want to replace "wmpoweroff" with your favorite shutdown manager like PupShutdown.


now i am really new and interested to studying programming with sh language on puppy.
i want to PupShutdown appear when i press powerbutton on my laptop.
Edit: i know how it be.
I use that script on /root/Startup. I restart x server, n i got it! My power button works.
thanks
:D

Posted: Mon 12 Sep 2011, 05:12
by pemasu
Anyone knows how to enable hibernation?
Sorry about late response. I just now find this thread through posted link.

You enable hibernation when you compile the kernel with hibernation enabled.

Anyway, in Puppies hibernation is quite useless. It takes time to write the RAM content to the swap partition, after that it locks the swap partition, until you boot the same hibernated Puppy, and it takes time to write the swap content back.

Only useful usage I have found, is that you can install applications without savefile when using pristine, fresh frugal install. Hibernate the Puppy and you can that way shutdown your comp. When booting back to the same Puppy, you have those installed applications in hand without savefile created.

Puppy shuts down and starts many times faster than hibernation is able

Posted: Wed 14 Sep 2011, 17:35
by r1tz
Hmmm, i feel that even windows start up and shut down faster then when hibernating.

But hibernation is great when you don't feel like closing your 100 tabs and programs only to start them again when you reboot a few hours later.

drive icon label and space between

Posted: Mon 14 Nov 2011, 23:19
by recobayu
drive icon label fix
http://208.109.22.214/puppy/viewtopic.p ... 1&start=30

i make some change on the function blkid_name_generator() to manage the longer drive icon label, something like "ThisIsMyLabel" tobe just "ThisIsMy..", here we go.

Code: Select all

blkid_name_generator() {
#Gather blkid output and filter out required device
if [ ! -f /tmp/blkid.txt ]; then
blkid -c /dev/null > /tmp/blkid.txt
fi
blkid_cleaner &
LABEL=""
eval $( cat /tmp/blkid.txt | grep "$@:" | cut --delimiter=" " -f 2- | sed -e 's/ /;/g' )
LABEL=${LABEL//;/ }
if [ ${#LABEL} -gt 8 ]
then
	LABEL=${LABEL:0:8}..
fi
#Generate drive label
if [ "$LABEL" = "" ]; then ONEDRVLABEL="$@\n \n "; else ONEDRVLABEL="${LABEL}\n($@)\n "; fi
}
next, to change the space between drive icon,
1. make a text file in the /tmp folder name 'pup_event_icon_change_flag' then write: ICONWIPE on it. and save.
2. edit the "ICON_PLACE_SPACING" on the /etc/eventmanager tobe 75. save it.
3. restart xserver.

:D

Posted: Wed 14 Dec 2011, 12:44
by sickgut
regarding these two points:

1. Desktop drive icons: They should show volume labels along with drive numbers.
2. Grub bootloader config: It should have ability to detect existing operating systems and generate appropriate configurations to boot them. (I think the easiest way to do that is to read existing bootloader config files, or better still edit existing bootloader.)

The volume labels issue could be introduced by using the "usbmount" package, this creates a dir called usbmount in /var/run/ and here there are shortcuts made to the detected drives and the name of the shortcut is the firmware name of the device, such as Lexar 8GB USB flash or Toshiba M88764628 these arent real actual names of real devices but an example of the type of naming. A desktop icon that links to /var/run/usbmount/ would provide the desktop interface for this. This is something i have done in Pussy Linux.

The 2nd issue listed here is better Grub etc etc etc etc etc
This is a general linux issue and is a type of holy grail for pretty much any inquizitive linux user.

Posted: Sun 18 Dec 2011, 14:17
by akash_rawal
There is a possible fix for multiline drive labels, a problem that was brought to notice by a PM from someone.

Here is the replacement function:

Code: Select all

blkid_name_generator() {
	#Gather blkid output and filter out required device
	LABEL=""
	eval "`blkid "/dev/$1" | cut --delimiter=" " -f 2- | sed -e 's/ /;/g'`"
	LABEL="${LABEL//;/ }"
	#Generate drive label
	if test "$LABEL" = ""; then ONEDRVLABEL="$@\n \n "; else ONEDRVLABEL="${LABEL}\n($@)\n "; fi
}
_________________________________________
recobayu wrote: how if the longer label cut to the wide of icon, for example "somethingdriveiconlabel" tobe "someth..."
maybe it is better.
sickgut wrote: The volume labels issue could be introduced by using the "usbmount" package, this creates a dir called usbmount in /var/run/ and here there are shortcuts made to the detected drives and the name of the shortcut is the firmware name of the device, such as Lexar 8GB USB flash or Toshiba M88764628 these arent real actual names of real devices but an example of the type of naming. A desktop icon that links to /var/run/usbmount/ would provide the desktop interface for this.
Well, I am now planning to implement drive icons using gtkdialog instead of rox-filer. This should easily allow more features and same code could work for any DE.

I will include the features mentioned in this thread in the gtkdialog version.

Posted: Sun 18 Dec 2011, 14:30
by puppyluvr
:D Hello,
Regarding Hibernation...
Using 2.6.38.4 from Pemasu, and acpitools, my laptop sleeps (acpitool -s.. small s 'suspend to ram') in 3 seconds, and wakes in 5.. Works great..
However acpitool -S (big s 'suspend to disk') is death to X..

Posted: Sun 18 Dec 2011, 18:55
by jemimah
akash_rawal wrote:There is a possible fix for multiline drive labels, a problem that was brought to notice by a PM from someone.

Here is the replacement function:

Code: Select all

blkid_name_generator() {
	#Gather blkid output and filter out required device
	LABEL=""
	eval "`blkid "/dev/$1" | cut --delimiter=" " -f 2- | sed -e 's/ /;/g'`"
	LABEL="${LABEL//;/ }"
	#Generate drive label
	if test "$LABEL" = ""; then ONEDRVLABEL="$@\n \n "; else ONEDRVLABEL="${LABEL}\n($@)\n "; fi
}
_________________________________________
recobayu wrote: how if the longer label cut to the wide of icon, for example "somethingdriveiconlabel" tobe "someth..."
maybe it is better.
sickgut wrote: The volume labels issue could be introduced by using the "usbmount" package, this creates a dir called usbmount in /var/run/ and here there are shortcuts made to the detected drives and the name of the shortcut is the firmware name of the device, such as Lexar 8GB USB flash or Toshiba M88764628 these arent real actual names of real devices but an example of the type of naming. A desktop icon that links to /var/run/usbmount/ would provide the desktop interface for this.
Well, I am now planning to implement drive icons using gtkdialog instead of rox-filer. This should easily allow more features and same code could work for any DE.

I will include the features mentioned in this thread in the gtkdialog version.
Just FYI so it doesn't take you as long to figure this out. There's some stuff referring to ROX hardcoded into the binary mount/umount commands (I think, it's been a while since I played with this).

Something cool the xandros eeepc os did was put the icons for disks into the tray. I've been thinking for a while to try to copy that functionality.

Posted: Mon 19 Dec 2011, 19:13
by recobayu
ok, i'll wait for your gtkdialog
:D
i have a problem with drive icon.
after i install wbar with setup from http://distro.ibiblio.org/puppylinux/pe ... -Lucid.pet on my lupu 528, then i goto desksetup template for desk icons, i choose bare -no desktop icons and traditional form drive icon layout. after restart X server, my drive icons tobe like this (drive numpuk.png).
it should be like other one (drive normal.png).
what should i do?
thanks akash_rawal

Posted: Thu 22 Dec 2011, 11:04
by Puppyt
Probably just a retrogressive thought, but what about setting up (a) wbar to show only drive/partitions, with labels edited manually perhaps (via wbar config)? I imagine that the main hassle then would be automatic mount/unmount - but then I'm not too imaginative, and there's bound to be hundreds of alternatives ;)

P.S. On actually re-reading some of the previous posts I see that the discussion had reached that point already - and a wbar+drive mounter would run into problems with events such as flash drive insertions. Apologies all for my attempt to add to the debate - it's been a long week.

Posted: Sat 17 Mar 2012, 07:18
by recobayu
Image
if we add label on drive icon, the position of 'x' sign go upper. so we must click on below the x sign like that image.
we can fix it by small change.
this is what i do:
1. open as text file /usr/local/bin/drive_all
find on row 178

Code: Select all

CURPOSY=$(($CURPOSY + 32))
change with
CURPOSY=$(($CURPOSY + 45))
save
2. right click on one drive, run desktop drive icon manager
3. then thick box to erase then redraw and realign existing icons
4. restart x server
now we can safely remove drive on right place.
:)