mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-26 10:28:58 +00:00
Better match user expectations by allowing to download plain disk images and configure the IP settings afterwards on the target machine - then most likely leveraging DHCP. This works for the users with the most usual Ethernet adapter and settings - which are now pre-configured in default.cfg's. Only the few users with non-default Ethernet adapter and/or settings are required to download a custom contiki.cfg and inject it manually into their disk image files.
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
error_reporting(0);
|
|
|
|
$cfg = chr($_GET['addr-a']).chr($_GET['addr-b']).chr($_GET['addr-c']).chr($_GET['addr-d']);
|
|
$cfg .= chr($_GET['mask-a']).chr($_GET['mask-b']).chr($_GET['mask-c']).chr($_GET['mask-d']);
|
|
$cfg .= chr($_GET['dgw-a']). chr($_GET['dgw-b']). chr($_GET['dgw-c']). chr($_GET['dgw-d']);
|
|
$cfg .= chr($_GET['dns-a']). chr($_GET['dns-b']). chr($_GET['dns-c']). chr($_GET['dns-d']);
|
|
|
|
switch ($_GET['machine']) {
|
|
case 'apple2':
|
|
$hex = $_GET['apple2-addr'];
|
|
$drv = $_GET['apple2-drv'];
|
|
break;
|
|
case 'c64':
|
|
$hex = strtok($_GET['c64-addr-drv'], '-');
|
|
$drv = strtok('-');
|
|
break;
|
|
case 'c128':
|
|
$hex = strtok($_GET['c128-addr-drv'], '-');
|
|
$drv = strtok('-');
|
|
break;
|
|
case 'atari':
|
|
$hex = strtok($_GET['atari-addr-drv'], '-');
|
|
$drv = strtok('-');
|
|
break;
|
|
}
|
|
|
|
$addr = hexdec($hex);
|
|
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
|
$cfg .= $drv;
|
|
|
|
header('Content-Type: application/octetstream');
|
|
header('Content-Disposition: attachment; filename=contiki.cfg');
|
|
print($cfg);
|
|
|
|
?>
|