I was wondering if there was away with G4D to time expire a BootDVD against the bios time and date? What I mean is that I still make BootDVD's for my techs because sometimes not everything will boot to USB so I make them a BootDVD using G4D and I will make changes or updates and they tend to keep using older version for way too long. Wasn't sure if this was heard of or not? I thought maybe G4D could check the time and date from that boot machine and if it's more than 30 days from the date set in the menu.lst, a message will appear, example "This BootDVD Has Expired, Please Burn A Newer Version"?
Time Expire BootDVD
#1
Posted 31 December 2012 - 12:20 AM
#2
Posted 31 December 2012 - 01:44 AM
What if they have reset the CMOS - the date will be old and invalid?
The variable %@date% will return the date in grub4dos as 2012-12-31. You could then strip out the year, month and date and multiply them out - then compare with your own value
The code below is not fully tested and February is assumed to have 28 days (leap years are not catered for!) - change the EDay/EMonth/EYear to the date that you release it on.
debug off #set release date set EDay=30 set EMonth=11 set EYear=2012 #set number of days allowed before we warn set ExpiresIn=30 # Now lets work it out! set d=%@date% set CDay=%d:~8,2% set CMonth=%d:~5,2% set CYear=%d:~0,4% set cd=%CDay% set /a cm=%CMonth% * 31 set /a cy=%CYear% * 365 set /a cd=%cd% + %cm% + %cy% #echo cd=%cd% set /a em=%EMonth% * 31 set /a ey=%EYear% * 365 set /a ed=%EDay% + %em% + %ey% #echo ed=%ed% # 30 days hath 9, 4, 6 11 - feb has 28 days if %EMonth%>=12 set /a ed=%ed%-1 if %EMonth%>=10 set /a ed=%ed%-1 if %EMonth%>=7 set /a ed=%ed%-1 if %EMonth%>=5 set /a ed=%ed%-1 if %EMonth%>=3 set /a ed=%ed%-3 # ignore leap years! #echo cd=%cd% # 30 days hath 9, 4, 6 11 - feb has 28 days if %CMonth%>=12 set /a cd=%cd%-1 if %CMonth%>=10 set /a cd=%cd%-1 if %CMonth%>=7 set /a cd=%cd%-1 if %CMonth%>=5 set /a cd=%cd%-1 if %CMonth%>=3 set /a cd=%cd%-3 # we ignore leap years for now so it may be a day out! #echo cd=%cd% ed=%ed% # add 30 days or whatever has been set set /a ed=%ed% + %ExpiresIn% echo current days=%cd% Expiry days=%ed% if %cd%>=%ed% echo WARNING: Older than %ExpiresIn% days! && pause debug on
- laddanator likes this
#3
Posted 31 December 2012 - 02:03 AM
What I mean is that I still make BootDVD's for my techs because sometimes not everything will boot to USB so I make them a BootDVD using G4D and I will make changes or updates and they tend to keep using older version for way too long.
My company gave Zalman ZM-VE200 caddies for all field Service engineers - now we don't have to burn and send out 100's of CDs or DVDs (which was a real pain!) - they just check and download any new ISOs from our private website every night at home (or at the customers site if necessary).
#4
Posted 31 December 2012 - 02:20 AM
What if they have reset the CMOS - the date will be old and invalid?
That is very rare. I think in 10 years in the business I have only had to replace the cmos batt twice but if that comes up, not to much worried about one here and there. Thanks for the code, will give this a test.
#5
Posted 31 December 2012 - 02:23 AM
My company gave Zalman ZM-VE200 caddies for all field Service engineers - now we don't have to burn and send out 100's of CDs or DVDs (which was a real pain!) - they just check and download any new ISOs from our private website every night at home (or at the customers site if necessary).
That's what I am trying to accomplish. I will upload the ISO and when they get the Expired message, they will know it's time to update their ISO. I only look after three techs, so not that many DVD's. Small mom and pop company.
#6
Posted 31 December 2012 - 04:03 AM
Ok, code seems to work. I tested by changing =30 to this
set ExpiresIn=0
The only problem is if you hit enter, you can still get to the menu. I would like for this to stop at the message screen and will not go any further no matter what key is press
I just added a reboot here
if %cd%>=%ed% echo WARNING: Older than %ExpiresIn% days! && pause && reboot
#7
Posted 31 December 2012 - 09:57 AM
You will need to test it thoroughly. Dates are always tricky to work with due to number of days per month and leap years, etc.
#8
Posted 31 December 2012 - 12:18 PM
Here is a batch file which you can call from a menu.lst file - it now accounts for leap years too.
You can use it in a menu.lst like this
# Usage: /checkdate.g4b <Release Year> <Release Month> <Release DayOfMonth> <ExpiresInDays> [<SILENT>] /checkdate.g4b 2012 12 30 2 pause if NOT "%CHECKDATE%"=="OK" reboot
/checkdate.g4b 2012 11 27 30 SILENT if NOT "%CHECKDATE%"=="OK" echo THIS SOFTWARE HAS EXPIRED! && pause && reboot
Examples of the standard messages produced are either:
CheckDate: Release Date 2012-12-31 (Today is 2012-12-31)CheckDate: This version is good for 2 days from release
CheckDate: This version expires in 1 day(s)
OR
CheckDate: Release Date 2012-12-3 (Today is 2012-12-31)CheckDate: This version is good for 2 days from release
CheckDate: WARNING: This is older than 2 days!
If you wish you can change the messages by editing the batch file.
The batch file could be cleaned up and made more efficient, but I prefer to keep it easy to understand (what's a few milliseconds between friends!).
Attached Files
- laddanator likes this
#9
Posted 31 December 2012 - 03:04 PM
Thanks, steve6375. Will make a test run today. What format is that .g4b? Did I understand you correctly when you said batch file?
Using this command on the DVD menu.lst
/checkdate.g4b 2012 11 27 30 SILENT if NOT "%CHECKDATE%"=="OK" echo THIS SOFTWARE HAS EXPIRED! && pause && reboot
I am getting "Warning! No such command: /checkdate.g4b" I am testing this under VirtualBox. I am using g4d 10-31-2012.
#10
Posted 31 December 2012 - 03:20 PM
Thanks, steve6375. Will make a test run today. What format is that .g4b? Did I understand you correctly when you said batch file?
JFYI:
http://reboot.pro/to...l-for-grub4dos/
http://www.rmprepusb...rials/grubutils
.g4b is a "provisional" extension for grub4dos batches (or !BAT files).
Wonko
#11
Posted 31 December 2012 - 03:35 PM
You need to extract the .g4b file and place it in the root of the USB drive - it is a plain text batch file
#12
Posted 31 December 2012 - 03:45 PM
You need to extract the .g4b file and place it in the root of the USB drive - it is a plain text batch file
I tried to extracted it but nothing I have to extract will extracted it. I am new to the .g4d so I am a little confused as to why this would be in the menu.lst if it was intended to use the extracted .g4d bat file??
/checkdate.g4b 2012 12 30 2
To make sure we are clear. I extracted the .g4d from the checkdate.zip and put the checkdate.g4b on root of my drive or do you mean I need to extract the .g4d file? I put checkdate.g4b from the extracted zip file and I got the Warning! no command error. I know the file has to be extracted from the zip file..give me a little credit!
if it was intended to use the extracted bat file? I am able to open the .g4d file with notepad ++ and copy the contents to a bat file.
#13
Posted 31 December 2012 - 03:53 PM
The link that I attached was for a zip file
1. download the zip file
2. Extract from it the checkdate.g4b file
3. Copy the checkdate.g4b file to the root of your USB drive
#14
Posted 31 December 2012 - 03:59 PM
The link that I attached was for a zip file
1. download the zip file
2. Extract from it the checkdate.g4b file
3. Copy the checkdate.g4b file to the root of your USB drive
Read my post above. I did that. I am slow but not that slow. I know the file has to be extracted from the zip file. Not my first Rodeo as we say here in the South. What I am saying is the checkdate.g4d file is on the root of my drive and I am using the menu.lst command you posted and I am getting the no command error.
#15
Posted 31 December 2012 - 04:02 PM
.g4b or .g4d ???
#16
Posted 31 December 2012 - 04:04 PM
.g4b or .g4d ???
The file that was extracted from your zip file says .g4b which didn't make sense to me but now it does. The extension is wrong and I assume and it should be .g4d?
#17
Posted 31 December 2012 - 04:06 PM
The menu.lst runs /checkdate.g4b so the file should be called .g4b
g4b = grub4dos batch
grub4dos executables (such as wenv) can have the .g4e extension
#18
Posted 31 December 2012 - 04:10 PM
The menu.lst runs /checkdate.g4b so the file should be called .g4b
g4b = grub4dos batch
Oh, ok. I posted the wrong extension(meant .g4b). Sorry, my fault.I have it right in the menu.lst, just a mistype.
#19
Posted 31 December 2012 - 04:39 PM
Ok, the commands work fine from a USB in Qemu with the checkdate.g4b on root of USB but the same setup will not work from the root of DVD and gives the no such command error.
menu.lst for USB and DVD
/checkdate.g4b 2012 12 30 30 pause if NOT "%CHECKDATE%"=="OK" reboot
Could it be that the time and date check will not work from a G4D DVD under a virtual machine?
#20
Posted 31 December 2012 - 04:42 PM
What version of grldr do you use to make the bootable DVD?
If you press C and do ls / does it list the DVD root files?
#21
Posted 31 December 2012 - 04:51 PM
What version of grldr do you use to make the bootable DVD?If you press C and do ls / does it list the DVD root files?
Using 10-02-2012 version and when I do a c ls / it does list all the root dvd files and checkdate.g4b is on that list.
#22
Posted 31 December 2012 - 04:53 PM
So is it same version on USB? Feb 2012 sounds a bit old?
in grub4dos shell, try running the batch file by typing /checkdate.g4b and see what happens...
#23
Posted 31 December 2012 - 04:56 PM
So is it same version on USB? Feb 2012 sounds a bit old?in grub4dos shell, try running the batch file by typing /checkdate.g4b and see what happens...
Yes same version as the USB and sorry, forgot you guys do your dates different than we here. When I say 10-02-2012, I mean October the 2nd 2012.
Ok see something. On the root of my DVD before I compile it to ISO the file is called checkdate.g4b but when I use ls / the file shows up as checkdat.g4b....the e is missing. Wonder how that happened. I use this code to compile.
cdimage.exe -bgrldr -j1 -u1 -h -m -oc -lWindows_7x32_SP1 7x32_COMPLETE\ 7x32.iso
Will G4D only output 8 characters in the c prompt? On the root of the complied ISO, the g4b has the e on it but I noticed g4d shorten my AutoUnattended.xml list also to just 8.
UPDATE.
The checkdate.g4b command will run if I leave the e of and just use checkdat.g4b. Something in the way I compile the ISO is only allowing 8 charters like dos. Will look into.
#24
Posted 31 December 2012 - 05:02 PM
can you run the batch file from the command shell?
What do you see if you run read 0x8278
#25
Posted 31 December 2012 - 05:08 PM
maybe g4d only supports 8.3 filenames - just shorten the name of the file and change the menu.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users