Results 1 to 8 of 8

Thread: Howto update ports FreeBSD

  1. #1
    Senior Member raj's Avatar
    Join Date
    Jun 2005
    Location
    Hyderabad
    Posts
    565
    Thanks
    57
    Thanked 40 Times in 37 Posts
    Rep Power
    13

    Default Howto update ports FreeBSD

    I'm running FreeBSD 7 64 bit on AMD server. How do I upgrade all ports installed under /usr/ports?
    Raj
    Linux rulz.
    I have never turned back in my life ; I shall not do so today.. haha

  2. #2
    Contributors amitabh's Avatar
    Join Date
    Jul 2008
    Location
    New Delhi
    Posts
    123
    Thanks
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    8

    Default

    For the first time, you can use:
    portsnap fetch && portsnap extract

    From the next time u can use:
    portsnap update

  3. #3
    Is that all you got? rockdalinux's Avatar
    Join Date
    May 2005
    Location
    Planet Vegeta
    Posts
    987
    Thanks
    27
    Thanked 71 Times in 62 Posts
    Rep Power
    19

    Default

    Quote Originally Posted by amitabh View Post
    For the first time, you can use:
    portsnap fetch && portsnap extract

    From the next time u can use:
    portsnap update
    I think it should be as follows:
    Code:
    portsnap fetch update
    pkgdb -F
    portsdb -Uu
    portupgrade -a
    portupgrade can be done for specific package:
    Code:
    portupgrade package-name
    To see list of all outdate ports
    Code:
    portversion -l '<'
    man page is your friend
    Rocky Jr.
    What's wrong? I hope I am not making you uncomfortable...

    Never send a boy to do a mans job.

  4. #4
    Contributors amitabh's Avatar
    Join Date
    Jul 2008
    Location
    New Delhi
    Posts
    123
    Thanks
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    8

    Default

    oops, did not read the entire question. rockdalinux has given the correct answer.

  5. #5
    Senior Member raj's Avatar
    Join Date
    Jun 2005
    Location
    Hyderabad
    Posts
    565
    Thanks
    57
    Thanked 40 Times in 37 Posts
    Rep Power
    13

    Default

    thanks, worked liked a charm. I just thown away some rep for both of you. Oh there will be more question as I'm noob.

    cheers
    Raj
    Linux rulz.
    I have never turned back in my life ; I shall not do so today.. haha

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Quote Originally Posted by rockdalinux View Post
    I think it should be as follows:
    Code:
    portsnap fetch update
    pkgdb -F
    portsdb -Uu
    portupgrade -a
    portupgrade can be done for specific package:
    Code:
    portupgrade package-name
    To see list of all outdate ports
    Code:
    portversion -l '<'
    man page is your friend
    Actually it must be done (in PC-BSD 8.0):

    Code:
    portsnap fetch extract update
    pkgdb -F
    portsdb -Uu
    portupgrade -a

  7. #7
    Junior Member
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    There are 2 basic ways to install software on BSD systems, like FreeBSD or PC-BSD 8.0:

    1) Installing binaries. This is the easiest for noobs and people who comes from windows or MAC:

    Code:
    # pkg_add -r -v program-name
    2) Compiling the program and installing it. The source code is in /usr/ports/ folder:

    Code:
    # cd /usr/ports/program-type/program-name
    # make
    # make install
    # make clean
    The option 'make clean' is optional if you want to delete the compiled binaries and libraries from the /usr/ports/program-type/program-name folder. It does not mean that the program is uninstalled from your computer.

  8. #8
    Junior Member
    Join Date
    Dec 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    portupgrade:

    port upgrade:

    Code:
    man portupgrade
    Code:
    portupgrade -f
    Code:
    portupgrade -fRr
    (force portupgrade)

    -N - new port

    =============

    all ports upgrade:
    1)

    Code:
    cd /usr/ports/sysutils/portupgrade && make && make install && make clean
    Code:
    pkgdb -aF
    or
    Code:
    pkgdb -fu
    2)
    Code:
    portupgrade -arRf
    2,a) or

    Code:
    #!/usr/bin/perl
    
    $nn = 0;
    
    while (1) {
    
        $nn++;
    
        open( OPERN, "portversion |" );
    
        @all = <OPERN>;
    
        if ( $nn > 6 ) {
        print "while 6 exit";
        exit;
        }
    
        foreach (@all) {
    
            my ( $pp, $st ) = split( / /, $_, 2 );
    
            if ( $st =~ '<' ) {
    
                print "UPDATE: $pp\n";
    
                system("portupgrade -f $pp");  
    
    
            } else {
                print "ok UPDATE";
                exit;
            }
        }
    
    }
    2,b) or SUPER SCRIPT:
    (Recommended)
    Code:
    #!/usr/bin/perl
    
    $nn = 0;
    
    while (1) {
    
        $nn++;
    
        open( OPERN, "portversion |" );
    
        my @all2 = <OPERN>;
    
        close OPERN;
    
        my @all;
    
        for ( $i = 0 ; $i < @all2 ; $i++ ) {
    
            my ( $pp, $st ) = split( / /, $all2[$i], 2 );
            if ( $st =~ '<' ) {
    
                push @all, $pp;    # $all[$i] = $pp;
    
            }
    
        }
    
        exit if ( !$all[0] || $nn > 2 );
    
        while (1) {
    
            last if !$all[0];
    
            print "$all[0]\n";
    
            logsave( get_time(), $all[0] );
    
            system("portupgrade -rf $all[0]");  
          # system("portupgrade -Rf $all[0]");
    
          # First port to try to update the length and breadth
          # (Above the system need to comment)
    
          # if ($nn == 1) {
          #  system("portupgrade -rRf $all[0]");
          #  } else {
          #  system("portupgrade -rf $all[0]");
          #  }
       # Experimental:
       # You can add a script to automatically pressed the Enter or (portupgrade -y)
       #    use IO::Select;  
       #     my $select = IO::Select->new;
       #    for(@array) 
       #     open my $pipe, "|$_";
       #     $select->add($pipe);
       #    }
       #    my @waiters = $select->can_write($timeout);
       #    print $_ "\x0a" for @waiters; 
    
    
            logsave( get_time(), $all[0] );
    
            shift @all;
    
            my @all = old(@all);
    
        }
    
    }
    
    sub old {
    
        my @all = @_;
    
        open( OPEN2, "portversion |" );
    
        my @all_all = <OPEN2>;
    
        close OPEN2;
    
        my @old;
        my @no_old;
    
        foreach my $p (@all_all) {
    
            my ( $pname, $status ) = split( / /, $p, 2 );
    
            if ( $status =~ '<' ) {
    
                push @old, $pname;
    
            }
            else {
                push @no_old, $pname;
            }
        }
    
        my %seen;
        @seen{@all} = ();
        delete @seen{@no_old};
        return keys %seen;
    
    }
    
    sub get_time {
        my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
          localtime(time);
        $mon++;
        $year += 1900;
        if ( $mday < 10 ) { $mday = "0$mday"; }
        if ( $mon < 10 )  { $mon  = "0$mon"; }
        if ( $min < 10 )  { $min  = "0$min"; }
        my $date        = "$mday $mon $year";
        my $time        = "$hour:$min:$sec";
        my $cur_all_day = $mday + $mon * 30 + $year * 365;
        my $radate      = "$year-$mon-$mday $hour:$min:$sec";
        return $radate;
    }
    
    
    sub logsave {
        my ( $time, $ports ) = @_;
        my $logfile;
        $logfile = "\n time:  $time \n  ports: $ports \n\n";
        system("touch /var/log/portupgrade.log");
        open( DB2, "/var/log/portupgrade.log" ) || die "Cannot open file: $!";
        my @base = <DB2>;
        close(DB2);
        open( DB, ">/var/log/portupgrade.log" ) || die "Cannot open file : $!";
        print DB @base;
        print DB $logfile;
        close(DB);
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. howto freebsd ssh keys
    By in forum All about FreeBSD/OpenBSD/NetBSD
    Replies: 2
    Last Post: 3rd April 2011, 08:51 PM
  2. How to update antivirus database in FreeBSD
    By enochalbert in forum All about FreeBSD/OpenBSD/NetBSD
    Replies: 1
    Last Post: 15th August 2008, 12:57 PM
  3. howto update inittab
    By amsreeku in forum Linux software
    Replies: 2
    Last Post: 2nd September 2007, 07:36 PM
  4. Open Mail Ports
    By B!n@ry in forum Linux software
    Replies: 31
    Last Post: 29th December 2006, 02:19 AM
  5. Howto boot freebsd single user mode
    By raj in forum All about FreeBSD/OpenBSD/NetBSD
    Replies: 1
    Last Post: 12th December 2006, 02:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •