Skip to content

How to enable or disable other operating systems (like windows) from grub2

Sometimes you may have to remove the windows option from your grub menu. It was very easy in grub, the legacy one. But its quite complicated to do in new grub2.
If you are using Ubuntu, you have to face this problem in Ubuntu 9.10 and newer versions.

I was in the same situation few hours ago. I tried to edit the /etc/gurb.d/ entries. Then tried to edit /boot/grub/grub.cfg files. I knew which lines to comment and uncomment.
But I was looking for an automated way. After some searching I came up this solution. All you have to do is to toogle the executable bit of /etc/grub.d/30_os-prober file.
This file is responsible for probing other os’s existence in the system. And it must be executable. So if you make it non-executable, update-grub command wont be able to execute it and wont probe any other os.

here is the code for disable other operating systems. Carefully see the “-x” option for chmod.

cd /etc/grub.d/
sudo chmod -x 30_os-prober
sudo update-grub

To enable just make it executable. Use “+x” option for chmod

cd /etc/grub.d/
sudo chmod +x 30_os-prober
sudo update-grub

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to StumbleUpon

Tagged , , , ,

Create Next Previous Javascript Bookmarklet for Slideshow Tutorial Ebook sites

Recently I was browsing http://talks.php.net. There were bunch of slideshows about php. I work on PHP most times. So It was good for me.
The problem arise when I saw some slide shows didn’t rendered correctly in html. so there was no next, previous button. I had to change the urls to navigate next, previous pages.
Most urls were in the format http://domain.com/path/slideshow/1, where 1 is the page number. Changing it to 2 led me to the 2nd page of the sildeshow.
I wanted it to make automated. Via javascript obviously ( being a big fan of JS).

So I made two Javascript bookmarklet button. So when you click the Next button, it will go to next page. And same for Prev button.
Following are the buttons. All you have to do is just drag those button to your Browsers Bookmark bar. Thats it!

Next Page

Prev Page

Note: Not all the urls will work. See below to get more idea.

  1. http://domain.com/path/slideshow/1 Will work
  2. http://domain.com/path/slideshow/1.html Will not work
  3. http://domain.com/path/slideshow/1.php. Will not work
  4. http://domain.com/path/slideshow-1. Will work
  5. http://domain.com/path/slide-2/show Will not work
  6. http://domain.com/path/slide-2/show.php Will not work
  7. http://domain.com/path/slide-2 Will not work
  8. http://domain.com/path/slideshow#1 Will work ! !

Sometimes those buttons discussed above may not work, eg, Manual, ebook etc sites. In that case use the following two buttons.
These are quite handy if you are browsing a site where next page cannot be guessed from url.

Next URL

Prev URL

Here is the code

Next Button:

var e=document.getElementsByTagName("link");
var g="getAttribute";
var l=window.location.href;
for(i=0;i<e.length;i++){
    r=e[i][g]("rel").toLowerCase();
    h=e[i][g]("href");
    if(r=="next"){
    l=h;
    break;
    }
}

Previous Button:

var e=document.getElementsByTagName("link");
var g="getAttribute";
var l=window.location.href;
for(i=0;i<e.length;i++){
    r=e[i][g]("rel").toLowerCase();
    h=e[i][g]("href");
    if(r=="prev"){
    l=h;
    break;
    }
}

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to StumbleUpon

Tagged , , ,