# # BpBatch menu, from Massimo Pistoni # InitGraph # set KeyTouched=0 :Set_NoPriv TextAttr Black Black Clear Set IsoLatin = "off" #LoadCodePage "cp-gr.bin" #Drawgif "boot.gif" Set MenuNum=3 Set X1=250 Set Y1=200 Set X2=300 Set Y2=75 Set MenuItem="Boot_Windows Boot_Linux Set_Privileges" # -- # -- Menu Manager # -- :Init Set CurrentItem=1 :menu DrawWindow $X1 $Y1 $X2 $Y2 DrawText ($X1 + 10) ($Y1+2) "Boot Selection" White Set i=1 :loop Set j=($i - 1) DrawText ($X1 + 10) (($Y1+10) + ($i*15)) "$MenuItem"{$j}/_= / White Set i=($i+1) if $i <= $MenuNum goto loop :loop2 DrawBar ($X1 + 5) ( ($Y1 +10) + ($CurrentItem*15) ) 290 15 Yellow Set j=($CurrentItem - 1) DrawText ($X1 + 10) ( ($Y1 +10) + ($CurrentItem*15) ) "$MenuItem"{$j}/_= / Black # # Change here the default boot label if $KeyTouched == 0 WaitForKey 30 goto Boot_Linux Set KeyTouched=1 GetKey Key :Check_For_Up_Key if "$key" != "" goto Check_For_Down_Key # Up Key Set CurrentItem = ($CurrentItem - 1) if $CurrentItem < 1 Set CurrentItem = $MenuNum goto menu :Check_For_Down_Key if "$key" != "" goto Check_For_Return_Key # Down Key Set CurrentItem = ($CurrentItem + 1) if $CurrentItem > $MenuNum Set CurrentItem = 1 goto menu :Check_For_Return_Key if "$key" != "\r" goto menu # Return Key # -------------------- # now do what you have # Edit below # -------------------- if $CurrentItem == 1 goto Boot_Windows if $CurrentItem == 2 goto Boot_Linux if $CurrentItem == 3 goto Privileges if $CurrentItem == 4 goto Reset_Partitions if $CurrentItem == 5 goto Restore_Win2000_Image if $CurrentItem == 6 goto Restore_Linux_Image if $CurrentItem == 7 goto Restore_Win2000_And_Linux_Images if $CurrentItem == 8 goto Restore_Win98_Image if $CurrentItem == 9 goto Restore_Win2000_And_Win98_Images if $CurrentItem == 10 goto Interactive :Privileges if "$MenuItem"{$j} == "Set_NoPriv" goto Set_NoPriv :Set_Privileges Set X3=280 Set Y3=350 Set X4=240 Set Y4=100 DrawWindow $X3 $Y3 $X4 $Y4 "Authentication" DrawText ($X3 + 10) ($Y3 + 34) "Username: " DrawText ($X3 + 10) ($Y3 + 49) "Password: " :GetUsername TextAttr Yellow LightGray at 24, 46 Input Username 12 if "$Username" == "" goto Set_NoPriv :GetPasswd TextAttr Yellow LightGray at 25, 46 GetPasswd Password 12 set Authentication = "PASSED" if "$Username" != "root" set Authentication = "FAILED" if not "$Password" Match-Passwd "ZiTwLw7wVkKJs" set Authentication = "FAILED" if "$Authentication" == "PASSED" goto Passed Beep DrawText ($X3 + 10) ($Y3 + 70) "Authentication $Authentication" TextAttr Black LightGray Delay 2 goto Set_Privileges :Passed set Password="************" TextAttr Black Black Clear Set MenuNum=10 Set X1=250 Set Y1=200 Set X2=300 Set Y2=180 Set MenuItem="Boot_Windows Boot_Linux Set_NoPriv Reset_Partitions Restore_Win2000_Image Restore_Linux_Image Restore_Win2000_And_Linux_Images Restore_Win98_Image Restore_Win2000_And_Win98_Images Interactive" goto init :Boot_Windows if exist "{:1}win2000hostname.reg" delete "{:1}win2000hostname.reg" patch "bpbatch/win2000hostname.ref" "{:1}win2000hostname.reg" if exist "{:1}win2000hostname-afs.reg" delete "{:1}win2000hostname-afs.reg" patch "bpbatch/win2000hostname-afs.ref" "{:1}win2000hostname-afs.reg" hdboot :1 goto menu :Boot_Linux LinuxBoot "bpbatch/linux.krn" "root=/dev/hda5 BOOT_IMAGE=linux" goto menu :Reset_Partitions hidelog SetPartitions "FAT16:2047 EXT:4268 0:0 0:0 LINUX-EXT2:3500 LINUX-SWAP:768" clean 0 clean 1 clean 2 clean 5 clean 6 clean -1 goto menu :Restore_Win2000_Image hidelog SetPartitions "FAT16:2047 EXT:4268 0:0 0:0 LINUX-EXT2:3500 LINUX-SWAP:768" SetBootPart 1 clean 0 clean 2 clean -1 FullUnzip "bpbatch/win2000.imz" 1 if exist "{:1}win2000hostname.reg" delete "{:1}win2000hostname.reg" patch "bpbatch/win2000hostname.ref" "{:1}win2000hostname.reg" if exist "{:1}win2000hostname-afs.reg" delete "{:1}win2000hostname-afs.reg" patch "bpbatch/win2000hostname-afs.ref" "{:1}win2000hostname-afs.reg" hidebootprom hdboot :1 goto menu :Restore_Linux_Image hidelog SetPartitions "FAT16:2047 EXT:4268 0:0 0:0 LINUX-EXT2:3500 LINUX-SWAP:768" #SetBootPart 2 clean 0 clean 2 clean -1 clean 6 fullunzip "bpbatch/linux.imz" 5 copy "bpbatch/fstab" "{:5}/etc/fstab" copy "bpbatch/rc.sysinit" "{:5}/etc/rc.d/rc.sysinit" mkdir "{:5}/var/lock/subsys" mkdir "{:5}/var/lock/console" mkdir "{:5}/var/log/news" mkdir "{:5}/var/run/netreport" copy "bpbatch/nullfile" "{:5}/var/log/pacct" copy "bpbatch/passwd" "{:5}/etc/passwd" LinuxBoot "bpbatch/linux.krn" "root=/dev/hda5 BOOT_IMAGE=linux" goto menu :Restore_Win2000_And_Linux_Images hidelog SetPartitions "FAT16:2047 EXT:4268 0:0 0:0 LINUX-EXT2:3500 LINUX-SWAP:768" SetBootPart 1 clean 0 clean 2 clean -1 clean 6 FullUnzip "bpbatch/win2000.imz" 1 if exist "{:1}win2000hostname.reg" delete "{:1}win2000hostname.reg" patch "bpbatch/win2000hostname.ref" "{:1}win2000hostname.reg" if exist "{:1}win2000hostname-afs.reg" delete "{:1}win2000hostname-afs.reg" patch "bpbatch/win2000hostname-afs.ref" "{:1}win2000hostname-afs.reg" clean -1 FullUnzip "bpbatch/linux.imz" 5 copy "bpbatch/fstab" "{:5}/etc/fstab" copy "bpbatch/rc.sysinit" "{:5}/etc/rc.d/rc.sysinit" mkdir "{:5}/var/lock/subsys" mkdir "{:5}/var/lock/console" mkdir "{:5}/var/log/news" mkdir "{:5}/var/run/netreport" copy "bpbatch/nullfile" "{:5}/var/log/pacct" copy "bpbatch/passwd" "{:5}/etc/passwd" hidebootprom hdboot :1 goto menu :Restore_Win98_Image hidelog SetPartitions "FAT16:2047 FAT16:2047" SetBootPart 2 clean 0 clean -1 FullUnzip "bpbatch/win98.imz" 2 hidebootprom hdboot :2 goto menu :Restore_Win2000_And_Win98_Images hidelog SetPartitions "FAT16:2047 FAT16:2047" SetBootPart 1 clean 0 clean -1 FullUnzip "bpbatch/win2000.imz" 1 if exist "{:1}win2000hostname.reg" delete "{:1}win2000hostname.reg" patch "bpbatch/win2000hostname.ref" "{:1}win2000hostname.reg" if exist "{:1}win2000hostname-afs.reg" delete "{:1}win2000hostname-afs.reg" patch "bpbatch/win2000hostname-afs.ref" "{:1}win2000hostname-afs.reg" clean -1 FullUnzip "bpbatch/win98.imz" 2 hidebootprom hdboot :2 goto menu :Interactive Interact hidelog goto menu