iLiberty+ Repo Plist Format

From version 1.3.0, iLiberty+ starts to use plist to manage the payloads, this makes its much more easier to update a payload whenever needed.

The repo plist is a standard Apple plist file, each dict item describes a payload, here’s the format:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>payloads</key>
        <array>
                <dict>
                        <key>Id</key>
                        <string>com.zjlotto.iLiberty.FlashBBTo040313</string>
                        <key>Name</key>
                        <string>Reflash baseband to version 04.03.13_G (BL3.9 only)</string>
                        <key>Author</key>
                        <string>George Zhu</string>
                        <key>Version</key>
                        <string>1.1</string>
                        <key>Script</key>
                        <string>http://iLiberty.zjlotto.com/Payloads2/01BL39BasebandTo040313.sh</string>
                        <key>Pack</key>
                        <string>http://iLiberty.zjlotto.com/Payloads2/BL39BasebandTo040313.zip</string>
                        <key>URL</key>
                        <string>http://george.insideiphone.com/</string>
                        <key>Desc</key>
                        <string>This payload reflashes baseband (from up to 04.04.05_G) to version 04.03.13_G. This payload requires bootloader 3.9.</string>
                </dict>
                <dict>
                    <key>Id</key>
                    <string>another.identifier</string>
                    <key>Name</key>
                    <string>another payload</string>
                    ....omitted...
                </dict>
                ...omitted...
        </array>
</dict>
</plist>

You may add multiple repo into iLiberty+, each repo occupies one line, they’ll be scanned one by one when you press the Refresh button. The default repo (if you don’t set any repo, the default one will appear) is:

http://iLiberty.zjlotto.com/repo.plist

The best way to maintain a repo plist is to use a script to generate it, this will salvage you from typos, etc. The following is my quick-and-dirty PHP script used to generate the official iLiberty+ repo plist file:

<?php
    /*****************************************
     *                                       *
     * Quick and dirty repo plist generator  *
     *                                       *
     * Created by George Zhu                 *
     * http://george.insideiphone.com/            *
     * April 2008                            *
     *                                       *
     * This script is best used in a crontab *
     * so it can be called periodically to   *
     * generate new plist.                   *
     *                                       *
     *****************************************/
 
    // Absolute path to the folder that contains
    // your repo plist file. Make sure the folder
    // is writable by the user who runs this script.
    $BASEDIR = "/path/to/your/plistfile/folder/";
 
    // Absolute path to the folder that contains all
    // your payloads
    $PAYLOADDIR = "/path/to/your/payloads/folder/";
 
    // File name of your repo plist
    $PLISTFILE = "repo.plist";
 
    /*****************************************************
     * You don't need to modify anything under this line *
     *****************************************************/
 
    function ParseAPayload($fileName,
                           &$plId,
                           &$plName,
                           &$plAuthor,
                           &$plVersion,
                           &$plScript,
                           &$plPack,
                           &$plURL,
                           &$plDesc)
    {
        $MAXLEN = 255;
 
        $plId = "";
        $plName = "";
        $plAuthor = "";
        $plVersion = "";
        $plScript = "";
        $plPack = "";
        $plDesc = "";
 
        $fp = fopen($fileName, "r");
        while (!feof($fp))
        {
            $line = trim(fgets($fp));
            if ($line == "" || $line[0] != '#')
            {
                if ($plId != "")
                    return;
                else
                    continue;
            }
            $line = trim(substr($line, 1, strlen($line) - 1));
            if (substr($line, 0, 3) == "Id:")
            {
                $plId = trim(substr($line, 3, strlen($line) - 3));
            }
            else if (substr($line, 0, 5) == "Name:")
            {
                $plName = trim(substr($line, 5, strlen($line) - 5));
            }
            else if (substr($line, 0, 7) == "Author:")
            {
                $plAuthor = trim(substr($line, 7, strlen($line) - 7));
            }
            else if (substr($line, 0, 8) == "Version:")
            {
                $plVersion = trim(substr($line, 8, strlen($line) - 8));
            }
            else if (substr($line, 0, 7) == "Script:")
            {
                $plScript = trim(substr($line, 7, strlen($line) - 7));
            }
            else if (substr($line, 0, 5) == "Pack:")
            {
                $plPack = trim(substr($line, 5, strlen($line) - 5));
            }
            else if (substr($line, 0, 4) == "URL:")
            {
                $plURL = trim(substr($line, 4, strlen($line) - 4));
            }
            else if (substr($line, 0, 5) == "Desc:")
            {
                $plDesc = trim(substr($line, 5, strlen($line) - 5));
                while (!feof($fp))
                {
                    $line = trim(fgets($fp));
                    if ($line == "" || $line[0] != '#')
                    {
                        break;
                    }
                    $line = trim(substr($line, 1, strlen($line) - 1));
                    if ($line == "")
                        break;
                    $plDesc .= " ".$line;
                }
            }
        }
        fclose($fp);
 
        if (strlen($plDesc) > $MAXLEN)
            $plDesc = substr($plDesc, 0, $MAXLEN);
    }
 
    function GetPayloadScripts($dirName, &$psList)
    {
        while (count($psList) > 0)
            unset($psList[0]);
 
        $dp = opendir($dirName);
        while (($file = readdir($dp)) != false)
        {
            if (filetype($dirName.$file) != "file")
                continue;
            if (substr($file, -3) != ".sh")
                continue;
            $psList[] = $dirName.$file;
        }
        closedir($dp);
    }
 
 
    /***************
     * ENTRY POINT *
     ***************/
 
    $MIDFILE = "midRepo.plist";
    $TEMPFILE = "tempRepo.plist";
 
    GetPayloadScripts($PAYLOADDIR, $PayloadList);
 
    $fp = fopen($BASEDIR.$TEMPFILE, "w");
    if (!$fp)
        return 1;
 
    // Write header
    $header = '<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" '.
              '"http://www.apple.com/DTDs/PropertyList-1.0.dtd">'."\n".
              '<plist version="1.0">'."\n".
              '<dict>'."\n".
              "\t<key>payloads</key>\n".
              "\t<array>\n";
    if (fwrite($fp, $header) != strlen($header))
    {
        fclose($fp);
        return 1;
    }
 
    // Write payload list
    for ($i=0; $i<count($PayloadList); ++$i)
    {
        ParseAPayload($PayloadList[$i],
                       $plId,
                       $plName,
                       $plAuthor,
                       $plVersion,
                       $plScript,
                       $plPack,
                       $plURL,
                       $plDesc);
 
        $payload = "\t\t<dict>\n" .
                   "\t\t\t<key>Id</key>\n" .
                   "\t\t\t<string>$plId</string>\n" .
                   "\t\t\t<key>Name</key>\n".
                   "\t\t\t<string>$plName</string>\n" .
                   "\t\t\t<key>Author</key>\n".
                   "\t\t\t<string>$plAuthor</string>\n" .
                   "\t\t\t<key>Version</key>\n".
                   "\t\t\t<string>$plVersion</string>\n" .
                   "\t\t\t<key>Script</key>\n".
                   "\t\t\t<string>$plScript</string>\n" .
                   "\t\t\t<key>Pack</key>\n".
                   "\t\t\t<string>$plPack</string>\n" .
                   "\t\t\t<key>URL</key>\n".
                   "\t\t\t<string>$plURL</string>\n" .
                   "\t\t\t<key>Desc</key>\n".
                   "\t\t\t<string>$plDesc</string>\n".
                   "\t\t</dict>\n";
        if (fwrite($fp, $payload) != strlen($payload))
        {
            fclose($fp);
            return 1;
        }
    }
 
    // Write footer
    $footer = "\t</array>\n".
              "</dict>\n".
              "</plist>\n";
    if (fwrite($fp, $footer) != strlen($footer))
    {
     fclose($fp);
     return 1;
    }
    fclose($fp);
 
    // Rename old repo file
    if (file_exists($BASEDIR.$PLISTFILE))
    {
        if (!rename($BASEDIR.$PLISTFILE, $BASEDIR.$MIDFILE))
            return 1;
    }
 
    // Rename new repo file
    if (!rename($BASEDIR.$TEMPFILE, $BASEDIR.$PLISTFILE))
    {
        // If can't rename new repo file, restore old file
        if (file_exists($BASEDIR.$MIDFILE))
            rename($BASEDIR.$MIDFILE, $BASEDIR.$PLISTFILE);
        return 1;
    }
 
    // Erase old repo file
    if (file_exists($BASEDIR.$MIDFILE))
        unlink($BASEDIR.$MIDFILE);
 
    // Output repo plist
    $contents = file_get_contents($BASEDIR.$PLISTFILE);
    print $contents;
?>

Related posts


One Comment

  1. M. Jaafer
    Posted May 31, 2008 at 3:25 am | Permalink

    dear friend
    I have 1.1.3 iphone, i have tried to install 1.1.4 through itunes, after installing i get the following msg ” the sim card inserted in this iphone does not appear to be supported”
    then i have downloaded the iliberty and tried to check activate, unlock, downgrade boxs, then i went to advanced tap-> local, press refresh, i got the following error
    “Error on: http://iLiberty.zjlotto.com/repo.plist (10013: )”
    note that the go for it button is disabled and there is a blinking “disconnected”. i am connected through wireless ADSL that time what should i do ?? thanks in advance

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*