Project

General

Profile

« Previous | Next » 

Revision b2a66231

Added by Ermal LUÇI about 15 years ago

Ticket #873. Call write_config() before including file to avoid loosing already done modifications. While here do some code cleanup and formating to make it more readble.

View differences:

etc/inc/pkg-utils.inc
101 101
 ******/
102 102
function is_package_installed($packagename) {
103 103
	$pkg = get_pkg_id($packagename);
104
	if($pkg == -1) return false;
104
	if($pkg == -1)
105
		return false;
105 106
	return true;
106 107
}
107 108

  
......
119 120
	if(is_array($config['installedpackages']['package'])) {
120 121
		$i = 0;
121 122
		foreach($config['installedpackages']['package'] as $pkg) {
122
			if($pkg['name'] == $pkg_name) return $i;
123
			if($pkg['name'] == $pkg_name)
124
				return $i;
123 125
			$i++;
124 126
		}
125 127
	}
......
137 139
 ******/
138 140
function get_pkg_info($pkgs = 'all', $info = 'all') {
139 141
	global $g;
142

  
140 143
	$freebsd_version = str_replace("\n", "", `uname -r | cut -d'-' -f1 | cut -d'.' -f1`);
141 144
	$freebsd_machine = str_replace("\n", "", `uname -m`);
142 145
	$params = array(
......
151 154

  
152 155
function get_pkg_sizes($pkgs = 'all') {
153 156
	global $g;
157

  
154 158
	$params = array("pkg" => $pkgs);
155 159
	$msg = new XML_RPC_Message('pfsense.get_pkg_sizes', array(php_value_to_xmlrpc($params)));
156 160
	$xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl'];
......
159 163
	if($resp and !$resp->faultCode()) {
160 164
		$raw_versions = $resp->value();
161 165
		return xmlrpc_value_to_php($raw_versions);
162
	} else {
163
		return array();
164 166
	}
167

  
168
	return array();
165 169
}
166 170

  
167 171
/*
......
170 174
 */
171 175
function resync_all_package_configs($show_message = false) {
172 176
	global $config, $restart_sync, $pkg_interface;
177

  
173 178
	$i = 0;
174 179
	log_error("Resyncing configuration for all packages.");
175 180
	if(!$config['installedpackages']['package'])
176 181
		return;
177 182
	if($show_message == true)
178 183
		echo "Syncing packages:";
179
	foreach($config['installedpackages']['package'] as $package) {
180
		if (empty($package['name']))
181
			continue;
182
		if($show_message == true) print " " . $package['name'];
183
		get_pkg_depends($package['name'], "all");
184
		stop_service($package['name']);
185
		sync_package($i, true, true);
186
		if($restart_sync == true) {
187
			$restart_sync = false;
188
			if($pkg_interface == "console") 
189
				echo "\nSyncing packages:";
184

  
185
	if (is_array($config['installedpackages']['package'])) {
186
		foreach($config['installedpackages']['package'] as $package) {
187
			if (empty($package['name']))
188
				continue;
189
			if($show_message == true)
190
				echo " " . $package['name'];
191
			get_pkg_depends($package['name'], "all");
192
			stop_service($package['name']);
193
			sync_package($i, true, true);
194
			if($restart_sync == true) {
195
				$restart_sync = false;
196
				if($pkg_interface == "console") 
197
					echo "\nSyncing packages:";
198
			}
199
			$i++;
190 200
		}
191
		$i++;
192 201
	}
193
	if($show_message == true) print ".\n";
202
	if($show_message == true)
203
		echo "done.\n";
194 204
	@unlink("/conf/needs_package_sync");
195 205
}
196 206

  
......
200 210
 */
201 211
function is_freebsd_pkg_installed($pkg) {
202 212
	global $g;
213

  
203 214
	if(in_array($pkg, return_dir_as_array("{$g['vardb_path']}/pkg")))
204 215
		return true;
205 216
	return false;
......
216 227
function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $return_nosync = 1) {
217 228
	global $config;
218 229
	require_once("notices.inc");
230

  
219 231
	$pkg_id = get_pkg_id($pkg_name);
220
	if(!is_numeric($pkg_name)) {
221
		if($pkg_id == -1) return -1; // This package doesn't really exist - exit the function.
222
	} else {
223
		if(!isset($config['installedpackages']['package'][$pkg_id])) return; // No package belongs to the pkg_id passed to this function.
224
	}
225
	$package = $config['installedpackages']['package'][$pkg_id];
232
	if($pkg_id == -1)
233
		return -1; // This package doesn't really exist - exit the function.
234
	else if (!isset($config['installedpackages']['package'][$pkg_id]))
235
		return; // No package belongs to the pkg_id passed to this function.
236

  
237
	$package =& $config['installedpackages']['package'][$pkg_id];
226 238
	if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) {
227 239
		log_error("The {$package['name']} package is missing required dependencies and must be reinstalled." . $package['configurationfile']);
228
		install_package($package['name']);
229 240
		uninstall_package_from_name($package['name']);
230 241
		install_package($package['name']);
231 242
		return;
232 243
	}
233 244
	$pkg_xml = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui");
234
	if($pkg_xml['additional_files_needed'] != "") {
245
	if (!empty($pkg_xml['additional_files_needed'])) {
235 246
		foreach($pkg_xml['additional_files_needed'] as $item) {
236
			if (($return_nosync == 0) && (isset($item['nosync']))) continue; // Do not return depends with nosync set if not required.
247
			if ($return_nosync == 0 && isset($item['nosync']))
248
				continue; // Do not return depends with nosync set if not required.
237 249
			$depend_file = substr(strrchr($item['item']['0'], '/'),1); // Strip URLs down to filenames.
238 250
			$depend_name = substr(substr($depend_file,0,strpos($depend_file,".")+1),0,-1); // Strip filename down to dependency name.
239
			if (($filetype != "all") && (!preg_match("/{$filetype}/i", $depend_file))) continue;
251
			if (($filetype != "all") && (!preg_match("/{$filetype}/i", $depend_file)))
252
					continue;
240 253
			if ($item['prefix'] != "") {
241 254
				$prefix = $item['prefix'];
242 255
			} else {
......
244 257
			}
245 258
			// Ensure that the prefix exists to avoid installation errors.
246 259
			if(!is_dir($prefix)) 
247
				exec("mkdir -p {$prefix}");
260
				exec("/bin/mkdir -p {$prefix}");
248 261
			if(!file_exists($prefix . $depend_file))
249 262
				log_error("The {$package['name']} package is missing required dependencies and must be reinstalled.");
250 263
			switch ($format) {
251
				case "files":
252
					$depends[] = $prefix . $depend_file;
253
					break;
254
				case "names":
255
					switch ($filetype) {
256
						case "all":
257
						if(preg_match("/\.xml/i", $depend_file)) {
258
							$depend_xml = parse_xml_config_pkg("/usr/local/pkg/" . $depend_file, "packagegui");
259
							$depends[] = $depend_xml['name'];
260
							break;
261
						} else {
262
							$depends[] = $depend_name; // If this dependency isn't package XML, use the stripped filename.
263
							break;
264
						}
265
						case ".xml":
266
							$depend_xml = parse_xml_config_pkg("/usr/local/pkg/" . $depend_file, "packagegui");
264
			case "files":
265
				$depends[] = $prefix . $depend_file;
266
				break;
267
			case "names":
268
				switch ($filetype) {
269
				case "all":
270
					if(preg_match("/\.xml/i", $depend_file)) {
271
						$depend_xml = parse_xml_config_pkg("/usr/local/pkg/{$depend_file}", "packagegui");
272
						if (!empty($depend_xml))
267 273
							$depends[] = $depend_xml['name'];
268
							break;
269
						default:
270
							$depends[] = $depend_name; // If we aren't looking for XML, use the stripped filename (it's all we have).
271
							break;
272
						}
273
					}
274
					} else
275
						$depends[] = $depend_name; // If this dependency isn't package XML, use the stripped filename.
276
					break;
277
				case ".xml":
278
					$depend_xml = parse_xml_config_pkg("/usr/local/pkg/" . $depend_file, "packagegui");
279
					if (!empty($depend_xml))
280
						$depends[] = $depend_xml['name'];
281
					break;
282
				default:
283
					$depends[] = $depend_name; // If we aren't looking for XML, use the stripped filename (it's all we have).
284
					break;
285
				}
274 286
			}
287
		}
275 288
		return $depends;
276 289
	}
277 290
}
278 291

  
279 292
function uninstall_package_from_name($pkg_name) {
280 293
	global $config;
294

  
281 295
	$id = get_pkg_id($pkg_name);
282 296
	if ($id >= 0) {
283 297
		$pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package'];
284
		delete_package($pkg_depends[0], $pkg_name);
285 298
		if (is_array($pkg_depends)) {
286 299
			foreach ($pkg_depends as $pkg_depend)
287
				remove_freebsd_package($pkg_depend);
300
				delete_package($pkg_depend, $id);
288 301
		}
289 302
	}
290 303
	delete_package_xml($pkg_name);
......
301 314
function sync_package($pkg_name, $sync_depends = true, $show_message = false) {
302 315
	global $config;
303 316
	require_once("notices.inc");
304
	if(!$config['installedpackages']['package']) return;
317
	
318
	if(empty($config['installedpackages']['package']))
319
		return;
305 320
	if(!is_numeric($pkg_name)) {
306 321
		$pkg_id = get_pkg_id($pkg_name);
307
		if($pkg_id == -1) return -1; // This package doesn't really exist - exit the function.
322
		if($pkg_id == -1)
323
			return -1; // This package doesn't really exist - exit the function.
308 324
	} else {
309 325
		$pkg_id = $pkg_name;
310
		if(!isset($config['installedpackages']['package'][$pkg_id]))
311
		return;  // No package belongs to the pkg_id passed to this function.
326
		if(empty($config['installedpackages']['package'][$pkg_id]))
327
			return;  // No package belongs to the pkg_id passed to this function.
312 328
	}
313 329
        if (is_array($config['installedpackages']['package'][$pkg_id]))
314
			$package = $config['installedpackages']['package'][$pkg_id];
330
		$package =& $config['installedpackages']['package'][$pkg_id];
315 331
        else
316
			return; /* empty package tag */
332
		return; /* empty package tag */
317 333
	if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) {
318 334
		log_error("The {$package['name']} package is missing its configuration file and must be reinstalled.");
319 335
		force_remove_package($package['name']);
......
328 344
			else {
329 345
				/* XXX: What the heck is this?! */
330 346
				log_error("Could not locate {$include_file}.");
331
				install_package($package['name']);
332 347
				uninstall_package_from_name($package['name']);
333 348
				install_package($package['name']);
334 349
			}
......
337 352
		/* XXX: Zend complains about the next line "Wrong break depth"
338 353
		 * The code is obviously wrong, but I'm not sure what it's supposed to do?
339 354
		 */
340
		if(isset($pkg_config['nosync'])) continue;
355
		if(isset($pkg_config['nosync']))
356
			continue;
341 357
		if(!empty($pkg_config['custom_php_global_functions']))
342 358
			eval($pkg_config['custom_php_global_functions']);
343 359
		if(!empty($pkg_config['custom_php_resync_config_command']))
......
349 365
					if(!file_exists($item)) {
350 366
						file_notice($package['name'], "The {$package['name']} package is missing required dependencies and must be reinstalled.", "Packages", "/pkg_mgr_install.php?mode=reinstallpkg&pkg={$package['name']}", 1);
351 367
						log_error("Could not find {$item}. Reinstalling package.");
352
						install_package($pkg_name);
353 368
						uninstall_package_from_name($pkg_name);
354 369
						install_package($pkg_name);
355 370
					} else {
356 371
						$item_config = parse_xml_config_pkg($item, "packagegui");
357
						if(isset($item_config['nosync'])) continue;
358
						if($item_config['custom_php_command_before_form'] <> "") {
372
						if (empty($item_config))
373
							continue;
374
						if(isset($item_config['nosync']))
375
							continue;
376
						if($item_config['custom_php_command_before_form'] <> "")
359 377
							eval($item_config['custom_php_command_before_form']);
360
						}
361
						if($item_config['custom_php_resync_config_command'] <> "") {
378
						if($item_config['custom_php_resync_config_command'] <> "")
362 379
							eval($item_config['custom_php_resync_config_command']);
363
						}
364
						if($show_message == true) print " " . $item_config['name'];
380
						if($show_message == true)
381
							print " " . $item_config['name'];
365 382
					}
366 383
				}
367 384
			}
......
375 392
 *
376 393
 * XXX: This function needs to return where a pkg_add fails. Our current error messages aren't very descriptive.
377 394
 */
378
function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = 'http://ftp2.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest') {
395
function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = 'http://ftp2.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/Latest') {
379 396
	global $pkgent, $static_output, $g, $fd_log;
397

  
380 398
	$pkg_extension = strrchr($filename, '.');
381 399
	$static_output .= "\n" . str_repeat(" ", $dependlevel * 2) . $pkgname . " ";
382
	$fetchto = "{$g['tmp_path']}/apkg_" . $pkgname . $pkg_extension;
383
	download_file_with_progress_bar($base_url . '/' . $filename, $fetchto);
400
	$fetchto = "{$g['tmp_path']}/apkg_{$pkgname}{$pkg_extension}";
401
	download_file_with_progress_bar("{$base_url}/{$filename}", $fetchto);
384 402
	$static_output .= " (extracting)";
385 403
	update_output_window($static_output);
386
		$slaveout = "";
404
	$slaveout = "";
387 405
	exec("/usr/bin/tar --fast-read -O -f {$fetchto} -x +CONTENTS 2>&1", $slaveout);
388 406
	$workingdir = preg_grep("/instmp/", $slaveout);
389 407
	$workingdir = $workingdir[0];
......
398 416
			if(is_freebsd_pkg_installed($working_depend[1]) === false) {
399 417
				pkg_fetch_recursive($working_depend[1], $depend_filename, $dependlevel + 1, $base_url);
400 418
			} else {
401
//				$dependlevel++;
419
				//$dependlevel++;
402 420
				$static_output .= "\n" . str_repeat(" ", $dependlevel * 2) . $working_depend[1] . " ";
403 421
				@fwrite($fd_log, $working_depend[1] . "\n");
404 422
			}
405 423
		}
406 424
	}
407 425
	$pkgaddout = "";
408
	exec("cat {$g['tmp_path']}/y | /usr/sbin/pkg_add -fv {$fetchto} 2>&1", $pkgaddout);
426
	exec("/bin/cat {$g['tmp_path']}/y | /usr/sbin/pkg_add -fv {$fetchto} 2>&1", $pkgaddout);
409 427
	@fwrite($fd_log, $pkgname . " " . print_r($pkgaddout, true) . "\n");
428

  
410 429
	return true;
411 430
}
412 431

  
413 432
function install_package($package, $pkg_info = "") {
414 433
	global $g, $config, $pkg_interface, $fd_log, $static_output, $pkg_interface, $restart_sync;
434

  
415 435
	/* safe side. Write config below will send to ro again. */
416 436
	conf_mount_rw();
417 437

  
......
424 444
		}
425 445
	}
426 446
	/* fetch package information if needed */
427
	if(!$pkg_info or !is_array($pkg_info[$package])) {
447
	if(empty($pkg_info) or !is_array($pkg_info[$package])) {
428 448
		$pkg_info = get_pkg_info(array($package));
429 449
		$pkg_info = $pkg_info[$package]; // We're only dealing with one package, so we can strip away the extra array.
430 450
	}
......
512 532

  
513 533
function install_package_xml($pkg) {
514 534
	global $g, $config, $fd_log, $static_output, $pkg_interface;
535

  
515 536
	if(($pkgid = get_pkg_id($pkg)) == -1) {
516 537
		$static_output .= "The {$pkg} package is not installed.\n\nInstallation aborted.";
517 538
		update_output_window($static_output);
......
521 542
		}
522 543
		sleep(1);
523 544
		return;
524
	} else {
545
	} else
525 546
		$pkg_info = $config['installedpackages']['package'][$pkgid];
526
	}
547

  
527 548
	/* set up logging if needed */
528 549
	if(!$fd_log) {
529 550
		if(!$fd_log = fopen("{$g['tmp_path']}/pkg_mgr_{$pkg}.log", "w")) {
......
559 580
		update_output_window($static_output);
560 581
		foreach((array) $pkg_info['depends_on_package'] as $pkgdep) {
561 582
			$pkg_name = substr(reverse_strrchr($pkgdep, "."), 0, -1);
562
			if(isset($pkg_info['skip_install_checks'])) {
583
			if(isset($pkg_info['skip_install_checks']))
563 584
				$pkg_installed = true;
564
			} else {
585
			else
565 586
				$pkg_installed = is_freebsd_pkg_installed($pkg_name);
566
			}
587

  
567 588
			if($pkg_installed == false)
568 589
				pkg_fetch_recursive($pkg_name, $pkgdep, 0, $pkg_info['depends_on_package_base_url']);
569 590
			$static_output = $static_orig . "done.\nChecking for successful package installation... ";
......
619 640
			update_output_window($static_output);
620 641
			foreach($pkg_config['additional_files_needed'] as $afn) {
621 642
				$filename = get_filename_from_url($afn['item'][0]);
622
				if($afn['chmod'] <> "") {
643
				if($afn['chmod'] <> "")
623 644
					$pkg_chmod = $afn['chmod'];
624
				} else {
645
				else
625 646
					$pkg_chmod = "";
626
				}
627
				if($afn['prefix'] <> "") {
647

  
648
				if($afn['prefix'] <> "")
628 649
					$prefix = $afn['prefix'];
629
				} else {
650
				else
630 651
					$prefix = "/usr/local/pkg/";
631
				}
652

  
632 653
				if(!is_dir($prefix)) 
633 654
					safe_mkdir($prefix);
634 655
 				$static_output .= $filename . " ";
......
740 761

  
741 762
function delete_package($pkg, $pkgid) {
742 763
	global $g, $config, $fd_log, $static_output;
764

  
743 765
	update_status("Removing package...");
744 766
	$static_output .= "Removing package... ";
745 767
	update_output_window($static_output);
746
	$pkgid = get_pkg_id($pkgid);
747
	$pkg_info = $config['installedpackages']['package'][$pkgid];
768
	if (!is_array($config['installedpackages']['package']))
769
		return;
748 770

  
749
	$configfile = $pkg_info['configurationfile'];
750
	if(empty($configfile)) 
771
	$pkg_info =& $config['installedpackages']['package'][$pkgid];
772
	if (empty($pkg_info))
773
		return;
774
	if (empty($pkg_info['configurationfile'])) 
751 775
		return;
752 776

  
753 777
	$static_output .= "\nStarting package deletion for {$pkg_info['name']}...\n";
......
756 780
		delete_package_recursive($pkg);
757 781
	$static_output .= "done.\n";
758 782
	update_output_window($static_output);
783

  
759 784
	return;
760 785
}
761 786

  
762 787
function delete_package_recursive($pkg) {
763 788
	global $config, $g;
789

  
764 790
	$fd = fopen("{$g['tmp_path']}/y", "w");
765 791
	for($line = 0; $line < 10; $line++) {
766 792
		fwrite($fd, "y\n");
......
782 808

  
783 809
function delete_package_xml($pkg) {
784 810
	global $g, $config, $fd_log, $static_output, $pkg_interface;
811

  
785 812
	conf_mount_rw();
786 813

  
787
	if(($pkgid = get_pkg_id($pkg)) == -1) {
814
	$pkgid = get_pkg_id($pkg);
815
	if ($pkgid == -1) {
788 816
		$static_output .= "The {$pkg} package is not installed.\n\nDeletion aborted.";
789 817
		update_output_window($static_output);
790 818
		if($pkg_interface <> "console") {
......
815 843
		$pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $packages[$pkgid]['configurationfile'], "packagegui");
816 844
		/* remove tab items */
817 845
		if(is_array($pkg_config['tabs'])) {
818
			$static_output .= "\tMenu items... ";
846
			$static_output .= "\tTabs items... ";
819 847
			update_output_window($static_output);
820 848
			if(is_array($pkg_config['tabs']['tab']) && is_array($tabs)) {
821 849
				foreach($pkg_config['tabs']['tab'] as $tab) {
822
					foreach($tabs as $key => $insttab)
823
						if($insttab['name'] == $tab['name'])
850
					foreach($tabs as $key => $insttab) {
851
						if($insttab['name'] == $tab['name']) {
824 852
							unset($tabs[$key]);
853
							break;
854
						}
855
					}
825 856
				}
826 857
			}
827 858
			$static_output .= "done.\n";
......
833 864
			update_output_window($static_output);
834 865
			if (is_array($pkg_config['menu']) && is_array($menus)) {
835 866
				foreach($pkg_config['menu'] as $menu) {
836
					foreach($menus as $key => $instmenu)
837
						if($instmenu['name'] == $menu['name'])
867
					foreach($menus as $key => $instmenu) {
868
						if($instmenu['name'] == $menu['name']) {
838 869
							unset($menus[$key]);
870
							break;
871
						}
872
					}
839 873
				}
840 874
			}
841 875
			$static_output .= "done.\n";
......
858 892
			$static_output .= "done.\n";
859 893
			update_output_window($static_output);
860 894
		}
861
		/*   if a require exists, include it.  this will
862
		 *   show us where an error exists in a package
863
		 *   instead of making us blindly guess
895
		/*
896
		 * XXX: Otherwise inclusion of config.inc again invalidates actions taken.
897
		 * 	Same is done during installation.
898
		 */
899
		write_config();
900

  
901
		/*
902
		 * If a require exists, include it.  this will
903
		 * show us where an error exists in a package
904
		 * instead of making us blindly guess
864 905
		 */
865 906
		if($pkg_config['include_file'] <> "") {
866 907
			$static_output = "Loading package instructions...";
......
879 920
		if(is_array($pkg_config['modify_system']['item'])) {
880 921
			$static_output .= "\tSystem files... ";
881 922
			update_output_window($static_output);
882
			foreach($pkg_config['modify_system']['item'] as $ms) {
923
			foreach($pkg_config['modify_system']['item'] as $ms)
883 924
				if($ms['textneeded']) remove_text_from_file($ms['modifyfilename'], $ms['textneeded']);
884
			}
925

  
885 926
			$static_output .= "done.\n";
886 927
			update_output_window($static_output);
887 928
		}
......
916 957
			update_output_window($static_output);
917 958
			foreach($pkg_config['additional_files_needed'] as $afn) {
918 959
				$filename = get_filename_from_url($afn['item'][0]);
919
				if($afn['prefix'] <> "") {
960
				if($afn['prefix'] <> "")
920 961
					$prefix = $afn['prefix'];
921
				} else {
962
				else
922 963
					$prefix = "/usr/local/pkg/";
923
				}
964

  
924 965
				unlink_if_exists($prefix . $filename);
925
				if(file_exists($prefix . $filename))
926
				    mwexec("rm -rf {$prefix}{$filename}");
927 966
			}
928 967
			$static_output .= "done.\n";
929 968
			update_output_window($static_output);
......
945 984
	write_config("Removed {$pkg} package.");
946 985
	/* file cleanup */
947 986
	$ctag = file("/etc/crontab");
948
	foreach($ctag as $line) {
949
		if(trim($line) != "") $towrite[] = $line;
950
	}
987
	foreach($ctag as $line)
988
		if(trim($line) != "")
989
			$towrite[] = $line;
990

  
951 991
	$tmptab = fopen("{$g['tmp_path']}/crontab", "w");
952
	foreach($towrite as $line) {
992
	foreach($towrite as $line)
953 993
		fwrite($tmptab, $line);
954
	}
955 994
	fclose($tmptab);
956 995

  
957 996
	// Go RW again since the write_config above will put it back to RO
usr/local/www/pkg_mgr_install.php
181 181
			$static_output = "";
182 182
			if($pkgtodo['name']) {
183 183
				update_output_window($static_output);
184
				delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id);
185
				delete_package_xml($pkgtodo['name']);
184
				uninstall_package_from_name($pkgtodo['name']);
186 185
				install_package($pkgtodo['name']);
187 186
				$pkg_id++;
188 187
			}

Also available in: Unified diff