Marius van Witzenburg We fight for our survival, we fight!

26Sep/110

How to easy CVS update your SRC and Ports tree with a simple Bash script (v2)

Posted by mariusvw

This is an update to this post: How to easy CVS update your SRC and Ports tree with a simple Bash script

I adjusted the script to use the local csup version of the FreeBSD World system and moved the cvsup files to /etc.

First install a simple tool to get the fastest cvs server

pkg_add -r fastest_cvsup

Or from Ports (if you have the collection already):

cd /usr/ports/sysutils/fastest_cvsup/
make install clean

Setup config and binary to easy update the repository for SRC and PORTS.

mkdir /etc/cvsup
cd /usr/share/examples/cvsup
cp stable-supfile /etc/cvsup
cp ports-supfile /etc/cvsup
cp doc-supfile /etc/cvsup
cd /etc/cvsup

Edit stable-supfile and change:

*default release=cvs tag=RELENG_8_2

Set this to your release version.

Edit /usr/local/sbin/runcvsup and add:

#!/bin/sh
arg=$@
sType="tld,nl" # Can be: all / tld / tld,nl,de,fr,us
if SERVER=`/usr/local/bin/fastest_cvsup -q -c $sType`; then
    echo "Using server: ${SERVER}"
    case "$arg" in
    "stable")
        echo "Updating: stable"
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/stable-supfile
    ;;
    "ports")
        echo "Updating: ports"
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/ports-supfile
    ;;
    "doc")  
        echo "Updating: doc"
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/doc-supfile
    ;;
    *)
        echo "Updating: all"
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/stable-supfile
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/ports-supfile
        /usr/bin/csup -L 2 -g -z -h ${SERVER} /etc/cvsup/doc-supfile
    ;;
    esac    
fi

Set the right permissions:

chmod 700 /usr/local/sbin/runcvsup

Update everything:

runcvsup
10Jul/110

How to configure mergemaster to merge configurations on FreeBSD

Posted by mariusvw

Ignore files for upgrade, for example you could add /etc/motd here.

Simply edit the file /etc/mergemaster.rc and add the following line:

IGNORE_FILES='/etc/motd'

Another example:

# Automatically install files that do not exist on the system already
AUTO_INSTALL=yes
 
# Automatically upgrade files that have not been user modified
AUTO_UPGRADE=yes
 
# Preserve files that you replace
PRESERVE_FILES=yes
PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
 
# Files to always avoid comparing (space separated)
IGNORE_FILES='/etc/motd /etc/rc.conf'

For more information check out the manual page.

10Jul/110

How to easy CVS update your SRC and Ports tree with a simple Bash script

Posted by mariusvw

Check this updated post: How to easy CVS update your SRC and Ports tree with a simple Bash script (v2)

Its advised to run this in Screen, you can install it from /usr/ports/sysutils/screen.

First install a simple tool to get the fastest cvs server

pkg_add -r fastest_cvsup

Or from Ports (if you have the collection already):

cd /usr/ports/sysutils/fastest_cvsup/
make install clean

Install CVSUP

pkg_add -r cvsup-without-gui

Or from Ports (if you have the collection already):

cd /usr/ports/net/cvsup-without-gui
make install clean

Setup config and binary to easy update the repository for SRC and PORTS.

mkdir /usr/local/etc/cvsup
cd /usr/share/examples/cvsup
cp stable-supfile /usr/local/etc/cvsup
cp ports-supfile /usr/local/etc/cvsup
cp doc-supfile /usr/local/etc/cvsup
cd /usr/local/etc/cvsup

Edit stable-supfile and change:

*default release=cvs tag=RELENG_7_1

Set this to your release version.

Edit /usr/local/etc/cvsup/runcvsup and add:

#!/bin/sh
arg=$@
sType="tld,nl" # Can be: all / tld / tld,nl,de,fr,us
if SERVER=`/usr/local/bin/fastest_cvsup -q -c $sType`
then
        echo "Using server: ${SERVER}"
        case "$arg" in
        "stable")
                echo "Updating: stable"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/stable-supfile
        ;;
        "ports")
                echo "Updating: ports"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/ports-supfile
        ;;
        "doc")
                echo "Updating: doc"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/doc-supfile
        ;;
        *)
                echo "Updating: all"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/stable-supfile
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/ports-supfile
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/doc-supfile
        ;;
        esac
fi

Set the right permissions:

chmod 700 runcvsup

Link the script so it can be reached.

ln -s /usr/local/etc/cvsup/runcvsup /usr/local/bin/runcvsup
rehash

Update everything:

runcvsup
10Jul/110

How to install and use pkg_cutleaves on FreeBSD

Posted by mariusvw

Installation

Install from ports collection.

cd /usr/ports/ports-mgmt/pkg_cutleaves/
make install clean

Usage

To list all leaves use:

pkg_cutleaves -lc

You can remove the leaves on a several ways, the simplest way is:

pkg_cutleaves

The program will ask what you want to do with the current leave.

KEEP IN MIND! THIS CAN SERIOUSLY HARM YOUR INSTALLATION!

8Jun/100

How to upgrade Perl 5.8.x to 5.10.x on FreeBSD.

Posted by mariusvw

In the ports collection you can find /usr/ports/UPDATING. Here you can read how to upgrade Perl 5.8.x to the new release 5.10.x.

The description below is copied from the updating file.

Note: you might need to manually upgrade some ports after this. For example, I had to recompile APR, Apache and Subversion.

Portupgrade users:
0) Fix pkgdb.db (for safety):

pkgdb -Ff

1) Reinstall perl with new 5.10:

env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.10 -f perl-5.8.*

2) Reinstall everything that depends on Perl:

portupgrade -fr perl

Portmaster users:

env DISABLE_CONFLICTS=1 portmaster -o lang/perl5.10 lang/perl5.8
portmaster -r perl-

Note: If the "perl-" glob matches more than one port you will need to specify the name of the perl directory in /var/db/pkg explicitly.

28Mar/100

How to sync files to a ftp server with the use of ftpsync on FreeBSD

Posted by mariusvw

In the ports of FreeBSD I found a nice tool to sync a local directory to a remote FTP server.

First install ftpsync:

cd /usr/ports/ftp/ftpsync
make install clean

Next create a config file to configure ftpsync for synchronization:

localdir=/home/mariusvw/backups
ftpserver=rstore.kitara.nl
ftpdir=/
ftpuser=username
ftppasswd=password

Next you have two options for syncing...

Get-sync from server:

ftpsync.pl -g cfg=financenetwerk_eu-v1.cfg

Put-sync to server:

ftpsync.pl -n cfg=financenetwerk_eu-v1.cfg

You can add the -p flag to not-prune directories on the target.

I don't use this program anymore for syncing but I can tell you, it works great if you want to easy upload a website to a live server.