View Single Post
  #8   (View Single Post)  
Old 10th March 2013
classicmanpro's Avatar
classicmanpro classicmanpro is offline
Real Name: Turea Alexandru Teodor
Fdisk Soldier
 
Join Date: Oct 2010
Location: Sinaia, Romania
Posts: 51
Lightbulb

I've encountered this issue during system-wide updates and found out that there are two branches of PHP available, thus I had to manually specify which package needs to be updated.

Also, when I encountered version conflicts, I found out that the best way to deal with them is by dropping out of X, into the good old terminal and run:

Code:
/usr/pkg/sbin/pkg_add -uu MyPackage
Last but not least, take a look at PKGDEPGRAPH(1).

Supposing you have PHP installed, here is a PHP script which creates a "raw" update script needed for a fail-safe system-wide update. It prepares an update which starts from the core dependencies (the most depended upon, like PERL) and works its way out to the leafs (those without dependencies, like TCSH).

After it generates the update sequence, YOU NEED TO REVIEW IT "LINE BY LINE" ... REMEMBER ... ALWAYS DOUBLE CHECK. Here is the script:

PHP Code:
#!/usr/bin/env php
<?php

/* *** PKGDEPGRAPH(1) *** */

ob_start();
$sysValue system'pkgdepgraph -o' $sysCode );
$strList ob_get_contents();
ob_end_clean();

if ( 
$sysValue === FALSE || $sysCode ) { exit; }

/* *** TMP Directory *** */

$tmp '/var/tmp/' time();

$sysValue system"mkdirhier {$tmp}$sysCode );
if ( 
$sysValue === FALSE || $sysCode ) { exit; }

/* *** LIST Processing *** */

$arrList explode"\n" $strList );

$dbList = array();

foreach ( 
$arrList as $key => $value ) {
    if ( !empty( 
$value ) && preg_match'/label="\((\d+)\)\s(.+)"/' $value $matches ) ) {
        
$order   $matches[1];
        
$package $matches[2];
        if ( !
array_key_exists$order $dbList ) ) { $dbList[$order] = array(); }
        
$dbList[$order][] = $package;
    }
}

@
file_put_contents"{$tmp}/packages.lst" $strList );
@
file_put_contents"{$tmp}/array.1.lst"  print_r$dbList TRUE ) );

krsort$dbList );

@
file_put_contents"{$tmp}/array.2.lst"  print_r$dbList TRUE ) );

$sequence "#!/bin/sh\n";

foreach ( 
$dbList as $arrLevel ) {
    foreach ( 
$arrLevel as $package ) {
        
$sequence .= "/usr/pkg/sbin/pkg_add -uu {$package}\n";
    }
}

@
file_put_contents"{$tmp}/sequence.sh" $sequence );
system"chmod 0755 {$tmp}/sequence.sh" );

?>
__________________
A daemon in need is a daemon indeed.

Last edited by classicmanpro; 10th March 2013 at 11:22 AM. Reason: Grammar.
Reply With Quote