sany_ok

Untitled

Aug 5th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Sub Main(ByVal Args As String())
  2.         Args = New String() { _
  3.             "-action=verify", "-src=/download/Music", "-dst=/download/test_dvd", _
  4.             "-archive=MusArh", "-subdir=backup2dvd", "-eccsubdir=backup2dvd_ecc", _
  5.              "-password=" & RARPassword, "-device=/dev/sr" & DevNumber, "-dvdred=high", "-speed=2", _
  6.             "-maxvols=555", "-rarred= 7%", "-compratio=1", "-volsize=30m"} '22.5g
  7.  
  8.         Vars.DefineCLIParameters(Args, New String() { _
  9.             "action", "src", "dst", "archive", "subdir", "eccsubdir", _
  10.             "password", "device", "dvdred", "speed", "volsize", "maxvols", "rarred", "compratio"})
  11.  
  12.         Bash = New Aulix.Common7.Utils.AutoPenguin(Vars)
  13.         Bash.OpenSSH("proxy", 22, "root", SSHPassword)
  14.  
  15.         'Compress()
  16.  
  17.         Format()
  18.         WriteToDevice("/download/test_dvd/iso/MusArh_2014_08_05__18_13_59.part1.rar.iso")
  19.         Verify("/download/test_dvd/iso/MusArh_2014_08_05__18_13_59.part1.rar.iso")
  20.  
  21.         Bash.CloseSSH()
  22.     End Sub
  23.  
  24.  
  25.     Function Format() As Boolean
  26.         Console.WriteLine("Going to format")
  27.         Do While True
  28.             Bash.Exec("dvd+rw-format -gui -force $device 2>&1")
  29.             Dim TextResult = Bash.StdOutLines(1)
  30.             Console.WriteLine(TextResult)
  31.             If TextResult.Contains("detected") Then
  32.                 If Bash.Exec("dd if=/dev/zero count=128 of=$device") Then
  33.                     Console.WriteLine("Formated")
  34.                     Return True
  35.                 End If
  36.             ElseIf TextResult.Contains("mounted media doesn't appear to be") Then
  37.                 Console.WriteLine("Formating not supported, skipping")
  38.                 Return False
  39.             Else
  40.                 Console.WriteLine("Failed to format the device, trying once again in 3 seconds ... ")
  41.                 Bash.Exec("killall -s 9 dvd+rw-format wodim")
  42.                 Sleep(5)
  43.             End If
  44.         Loop
  45.     End Function
  46.  
  47.  
  48.     Public Function Verify(ByVal ISOFile)
  49.         Vars("ISOFile") = ISOFile
  50.  
  51.         Do Until Bash.Exec("dd if=$device bs=2048 count=1")
  52.             WriteLine("Failed to read, ensure a disk is inserted and the tray is closed, trying once again in 3 seconds ... ")
  53.             Sleep(3)
  54.         Loop
  55.  
  56.         Dim FileMD5 As String
  57.         If Bash.Exec("md5sum $ISOFile | /utils/text/at_position.sh 1") Then
  58.             FileMD5 = Bash.StdOutLines(0)
  59.         End If
  60.  
  61.         Dim DeviceMD5 As String
  62.         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
  63.             DeviceMD5 = Bash.StdOutLines(0)
  64.         End If
  65.  
  66.         If FileMD5 = DeviceMD5 Then
  67.             Console.WriteLine("SUCCESS! SUCCESS! SUCCESS!")
  68.         Else
  69.             Console.WriteLine("ERROR DURING VERIFICATION! CHECKSUMS ARE NOT EQUAL!!!")
  70.         End If
  71.     End Function
Advertisement
Add Comment
Please, Sign In to add comment