Last active
December 27, 2015 15:39
-
-
Save prostosergik/7349106 to your computer and use it in GitHub Desktop.
Tool to download latest OpenWRT firmware for TPLink WR703N. Can be used to crezte local repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://downloads.openwrt.org/snapshots/trunk/ar71xx/'; | |
$local_dir = dirname(__FILE__).'/'.date('Y-m-d').'/'; | |
$local_dir_packages = $local_dir.'packages/'; | |
if(!is_dir($local_dir) || !is_dir($local_dir_packages)) { | |
mkdir($local_dir); | |
mkdir($local_dir_packages); | |
} | |
echo "Downloading Firmwares...\n"; | |
$firmw = array( | |
'openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin', | |
'openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin' | |
); | |
foreach ($firmw as $file) { | |
echo "\t".$file."..."; | |
file_put_contents($local_dir.$file, file_get_contents($url.$file)); | |
echo " done.\n"; | |
} | |
echo "Downloading Packages List..."; | |
file_put_contents($local_dir_packages.'Packages', file_get_contents($url.'packages/Packages')); | |
file_put_contents($local_dir_packages.'Packages.gz', file_get_contents($url.'packages/Packages.gz')); | |
echo " done.\n\n"; | |
$Packages = file($local_dir_packages.'Packages'); | |
foreach($Packages as $line) { | |
// echo $line | |
if(preg_match('/^Filename\:\s(.*\.ipk)$/', $line, $matches)) { | |
echo "Downloading ".$matches[1]."..."; | |
file_put_contents($local_dir_packages.$matches[1], file_get_contents($url.'packages/'.$matches[1])); | |
echo " done.\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment