Auto XP partion restore


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Auto XP partion restore
# 1  
Old 01-27-2009
Question Auto XP partion restore

At my computer shop where I work, we got alot of used PC's from some place. It's my job to refurbish them for resale. Each computer comes with XP pro. So the boss man asks me if there is a way to put a XP restore option. I say yes if I install Linux on a small partion and use partimage to make a image of the XP partion and store in on the Ubuntu side. I wrote a small shell script so the end user could restore XP without having to bring it in theshop when they foul XP up.

Here is the script:

Code:
#!/bin/bash
# System Restore


echo "***************************** XP System Restore *****************************"
read -n 1 -p "Press any key to continue"

echo "This will restore your Windows XP installation"

echo "********************YOU WILL LOSE ALL DATA IF YOU CONTINUE********************"
echo "ONLY RUN THIS IF YOU WANT A FRESH INSTALL OF XP"
echo "Y to continue N to exit Y/N"

read a
if [[ $a == "N" || $a == "n" ]]; then
read -n 1 -p "Press any key to continue..."
exit

else

if [[ $a == "Y" || $a == "y" ]]; then
echo "Restore System Now? **Warning** ALL DATA WILL BE ERASED!! Y/N?"
read a
if [[ $a == "N" || $a == "n" ]]; then
exit
else
if [[ $a == "Y" || $a == "y" ]]; then
read -n 1 -p "Press any key to continue... The password is owner"
sudo partimage restore /dev/sda1 /home/owner/XP-Restore.000

fi
fi
fi
fi
It works fine but not simple enough for end users (So the Boss Man says). So I edited GRUB so it would only give two options "Windows XP Pro" and "System Restore"--Ubuntu--.

Is there a way to have the script auto run on boot or login and have partimage restore without any input from the end user other then the Y/N questions that I have in the script.

If anyone can help me out here it would be greatly appreciated Image



Would the use of flag -BX work here.

* -BX, --fully-batch=X batch mode without GUI, X is a challenge response string


I don't understand the batch = X part... is the X meant to be replaced with something or would the command just look like this?

Code:
sudo partimage restore -BX /dev/sda1 /home/owner/XP-Restore.000
# 2  
Old 01-27-2009
Can you use the /etc/init.d startup scripts area, although I'm not sure if this would not allow the user to respond.

Running the script from /etc/profile should evoke it at login for all users, or from .profile for specific users.

Alternatively, maybe try creating a user with your script as its defined shell in /etc/passwd. This is what I used to do to get my kids to shutdown my Linux box properly after they'd been playing games...I told them to login as "shutdown" which was a user with no password but with a shutdown script defined in passwd.

Jerry
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

How to know exactly which physical partion contains data?

/dev/fslv01 5.00 2.90 42% 776 1% /movelv_testfslv01:/movelv_test LP PP1 PV1 PP2 PV2 PP3 PV3 0001 0175 hdisk1 0111 hdisk0 0002 0176 hdisk1 0112 hdisk0 0003 0177 hdisk1 0113 hdisk0... (10 Replies)
Discussion started by: bobochacha29
10 Replies

2. Solaris

unable to boot afer restoring root partion manages by veritas

Hi all, After restoring the / FS on a netra 240. It is unable to boot the system. The message displayed is the following: "The file just loaded does not appear to be executable" Bellow, the content of /etc/vfstab before restoring: #more /etc/vfstab... (0 Replies)
Discussion started by: faberarnold
0 Replies

3. Linux

Centos 5 install. Partion order

I can't control the partion order during install. For example i need. hda5 /var 1GB hda6 /opt 2GB I created them in such order but OS adjust them to hda5 /opt 2GB hda6 /var 1GB It is frustrating during install, I pretty sure I can order the partion as i like... (0 Replies)
Discussion started by: honglus
0 Replies

4. AIX

mksysb restore - Wrong OS level for restore

Hi all, I am still working on my mksysb restore. My latest issue is during an alt_disk_install from tape I got the following error after all the data had been restored. 0505-143 alt_disk_install: Unable to match mksysb level 5.2.0 with any available boot images. Please correct this... (0 Replies)
Discussion started by: pobman
0 Replies

5. Solaris

How to create on partion from 2 disks?

Hi everyone :b: I'm glade to join this forum and I have one question I installed latest Solaris 10 release on SF V480 with 2 73 GB disks 8 GB RAM 4 CPU's My configuration is 10GB for root, 8GB for Swap and 12GB for var. I mirrored root, so disk 1 has 40GB free of space and disk 2 has... (11 Replies)
Discussion started by: HishamN
11 Replies

6. UNIX for Dummies Questions & Answers

Partion Magic problems.

Hiya people, A great big "HI" to everybody. I'm new to the Forum and now to my problem(s). I am about to partition my only 80GB HD and using the Partition Magic 8 software it looks fairly simple although here is my problem :- 1. Do I change the new partition to primary or logical? 2. Do I... (4 Replies)
Discussion started by: Syndrome_00
4 Replies

7. Linux

Doing stuff to files on a NTFS partion from linux

I have a 50GB section of my hard drive on which I've kept all my music, movies and more back from when I had Windows. When I'm in linux it says that the NTFS section is a read only section. Is it possible to copy, rename, add, move or delete any files off of this section? I'm trying to get rid... (2 Replies)
Discussion started by: CTroxtell21
2 Replies

8. UNIX for Dummies Questions & Answers

Partion size

hi, just need to know the disk size and the partition size on machine.pls let me know how to do that.is their a way i can get to know the size of directory.like /,/var...etc. thanx (2 Replies)
Discussion started by: saood
2 Replies
Login or Register to Ask a Question