sub PerformInstallation()
  'Unarchiving removes every file, including the pin,
  'so let's store it in memory and recreate the file later
  pin = GetScreenPin()

  package = CreateObject("roBrightPackage", "sd:/update.zip")
  package.Unpack("sd:/")
  DeleteFile("sd:/update.zip")

  if pin <> Invalid
    WriteAsciiFile("sd:/pin.txt", pin)
  end if
end sub

function GetScreenPin()
  files = MatchFiles("sd:/", "pin.txt")

  if files.Count() > 0
    return ReadAsciiFile("sd:/pin.txt").Trim()
  else
    player = CreateObject("roDeviceInfo")
    return player.GetDeviceUniqueId()
  end if

  return Invalid
end function
