Announcing: Slashdot Deals - Explore geek apps, games, gadgets and more. (what is this?)

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!



Scientists Say the Future Looks Bleak For Our Bones

hazem Re:Entire study is retarded. It's FOOD, not activi (115 comments)

That was my thought too. I have trouble imagining that ancestral farming methods were any less strenuous and "bone-buliding" than even persistence hunting.

I've been reading a lot these days about correlations between the rise of agriculture (and the resulting high consumption of grains and carbohydrates) and worsened dental and overall health as well as shorter stature in humans.

I know that even with my own n=1 change in diet (from a "standard western diet" to a low-carb/high-fat) over the last year, my health, according to current "standard" markers" like BMI, A1C, fasting glucose, HDL/Triglyceride ratios, etc. has improved dramatically. The funny thing is, after this change in my diet, I'm just more energetic - I've never in my life had such a desire to just get out and be more active.

It's strange to me, but in the US, the focus in health is so strongly oriented towards keeping the heart healthy. But if you think about it, the heart is a fairly simple organ, being a pump. We can easily transplant it and even make artificial ones. I've come to the conclusion that the focus in health should be on the liver - and that what keeps the liver healthy will keep the rest of me healthy. And liver health is most easily managed by what you put in your mouth.

about a month ago

Student Bookstores Beware, Amazon Comes To Purdue Campus

hazem Re:why the fuck cant purdue (95 comments)

I suspect because Purdue is in the business of selling education services and not being a book vendor. They'd have to hire people to be experts in the business of book sales. It's the same way that most universities don't grow their own food or grow their own forests to build the desks and tables. Sure they could do that, but it's typically more efficient to leave it someone who specializes in that particular thing.

As a book vendor, Amazon has so much more clout than a single university. Maybe a university has 500 students needing to buy a calculus book. Amazon maybe has a market of 500,000 students to sell a calculus book to. They have a lot more leverage than a single university does.

about 5 months ago

Student Bookstores Beware, Amazon Comes To Purdue Campus

hazem Re:Well (95 comments)

Amazon already buys a lot of textbooks back, and for about the same crummy price the school bookstore gives you. If you look over at the right side, there's often a "trade in your item" with a proposed price.

about 5 months ago

Linux Mint 17 KDE Released

hazem Re:Bugger (61 comments)

I actually have a freshinstall.sh that I've built that does quite a few of the things I want to happen to a clean system (add/remove software, turn services on/off, map network resources, etc.).

That's a great start, but what I haven't been able to figure out how to script things like adding and configuring applets to the panels.

about 7 months ago

"Eskimo Diet" Lacks Support For Better Cardiovascular Health

hazem Re:Fad diets based on new "science" (166 comments)

I agree.

I have been eating "low-carb/high-fat" over the last 8 months, with a focus on natural and unprocessed foods (so essentially, meat, eggs, and green veggies). This fits well with people who eat paleo. The biggest divergence is that I use butter, cheese, and dark chocolate and try to avoid the moderately carb-rich foods that paleo people eat, like sweet-potatoes, and highly-carb rich foods like honey.

But again, I think you can't go too wrong by eating a diet of mostly unprocessed and refined foods, whether it's paleo or not.

about 7 months ago

"Eskimo Diet" Lacks Support For Better Cardiovascular Health

hazem Re:low carb and low PUFA vs high Omega-3? (166 comments)

The theory of "low carb diets" is that they reduce your appetite, resulting in fewer calories consumed.

This has been my personal experience. I started eating "low-carb/high-fat" last September and just crossed the -60 pounds mark. I still marvel at how I'm just not very hungry most of the time, even after missing meals or exercising for several hours... or how I can, indeed, go ride my bike vigorously for a few hours before eating any breakfast.

I haven't counted calories at all, so from an objective sense, I can't give precise amount of wha I used to eat compared to what I eat now. However I'm certain I eat less from the mere fact that now I often miss meals (from not being hungry enough to bother) when before I might even eat 2 lunches, and snack much less than before (evidenced by the fact that I don't buy snacky foods much any more - when for example I was subscribed to Amazon to have boxes of KIND bars delivered to both my home and office). One of the best parts is that I can now take long bike rides after work (I've been a bike-commuter for a few years) and not have to rush home to eat dinner from crazy hunger.

I believe the theory about low-carb and hunger is that carbohydrates stimulate insulin production. This causes cells in the body (fat and muscle) to take up blood glucose more than they would otherwise, thereby lowering blood glucose. This dynamic system has delays, so blood glucose will drop below the "normal" level and as a result you get really hungry in order to raise it back up again. As a result, you either eat more or feel lethargic due to lack of energy. This may explain the need/desire to snack between breakfast and lunch and after lunch in order to stave off the fatigue and "crash" that most people experience at these times.

Some people go a bit nuts when I say I can eat as much as I want with this way of eating and still lose weight - as if they think I believe I'm violating the laws of physics. But the reality is that of course I'm obeying the laws of thermodymics - it's just that when I eat a diet low in carbohydrates, I just don't want to eat very much. And how can that be a bad thing? I'm getting fitter, feeling better, and all without being hungry or otherwise suffering.

about 7 months ago

"Eskimo Diet" Lacks Support For Better Cardiovascular Health

hazem Re:Fad diets based on new "science" (166 comments)

Common sense tells me that the best things to eat for an animal species is what it's evolved to eat in its natural habitat.

This sounds like the foundation of the "Paleo" diet. And while this makes sense, I'm not sure there have been many good studies demonstrating the benefits of this approach. Part of the problem is establishing what "paleo" humans actually ate.

For example:

For humans, that would be 2 million years of eating nuts and fruits and clams and fish and some red meat on occasion.

This is an assumption, and maybe a good one. But look at societies like the Masai. They're fairly "aboriginal" and eat mostly red meat, blood, and milk and very little plant matter (they apparently consider eating plants a sign of weakness). Other aboriginal societies live on diets dominated by coconuts and plants.

I think the problem today is that there are few sources of "original" food sources available. As a species we've domesticated most of the plants and animals we eat, changing them over time. So it's hard to rely on the concept of "eat what we ate a million years ago". The best we can do to determine optimal nutrtion now is try to conduct solid double-blind studies based on the foods we have available. Unfortunately that is expensive to do and most of the money in nutrition research comes from the food industry, which has a vested interest in the outcomes of the research they fund.

That said, you probably can't go too wrong by avoiding processed and refined foods, eating animals that eat what they naturally eat, and eating plants that are grown with as few chemical interventions as possible.

about 7 months ago

"Eskimo Diet" Lacks Support For Better Cardiovascular Health

hazem Re:low carb and low PUFA vs high Omega-3? (166 comments)

That's a good question.

In the past, I've tried to merely restrict calories and eat what the food pyramid recommends... plenty of "healthy whole grains" and limiting fats. I lost a tiny bit of weight and was miserable and hungry - and my cholesterol numbers actually got worse. I went to the gym every day but was tired and listless mosf of the time. And as soon as I eased up, I gained even more weight (over the equilibrium weight I was at before starting the calorie restriction).

If you look at how metabolism works, fructose is only processed in the liver and the result is serum triglycerides. Dietary fats, however (at least as I understand it) are quickly taken up by chylomicrons and delivered to cells throughout the body, so they don't contribute much to trigylcerides as measured in the standard lipid panel. This is at least how I undersand it.

My personal experience is just an n=1, but within the low-carb community, the predictions were that by adopting a an LCHF diet, I would lose weight, not be hungry but eat less, feel more energetic, and that my lipid panels would improve. I've found all of these things happened, as well as odd little things like no longer having indigestion and just having a desire to exercise and be more active.

Do I KNOW this is from an LCHF way of eating? Not with absolute certainty, of course. But my experiences match the predictions and when I do endulge in a large amount of carbohydrates, I tend to feel not-so-great for a couple days.

Frankly, I'm just thankful to have found a way of eating that allows me to lose the weight I've carried for decades while allowing me to be more energetic, and with all that, not suffer from hunger or feelings of deprivation. A year ago, I had conceded to my best friend that I would always be fat but I could at least be active and fat (I was already bike-commuting and hiking). But after a mere 8 months of this way of eating... eating "as much as I feel like eating", I now weigh less than I have in almost 2 decades and I've started racing (albiet slowly) in 5Ks and triathlons. And note, I adopted the diet and started losing weight (about 30 pounds) before I started any of the running.

Maybe it's a "fad diet", I just eat like diabetics were told to eat in the early 1900s (https://archive.org/details/diabeticcookeryr00oppeiala) and how like most people were told to eat to lose weight until the 1960s or so. It's essentially "meat, eggs, and green veg" but avoid sugars and starches and most fruits. And I've never felt so good as an adult.

So my n=1 is not "science" and maybe it's all placebo, but if so, it's a pretty darned good placebo. I'm down 60 pounds I never thought I could lose and doing crazy things like triathlons, which were also unimaginable, even a year ago.

about 7 months ago

"Eskimo Diet" Lacks Support For Better Cardiovascular Health

hazem low carb and low PUFA vs high Omega-3? (166 comments)

A diet with all its componets is very different than supplement pills.

My guess (without reading 5000 papers) is that if there is some kind of benefit from an "Eskimo diet" it would be from it being devoid of flour and sugar, and generally low in carbohydrates and industrially processed polyunsaturated fats.

My personal experience is that by focusing on eating natural sources of fats and eliminating most carbohydrates (especially refined carbohydrates) for the last 8 months, I've lost a lot of exceess fat (60 pounds so far) and gained enough excess energy that I'm now regularly running in 5ks and even started competing in triathlons.

I take vitamins because they are relatively cheap, but I'm not sure I see the point of fish-oil capsules, especially with the bad breath and indigestion that comes with them.

As for CAD risk, I'm not sure. But by adopting a low-carb/high-fat diet (LCHF or "keto"), my cholesterol numbers (for what they're worth) have improved dramatically. My HDL is higher by a few points and my triglycerides are lower by more than 20 points, compared to when I used to be on a statin.

about 7 months ago

Space Telescope Reveals Weird Star Cluster Conundrum

hazem "That's funny..." (80 comments)

This reminds me of one of favorite Isaac Asimov quotes:

The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka" but "That's funny..."

I hope this leads them to go get more data in addition to thinking harder and coming up with ideas.

about 9 months ago

'weev' Conviction Vacated

hazem Re:To the point... (148 comments)

The meat-space equivalent is something like reporter (who is not Bob's wife) calling a bar and saying, "I'm Bob's wife, is Bob there?"

That's unethical maybe, but not illegal. Why should it be illegal just because that's done electronically?

about 10 months ago

Should Patients Have the Option To Not Know Their DNA?

hazem Re:Sounds like derp. (157 comments)

I like to think of it it his way. A soldier wears camoflage in the field to help protect him from being shot. Being able to not be seen against the background terrain is a form of obscurity and it is effective because it helps keep bullets from being aimed directly at the solider. The downside is that it's not particularly effective at stopping a bullet aimed at the soldier.

Body armor is different in that it's particularly useful when bullets are being aimed at the soldier. It can stop a bullet that camoflage clothing will not. While at the same time it, its downside is the limited mobility and extra heat.

Now, an even better measure of security than just either one of them is to use both. One helps keep you from being shot at while the other helps protect you when you are shot at.

Wouldn't you rather have both when you're a soldier in the field with someone trying to shoot at you? If you say yes, then you understand the point of obscurity in the security arena. If you say no, then that's probably a bit daft.

about 10 months ago

Firefox 29 Beta Arrives With UI Overhaul And CSS3 Variables

hazem Re:been using accounts in aurora for a month alrea (256 comments)

it should be a well layed out mechanism that allows one to sync to a server of choice, allowing one to host it themselves instead of relying on third parties.

It's not completely trivial to set up, but not horribly difficult either:

You set up your own Firefox Sync server on whatever machine you want.

about 10 months ago

Bringing Speed Reading To the Web

hazem Re:It does let you read faster... (47 comments)

Not suited, then, to casual reading.

It doesn't seem suited to serious reading either. When reading technical material, I need to read more than one word at a time, and when it gets challening, I go over sentences a couple times. I also often find things that mean I have scan back a paragraph or two to see if what I just read fits in with the previous material.

I guess for me, reading is not a linear activity. It's more of an exercise of finding and making connections throughout the text and with other texts. I just don't get that with reading one word followed by the next.

about 10 months ago

U.S. Students/Grads Carrying Over $1 Trillion In Debt

hazem Re:Tell me again... (538 comments)

i spend 600 a month on housing.
What's the housing situation in your town/city for non-students? I'm not saying that college housing isn't a racket (it's often the most profitable part of the college), would you be able to get room and board with utilities for $600 elsewhere?

about a year ago

Extinct Species of Early Human Survived On Grass Bulbs, Not Meat

hazem Re:Tiger nuts? Not meat? (318 comments)

Why would you assume they ate only the lean meat? Everything I've read about modern hunter-gatherers and cultures that ate mostly animals (such as the Inuit) is that they focused on the fats and fatty tissues and that the lean meats were often left for their dogs.

In the Western diet, we tend to focus on the lean meats and throw out the fats (the most energy-rich part of the animal) but that doesn't necessarily apply to humans living in the wild.

1 year,15 days

McAfee Brand Name Will Be Replaced By Intel Security

hazem Re:Interesting... (180 comments)

Norton Utilities was amazing at the time. I remember using his disk sector editor to find the sectors of a friend's thesis (only copy of course) and rebuild the FAT for the floppy so she could copy her thesis to another disk. The tools were just so well done.

I also learned the bigger part of x86 assembly from Peter Norton's book. It had fantastic examples - like building a basic disk sector editor. Ah, here it is:

1 year,21 days

Anti-GMO Activists Win Victory On Hawaiian Island

hazem Re:going after GMO is like banning screwdrivers (510 comments)

And frankly, if you are trying to assert that jellyfish and potatoes do indeed cross-breed naturally, I would like to see some evidence of that before I accept it. Such a claim requires evidence.

Nobody who is a proponent of evolution claims that dogs give birth to cats, so it would be ridiculous and non-germain to ask for evidence of that. If there was evidence like that, it would actually do more to challenge evolution than support it.

1 year,22 days

Anti-GMO Activists Win Victory On Hawaiian Island

hazem Re:going after GMO is like banning screwdrivers (510 comments)

Because somehow potatoes naturally breed with jellyfish and I just haven't seen it happen personally? You couldn't hit further from the mark.

It's sad that when I say, "We've made mistakes before with assuming things are safe and even beneficial (like Trans-fats), let's do more controlled testing of GMO before replacing our food supply with them" the only reponses are insults (the literary one above was clever, but still an insult - though I do like Dickens).

Is your (collective "you" of pro-GMO) so weak that that's all you have? Weak insults?

We were using artificial trans-fats for decades before they were being heavily pushed by scientists and authorities as a superior food-stuff. It was nearly a century after they were introduced that we have realized that they're actually quite harmful. How much controlled testing has been done on GMO to determine its long-term safety for human health and the environment? Is it so outrageous to want to see long-term testing done by people not in a position to make a fortune based on the results of that testing? And in lieu of that, is it so outrageous to want labeling so people have the choice about whether they will participate in this vast uncontrolled experiment or not?

And if you're going to say, "there's no difference" then please explain why corporations like Monsanto are paying billions of dollars to research and litigate in the domain of GMO. Clearly there is a difference.

I'm just asking for more science rather than blindly accepting what Monsanto et. al., tell me is safe. Do you have anything more than insults? Or is that what you call science?

1 year,22 days

Anti-GMO Activists Win Victory On Hawaiian Island

hazem Re:going after GMO is like banning screwdrivers (510 comments)

However, the next category error is assuming that just because a changed organism doesn't kill people outright that it's actually safe for long-term consumption and safe for other organisms in the environment.

1 year,22 days



Use your spare brain cycles to identify galaxies

hazem hazem writes  |  more than 7 years ago

hazem (472289) writes "Have fun, learn about galaxies and actually help astronomers by looking at pictures of galaxies and identify the type. From the website: '... GalaxyZoo http://www.galaxyzoo.org/, the project which harnesses the power of the internet — and your brain — to classify a million galaxies. By taking part, you'll not only be contributing to scientific research, but you'll view parts of the Universe that literally no-one has ever seen before and get a sense of the glorious diversity of galaxies that pepper the sky. Why do we need you? The simple answer is that the human brain is much better at recognising patterns than a computer can ever be. Any computer program we write to sort our galaxies into categories would do a reasonable job, but it would also inevitably throw out the unusual, the weird and the wonderful. To rescue these interesting systems which have a story to tell, we need you.' Warning... it's more addictive than Tetris."
Link to Original Source



Linux/Windows Auto Rebuilder

hazem hazem writes  |  more than 10 years ago

October 19th, 2004


After posting about creating an auto-re-imaging system using Linux to keep Windows running nicely, I got a lot of responses. (The article was "Spyware/Adware Prevention In Large Deployments?"). I mailed the following to several people and posted it as a reply to my own comments.


I just wrote up this document, and put the files inline within it. It should be clear how to snip them to make the individual files.

I'd release this under the GPL, but darn, it just doesn't seem like there's enough there to bother. I mean... can you really GPL some config scripts?

I found it helpful to configure the Linux stuff on one computer, then using a bootable Linux CD (I didn't want the local box slowed down by unnecessary services like networking), I put it on a server, called lin.tgz. I then booted on another machine with the bootable cd, and applied it to the /dev/hda2. If that was mounted to /lin, you'd then need to do a "chroot /lin" and then run /sbin/lilo to get lilo installed.

Good luck!

hazem-dli at google's mail service

Linux Rebuilder
Write-up version 0.1, 19 October 2004, 4:17AM

This set of tools helps automate the process of keeping a Windows box with a consistent image. It works similarly to "Deep Freeze" by storing an image of the Windows system and all its software on a Linux partition. The computer boots into Linux, which restores this image to the Windows partition (overwriting whatever the user did before). It then reboots into Windows.

** Installing/Setup **
        The scripts as I have written them use tar/gzip to make the image of the Windows partition. This is because I was working on Win98 boxes that use FAT32 (which Linux can easily read and write). Linux does not yet reliably write NTFS, so to use this on an NTFS based Windows system, such as Windows 2000, or Windows XP, the scripts will need to be rewritten using dd/gzip rather than tar/gzip.

Here are the basic steps:
1) Install Windows on your computer. If you are using one drive, partition that drive in half (or, if you know how much space you'll need, just a little more than that - make sure you leave enough room on the remaining partition for your linux install (as little as 50MB, and room for the compressed image of your windows image). Install all your applications and customize the Windows "image" so that it is exactly the way you want it to be each time you reboot.
2) Install some Linux version on the other half. Keep it small, since you won't need networking, X, or much else.
3) Create a /rebuilder directory and place the following files in that directory: getimage, putimage, rebuilder, win_reboot
4) Modify /etc/rc.local to point to /rebuilder/rebuilder
5) Modify /etc/lilo.conf to match the menu options in my lilo.conf. Run lilo.
6) Create a /images directory to store the image.

For FAT32 systems using tar/gzip, you'll need to add an entry to your /etc/fstab to mount /dev/hda1 to /win.

** Useful Points **
There are two main keys to why this thing works pretty well. First, lilo can invoke the same kernel with different options. The menu options I place in lilo.conf do this. The other key is contained in the win_reboot file. By invoking lilo with the -R option followed by a boot label, (eg. "lilo -R Windows"), lilo will override its default boot option on the next reboot.

There are two other nice features that work nicely. The first one is that while the kernel is loading, the keyboard cannot interrupt the process. This is great for keeping someone from hijacking the system. The second is that by putting the line "password=""" in lilo.conf will password protect the boot options that do not have a "bypass" in them. This allows the user to do some things, like boot directly into Windows, or even rebuild the Windows partition, but not make a new image of the Windows partition.

If you're going to do a dd/gzip option, you'll want to wipe your Windows partition's empty space. From the documentation for g4u, there is a link to a program called nulfile, which will fill up the empty space with 0's. http://www.feyrer.de/g4u/

(If you like imaging, check out g4u, since it has many options that are similar to Norton Ghost. It may even work to replace what I've done here, but I'm not sure.)

** How it Works **

There are several lilo boot options that come up when the computer boots. They are fairly self explanatory.

auto_rebuild: default - it goes to Linux and if rebuild is set, it rebuilds window and then reboots directly into Windows
Windows: boots directly into Windows
rebuild_win: allows someone to force a rebuild of Windows without rebooting directly into it
get_image: takes an image of what is currently on the Windows drive. This will become the new image that rebuilds are based on
auto_on: turns ON autotmatic rebuilds
auto_off: turns OFF automatic rebuilds

Some options are password protected. The password for these options is set by running lilo. It will prompt for the password and store it in a hashed form. One can put the actual password in plaintext in the lilo.conf, but I prefer a bit of secrecy here!

1) Basically, the computer boots up to lilo, which then launches the "auto_rebuild" option.
2) From /etc/rc.local, the script /rebuild/rebuild is run. It uses a case/switch structure to see what kernel option was passed (read from /proc/cmdline).
3) If it was "auto_rebuild", it checks to see if the file /rebuild/auto_rebuild_on exists. If so, the Windows image file is applied to the Windows partition
4) /rebuild/win_reboot is invoked, which reboots the computer and lilo will go immediately into Windows

** Updating the Windows Software **

To install new software/updates to Windows, do the following:
1) do a "rebuild_win" go get to a known state
2) to an "auto_off" so that work isn't lost while rebooting during
3) updates and installs
4) boot direclty into Windows to install software and updates as needed
5) when the computer is reconfigured, reboot and choose "get_image"
6) reboot and select "auto_on". The computer will now re-image itself on reboot with the new settings.

** Cautionary Tales **

The only caveat is not to install anything that tweaks the partitions, such as the boot locker on Foolproof. Other foolproof stuff CAN be installed, though. So, you may consider installing Foolproof without bootlock, and then set the rebuilder for manual-only rebuilds.

The only other caveat is that you will want to turn off any auto update features in any of the software (Windows, AV, Spyware, etc). Each time the system is rebuilt, these softwares will try to re-update.

A nice improvement would be to allow the system to have the option of creating multiple Windows images to allow roll-backs, particularly if there was an error while creating the image. As it stands now, if it crashes while doing a "getimage", your only rescue is that the Windows partition should still be in good shape, and you can try again.

** Removing the Rebuilder **

First, to remove this system (or just totally disable it), boot up onto a Windows bootable floppy (or Windows install CD) that has fdisk on it. Just type: fdisk /mbr, and the menu system will be gone, and the system will boot into Windows.

If it then tries to boot into Linux instead, boot up on the same disk, use fdisk, and make sure the "active partition" is the Windows one.

This still leaves the Linux stuff in there, but it just gets bypassed. To get rid of that, you'll need to use a partitioning tool that will allow you to delete the Linux partition and then expand the Windows partition. I believe Partition Magic will do this.

** The Files **
File: /etc/lilo.conf
Notes: If your system is not set up on hda, you'll need to make more changes to this. It expects Windows on hda1, and your Linux installed on hda2

---- start lilo.conf ----
# LILO configuration file
# generated by 'liloconfig'
# Start LILO global section
boot = /dev/hda
#compact # faster, but won't work on all systems.
timeout = 50
# Normal VGA console
vga = normal

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = AutoRebuild
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

# DOS bootable partition config begins
other = /dev/hda1
    label = Windows
    table = /dev/hda
# DOS bootable partition config ends

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = Rebuild
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = Get_Win
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = Auto-on
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = Auto-off
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

# Linux bootable partition config begins
image = /boot/vmlinuz
    root = /dev/hda2
    label = Linux
    read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends

---- end lilo.conf ----

File: /etc/rc.local
Notes: This might have more stuff for your system, so you're really only concerned about the last line that invokes /rebuilder/rebuilder

---- start rc.local ----
# /etc/rc.d/rc.local: Local system initialization script.
# Put any local setup commands in here:

cat /proc/cmdline

#invoke the rebuilder script /rebuild/rebuilder

---- end rc.local ----

File: /rebuild/getimage
Notes: This is the script that gets the Windows partition. It is written for Windows98, which uses FAT32. Since Linux can reliably read/write FAT32, I do some clean-up stuff, such as deleting temp files. You can't do this win Windows XP, and you will need to change from using tar/gzip to using dd/gzip

---- start getimage ----

echo Creating new image file


# if an image already exists, provide 10 seconds before the image is
# over-written

if [ -e /image/win98image.tgz ]
      echo You have 10 seconds to hit ctrl-c and stop the regetting process
      sleep 10

# Skip these rm statements if you are using NTFS based systems
#swapfile is big and doesn't need to be backed up
rm /win/Windows/win386.swp

#also cleanup some other files
rm /win/Windows/temp/*
rm -rf /win/Windows/Temporary\ Internet\ Files/*
rm -rf /win/Windows/*.tmp
rm -rf /win/Windows/History
rm /win/*.1st
rm /win/*.00*
rm /win/*.prv

#get the boot sector of the partition
dd if=/dev/hda1 of=/image/bootsector.img bs=512 count=1

#create tgz archive of the Windows partition
# for NTFS, you would change this to something like:
# dd if=/dev/hda1 bs=8192|gzip -c > /image/winXPimage.gz
# just make sure your image file name matches what is in putimage

tar cvzf /image/win98image.tgz /win

---- end getimage ----

File: /rebuild/putimage
Notes: This is the script that puts the image back on the Windows partition. It's the complement to getimage. Again, it is written for Windows98, which uses FAT32. Since Linux can reliably read/write FAT32, I do some clean-up stuff, such as deleting all the files on the Windows partition. You can't do this win Windows XP, and you will need to change from using tar/gzip to using dd/gzip

---- start putimage ----


echo Rebuilding Windows drive

# if there is a command line arugment ("no sleep"), we go right into
# rebuilding. Otherwise, we give a 10 sec grace period!

if [ -z "$1" ]
      echo You have 10 seconds to hit ctrl-c and stop the rebuild process
      sleep 10

if [ -e /image/win98image.tgz ]
        # you can't do this if you're using NTFS - just skip it, since it's not necessary
        #delete existing Windows
        rm -rf /win/*

        # with NTFS, this can be skipped too, since it's redundant
        #restore the boot sector of the partition
        dd of=/dev/hda1 if=/image/bootsector.img bs=512 count=1

        # for NTFS, you'd need to change this to (based on getimage above)
        # gunzip -c /images/winXPimage.gz|dd of=/dev/hda1 bs=8192

#restore the Windows files
        (cd /;tar xzvf /image/win98image.tgz)

        echo Windows drive rebuilt
        echo WARNING!
        echo There was no image to rebuild from.
        echo Try using "getimage"

---- end putimage ----

File: /rebuild/rebuilder
Notes: This script is called from /etc/rc.local. It reads the /proc/cmdline to see if any of its options are there, and if so, takes the appropriate action

---- start reubilder ----


# this is the main script for the Windows image rebuilder
# it is evoked from /etc/init.d/rc.local
# it looks at the kernel options set by lilo to determine the action

# look to see if we should rebuild Windows
if grep -q auto_rebuild /proc/cmdline
      # we should automatically rebuild Windows
      if [ -e /rebuild/auto_rebuild_on ]
        #echo I would rebuild Windows because the auto_rebuild_on exists /rebuild/putimage nosleep
        echo Did nothing: Auto-Rebuild currently turned off.. booting Windows
                sleep 10
      fi /rebuild/win_reboot
elif grep -q rebuild_win /proc/cmdline
        # we SHOULD rebuild Windows
        #echo rebuild Windows /rebuild/putimage
        echo Rebooting to Windows in 10 seconds. Press ctrl-c to abort.
        sleep 10 /rebuild/win_reboot
elif grep -q get_image /proc/cmdline
        # we should get the current Windows drive as the new image
        #echo get new image /rebuild/getimage

elif grep -q auto_on /proc/cmdline
        # we should set the auto-rebuild to ON
        echo CAUTION: Set Auto-Rebuild to ON
        touch /rebuild/auto_rebuild_on

elif grep -q auto_off /proc/cmdline
        # we should set the auto-rebuild to OFF
        echo Set Auto-Rebuild to OFF
        rm /rebuild/auto_rebuild_on
        # we don't do anything special - just go into Linux
        echo booting into Linux.

---- end rebuilder ----

File: /rebuild/win_reboot
Notes: This is called to make lilo bypass its default and go directly into Windows.

---- start win_reboot ----
# This overrides lilo's default boot option and forces the next reboot
# into the Windows drive

lilo -R Windows /sbin/init 6
---- end win_reboot ----

Slashdot Login

Need an Account?

Forgot your password?