Menu

Patch Provider Definition

PHPdev32

About

MaciASL can fetch patches from a number of online repositories, to be added by the user. Any web hosting service or product which allows arbitrary filenames can host a repository, examples are SourceForge's webspace, GitHub, and Joomla.

Repositories

A MaciASL repository contains two parts, a manifest file named ".maciasl", and any number of plain-text patch files in the same directory as .maciasl, or its sub-directories. A repository entry in MaciASL is composed of two parts, the name (given by the builder, but can be changed by the user), and the URL (excluding the /.maciasl at the end).

Adding a Repository

Adding a repository to MaciASL is as easy as adding the repository's URL and name to Preferences > Sources, using the "+" button.

Guidelines

  • Repository URLs should be short and descriptive, contain no special characters, or uppercase letters to make it easier for users.
  • Repository names should also be short and descriptive, but users are not required to enter them exactly, and may be entirely customized if the user wishes.
  • Patch names should also be short, but can use any character besides tab and return/enter/newline.
  • Patches should begin with a "Maintainer" comment (see below), with the repository builder's name/username, and the name of the organization or repository.
  • If the patch name does not provide enough description, a second comment could provide instructions or a longer explanation of the patch.

Source Provider Definition

~~~~~~~~~~~~~~~~
Source Provider Definition
Source = {name:<user-defined name="">, url:<url without="" trailing="" slash="">}
URLs are automatically composed <url>/.maciasl, where .maciasl is the manifest
A manifest file is a simple list of patch metadata, one patch per line
Lines are composed like <name>\t<type>\t<url> and separated by newlines (\n)
The only illegal field characters are tab (\t) and newline (\n)
Type is one of DSDT or SSDT, but if absent defaults to DSDT for compatibility
New fields may be added in the future, but <url> will always be last
Patch URLs will automatically be composed like /<patch URL="">
It is recommended that patches start with a comment of the form:
#Maintained by: <name> for: <site>
~~~~~~~~~~

File-Based Example

.maciasl

Replace Names   DSDT    rename.txt
Insert DTGP DSDT    dtgp.txt
HD4k GFX    DSDT    gfx0.txt
HD4k HDMI   DSDT    hdmi.txt
Insert SMBus    DSDT    sbus.txt
Name to String  DSDT    name.txt
Generic SSDT    SSDT    ssdt.txt
800MHz SSDT SSDT    800mhz.txt

dtgp.txt

#Maintained by: PHPdev32 for: Sourceforge
into definitionblock code_regex . insert
begin
Method (DTGP, 5, NotSerialized)\n
{\n
    If (LEqual (Arg0, Buffer (0x10)\n
            {\n
                /* 0000 */    0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44, \n
                /* 0008 */    0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B\n
            }))\n
    {\n
        If (LEqual (Arg1, One))\n
        {\n
            If (LEqual (Arg2, Zero))\n
            {\n
                Store (Buffer (One)\n
                    {\n
                        0x03\n
                    }, Arg4)\n
                Return (One)\n
            }\n
            If (LEqual (Arg2, One))\n
            {\n
                Return (One)\n
            }\n
        }\n
    }\n
    Store (Buffer (One)\n
        {\n
            0x00\n
        }, Arg4)\n
    Return (Zero)\n
}
end

Database-Backed Example

Note: Since this method requires a separately-developed data model and can be very complex, a simpler generated repository could be maintained using [Script Generated Repository]

.htaccess

RewriteEngine On
RewriteRule ^(.*) index.php?file=$1 [L,QSA]

index.php

<?php
if (!($file=$_GET['file']) || strpos($file,'/')!==false) die;
if ($file=='.maciasl') {
//Print manifest
if(!($handle=mysqli_connect('host','user','password','database'))) die;
$query=mysqli_query($handle,'select name,type,id from patches where active is true');
$patches=array();
while($row=mysqli_fetch_assoc($query))
    $patches[]="$row[name]\t$row[type]\t$row[id].txt";
echo implode("\n",$patches);
mysqli_free_result($query);
mysqli_close($handle);
}
elseif (strrchr($file,'.')=='.txt') {
//Print file
if(!($handle=mysqli_connect('host','user','password','database'))) die;
$id=mysqli_real_escape_string($handle,substr($file,0,strlen($file)-4));
$query=mysqli_query($handle,"select data from table patches where id='$id' limit 1");
if($row=mysqli_fetch_assoc($query))
    echo $row['data'];
mysqli_free_result($query);
mysqli_close($handle);
}
~~~~~~

Guard Page Example
------
index.html
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> MaciASL Repo <script type="text/javascript"> window.addEventListener('load',function(){ var repo={'name':'SourceForge','url':'http://maciasl.sourceforge.net'}; repo.name=' "'+repo.name+'"'; repo.url=' "'+repo.url+'"'; document.title += repo.name; document.getElementsByTagName('h1')[0].textContent += repo.name; document.getElementsByTagName('li')[4].textContent += repo.name; document.getElementsByTagName('li')[5].textContent += repo.url; }); </script> <style type="text/css"> * {margin:0;padding:0} html {background:#AAA} body {width:910px;background:#FFF;margin:0 auto;padding:0 10px;font-family:Verdana;padding-bottom:20px} ol{list-style-position:inside} h1{font-size:3em;padding:10px 0} h2{padding:20px 0} ol{background:url('http://i.imgur.com/qL0tEG3.png') #000;width:909px;height:288px;padding-top:250px} li{color:white;margin-left:20px;width:350px} </style> </head> <body>

MaciASL Repo

Whoops, wrong app!

It looks like you're trying to use this URL in a browser, why not try it in MaciASL instead?

Steps to Add This Repository

  1. Open MaciASL
  2. Click MaciASL, then Preferences
  3. Click Sources
  4. Click the "+" (plus) button
  5. Type in the repo name
  6. Type in the repo URL
  7. Close the Preferences window
</body> </html> ~~~~~~

Related

Wiki: Home
Wiki: Script Generated Repository