Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Main(ByVal Args As String())
- Args = New String() { _
- "-action=verify", "-src=/download/Music", "-dst=/download/test_dvd", _
- "-archive=MusArh", "-subdir=backup2dvd", "-eccsubdir=backup2dvd_ecc", _
- "-password=" & RARPassword, "-device=/dev/sr" & DevNumber, "-dvdred=high", "-speed=2", _
- "-maxvols=555", "-rarred= 7%", "-compratio=1", "-volsize=30m"} '22.5g
- Vars.DefineCLIParameters(Args, New String() { _
- "action", "src", "dst", "archive", "subdir", "eccsubdir", _
- "password", "device", "dvdred", "speed", "volsize", "maxvols", "rarred", "compratio"})
- Bash = New Aulix.Common7.Utils.AutoPenguin(Vars)
- Bash.OpenSSH("proxy", 22, "root", SSHPassword)
- 'Compress()
- Format()
- WriteToDevice("/download/test_dvd/iso/MusArh_2014_08_05__18_13_59.part1.rar.iso")
- Verify("/download/test_dvd/iso/MusArh_2014_08_05__18_13_59.part1.rar.iso")
- Bash.CloseSSH()
- End Sub
- Function Format() As Boolean
- Console.WriteLine("Going to format")
- Do While True
- Bash.Exec("dvd+rw-format -gui -force $device 2>&1")
- Dim TextResult = Bash.StdOutLines(1)
- Console.WriteLine(TextResult)
- If TextResult.Contains("detected") Then
- If Bash.Exec("dd if=/dev/zero count=128 of=$device") Then
- Console.WriteLine("Formated")
- Return True
- End If
- ElseIf TextResult.Contains("mounted media doesn't appear to be") Then
- Console.WriteLine("Formating not supported, skipping")
- Return False
- Else
- Console.WriteLine("Failed to format the device, trying once again in 3 seconds ... ")
- Bash.Exec("killall -s 9 dvd+rw-format wodim")
- Sleep(5)
- End If
- Loop
- End Function
- Public Function Verify(ByVal ISOFile)
- Vars("ISOFile") = ISOFile
- Do Until Bash.Exec("dd if=$device bs=2048 count=1")
- WriteLine("Failed to read, ensure a disk is inserted and the tray is closed, trying once again in 3 seconds ... ")
- Sleep(3)
- Loop
- Dim FileMD5 As String
- If Bash.Exec("md5sum $ISOFile | /utils/text/at_position.sh 1") Then
- FileMD5 = Bash.StdOutLines(0)
- End If
- Dim DeviceMD5 As String
- If Bash.Exec("ExtentAmount=$[ $(ls -l $ISOFile | awk '{ print $5 }') / 2048 ]; dd if=$Device bs=2048 count=$ExtentAmount | md5sum | /utils/text/at_position.sh 1") Then
- DeviceMD5 = Bash.StdOutLines(0)
- End If
- If FileMD5 = DeviceMD5 Then
- Console.WriteLine("SUCCESS! SUCCESS! SUCCESS!")
- Else
- Console.WriteLine("ERROR DURING VERIFICATION! CHECKSUMS ARE NOT EQUAL!!!")
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment