diff options
author | Manuel Hiebel <leuhmanu@mageia.org> | 2022-11-11 21:50:41 +0100 |
---|---|---|
committer | Manuel Hiebel <leuhmanu@mageia.org> | 2022-11-11 21:50:41 +0100 |
commit | a7b482ebad9b36ce8fa48fd18288868a29ed9521 (patch) | |
tree | f360416ba8f0183d44d9a641c5fdd0288573f934 /lib | |
parent | 4eada4dec308ebea1a5c17839e5cf3f73ca78f32 (diff) | |
download | fidd-a7b482ebad9b36ce8fa48fd18288868a29ed9521.tar fidd-a7b482ebad9b36ce8fa48fd18288868a29ed9521.tar.gz fidd-a7b482ebad9b36ce8fa48fd18288868a29ed9521.tar.bz2 fidd-a7b482ebad9b36ce8fa48fd18288868a29ed9521.tar.xz fidd-a7b482ebad9b36ce8fa48fd18288868a29ed9521.zip |
Diffstat (limited to 'lib')
-rw-r--r-- | lib/FIDD.php | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/FIDD.php b/lib/FIDD.php index 655c5e1..6add12a 100644 --- a/lib/FIDD.php +++ b/lib/FIDD.php @@ -23,7 +23,7 @@ class FIDD * * @return boolean */ - public static function run($app_path, $url, $prefix, $netinstall = false) + public static function run($app_path, $url, $prefix, $netinstall = false, $netinstall_rename = '') { $tmp_path = $app_path . '/var/tmp'; @@ -38,7 +38,7 @@ class FIDD if (!$netinstall) { $info = self::build_definitions($prefix, $tmp_path, $filesizes); } else { - $info = self::build_definitions_net_install($prefix, $tmp_path, $filesizes); + $info = self::build_definitions_net_install($prefix, $tmp_path, $filesizes, $netinstall_rename); } self::save_definitions($info, $app_path . '/var/definitions'); @@ -215,7 +215,7 @@ class FIDD * * @return array */ - function build_definitions_net_install($prefix, $dir, $filesizes) + function build_definitions_net_install($prefix, $dir, $filesizes, $netinstall_rename) { $info = array(); $isos = glob($dir . '/*/install/images/'); @@ -243,13 +243,25 @@ class FIDD if ( count($data) == 0) { // skip the first one } else if (null !== ($ret = self::is_correct_name($data['file']))) { - $data['path'] = sprintf('%s/%s/install/images', - $ret['release'] == '' ? sprintf('distrib/%s', $ret['version']) : sprintf('distrib/cauldron%s', $prefix), - $ret['arch'] - ); - $data['name'] = str_replace(array('-', '.iso', 'i586', 'x86_64'), array(' ', '', '32bit', '64bit'), $data['file']); - $data['size'] = $filesizes[$data['file']]; - $info[$data['file']] = $data; + if ($ret['version'] == 'Cauldron') + { + $rename = str_replace('Cauldron', $netinstall_rename, $data['file']); + $data['path'] = sprintf('%s/%s/install/images', + sprintf('distrib/cauldron%s', $prefix), + $ret['arch'] + ); + $data['name'] = str_replace(array('-', '.iso', 'i586', 'x86_64'), array(' ', '', '32bit', '64bit'), $rename); + $data['size'] = $filesizes[$data['file']]; + $info[$rename] = $data; + } else { + $data['path'] = sprintf('%s/%s/install/images', + $ret['release'] == '' ? sprintf('distrib/%s', $ret['version']) : sprintf('distrib/cauldron%s', $prefix), + $ret['arch'] + ); + $data['name'] = str_replace(array('-', '.iso', 'i586', 'x86_64'), array(' ', '', '32bit', '64bit'), $data['file']); + $data['size'] = $filesizes[$data['file']]; + $info[$data['file']] = $data; + } } else { $info['invalid'][] = $data; } @@ -284,7 +296,7 @@ class FIDD */ public static function is_correct_name($s) { - $re = '/^(Mageia)-(\d+(.\d)?)(-(alpha|beta|RC|rc)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BR))?(-(build\_\w+))?\.(.*)$/'; + $re = '/^(Mageia)-(\d+(.\d)?|Cauldron)(-(alpha|beta|RC|rc)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BR))?(-(build\_\w+))?\.(.*)$/'; if (preg_match($re, $s, $arr)) { $ret = array( 'name' => $arr[1], |