UPDATE: See the Photoshop CS5 version here.
Ok, so if you haven't seen the new Content Ware Fill feature in CS5 yet check it out here. I was looking into it and got a link to a GIMP plugin called Resynthesizer. I decided to play around with it a bit and will compare the same edits in CS5 once its out. Here are the two tests I did, the first was some small edits to remove a duck, some waves, and the power lines(and shadows). The second was a larger edit to remove a big tree witch didn't go as well.
This is my personal blog and mainly contains technical solutions, open source code, and other projects I have worked on. Much of the technical solutions are very niche so your milage may vary.
Tuesday, March 30, 2010
Thursday, March 25, 2010
Mixing binary backage and source ports install sources with portupgrade in FreeBSD
Ok so a few weeks ago I made this post about automating update checks and downloads. While as it turns out there was another issue I ran into. The problem is simply this:
When using portupgrade -Pa to to FreeBSD updates from packages all updated packages will be installed even if you compile one of the updated packages was compiled locally from the ports tree with custom options or libraries. This causes any customizations to be lost and possibly version mismatches with system libraries.
The only ways around this problem was to either only upgrade some subset of the ports or to set HOLD_PKGS and manually update problem ports after a package update. Neither of these solutions is optimal so I took the time to make a patch for portupgrade.
The patch adds a USE_PORTS configuration option that specifies a lit of packages to always build from the ports tree even when portupgrade -P is called. (The -PP option still works the same as before.) Thus any custom packages can be added to this list and then an automatic update can be done that will favor binary version when available and when not overridden. This also means that if one package is built from source its parents and children will still come from binary packages if available.
Build the pached version
Patch, build, and install.
Configuration
To configure the list of overrides you will need to edit the following section:
When using portupgrade -Pa to to FreeBSD updates from packages all updated packages will be installed even if you compile one of the updated packages was compiled locally from the ports tree with custom options or libraries. This causes any customizations to be lost and possibly version mismatches with system libraries.
The only ways around this problem was to either only upgrade some subset of the ports or to set HOLD_PKGS and manually update problem ports after a package update. Neither of these solutions is optimal so I took the time to make a patch for portupgrade.
The patch adds a USE_PORTS configuration option that specifies a lit of packages to always build from the ports tree even when portupgrade -P is called. (The -PP option still works the same as before.) Thus any custom packages can be added to this list and then an automatic update can be done that will favor binary version when available and when not overridden. This also means that if one package is built from source its parents and children will still come from binary packages if available.
Build the pached version
Patch, build, and install.
cd /usr/ports/ports-mgmt/portupgrade sudo make extract cd work sudo wget http://pynej.dnsalias.com/Shared/pkgtools-2.4.6-1.patch sudo patch -p0 < pkgtools-2.4.6-1.patch cd pkgtools-2.4.6 sudo make isntall cleanYou may also want to add portupgrade to your HOLD_PKGS list in /usr/local/etc/pkgtools.conf so it doesn't get replaced in the future.
Configuration
To configure the list of overrides you will need to edit the following section:
sudo vim /usr/local/etc/pkgtools.conf USE_PORTS = [ ]Here is a sample of some common overrides.
- php5 to enable the apache module
- php5-mysql to get the binding to the correct version of mysql-server
- mod_perl2 to enable apache module
- phpmyadmin as it depends ont he wrong php5-mysql paskage)
sudo vim /usr/local/etc/pkgtools.conf USE_PORTS = [ 'lang/php5', 'databases/php5-mysql', 'databases/phpmyadmin', 'www/mod_perl2', ]
Friday, March 12, 2010
Configure VirtualBox Deamon
A while back I switched from VMware to VirtualBox(when switching to freebsd) and ran into a problem getting virtual machines to start on server boot. Virtual box supports background operation(headless mode) but freebsd does not come with and rc service for doing so. Included below is a freebsd version to accomplish startup/shutdown task as well as other common operations.
To install save this script into /usr/local/etc/rc.d/virtualbox and make it executable. Then add the following lines to your /etc/rc.conf as needed.
A few other notes: I actually set up a separate account for VirtualBox and the daemon supports this. Also please note that the autostart list is done by name and the names can not have spaces. You can also manually start and stop machines with the startvm and stopvm options.
To install save this script into /usr/local/etc/rc.d/virtualbox and make it executable. Then add the following lines to your /etc/rc.conf as needed.
# Load the VirtualBox drivers and start any default machines. vboxnet_enable="YES" # Enable drivers from package virtualbox-ose-kmod. virtualbox_enable="YES" virtualbox_autostart="ASG" # List of machine names to start on boot. virtualbox_user="vboxuser" virtualbox_group="vboxusers"
A few other notes: I actually set up a separate account for VirtualBox and the daemon supports this. Also please note that the autostart list is done by name and the names can not have spaces. You can also manually start and stop machines with the startvm and stopvm options.
/usr/local/etc/rc.d/virtualbox #!/bin/sh # # PROVIDE: virtualbox # REQUIRE: LOGIN vboxnet # # Add the following lines to /etc/rc.conf to enable the virtualbox daemon: # # virtualbox_enable="YES" # virtualbox_autostart="BOX1 BOX2" # . /etc/rc.subr name="virtualbox" rcvar=`set_rcvar` extra_commands="status startvm stopvm" start_cmd="${name}_start" stop_cmd="${name}_start" status_cmd="${name}_status" startvm_cmd="${name}_startvm" stopvm_cmd="${name}_stopvm" poweroffvm_cmd="${name}_poweroffvm" load_rc_config $name virtualbox_user=${virtualbox_user:-"vboxuser"} virtualbox_group=${virtualbox_group:-"vboxusers"} virtualbox_autostart=${virtualbox_autostart:-""} SU="su $virtualbox_user -c" VBOXMANAGE="/usr/local/bin/VBoxManage -nologo" virtualbox_start() { echo "Starting ${name}." echo $virtualbox_autostart | awk -F , '{for(i=1;i<=NF;i++) print $i}' | while read VM; do $SU "$VBOXMANAGE startvm \"$VM\" --type headless" done } virtualbox_stop() { echo "Stopping ${name}." $SU "$VBOXMANAGE list runningvms" | sed 's/.*"\(.*\)".*/\1/' | while read VM; do $SU "$VBOXMANAGE controlvm \"$VM\" acpipowerbutton" done wait_for_closing_machines } virtualbox_startvm() { $SU "$VBOXMANAGE startvm \"$*\" --type headless" } virtualbox_stopvm() { $SU "$VBOXMANAGE controlvm \"$*\" acpipowerbutton" } virtualbox_poweroffvm() { $SU "$VBOXMANAGE controlvm \"$*\" poweroff" } virtualbox_status() { $SU "$VBOXMANAGE list runningvms" | sed 's/.*"\(.*\)".*/\1/' | while read VM; do echo "$VM " done } wait_for_closing_machines() { RUNNING_MACHINES=`$SU "$VBOXMANAGE list runningvms" | wc -l` if [ $RUNNING_MACHINES != 0 ]; then sleep 5 wait_for_closing_machines fi } run_rc_command "$@"
Friday, March 5, 2010
Setting up FreeBSD to Auto-Download and Notify Updates
03/11/2010- Update: Updated the portsnap command to properly apply the port updates. As configured before the changes would show up but the cron task to download packages would never download them.
Overview
The default install of FreeBSD is very stable, and works well. And it is relatively simple manually do updates, but I recent looked into setting up auto-updates like Ubuntu does. The way I have it et up now is the following.
Automatic downloading of kernel/world updates to the FreeBSD release.
Automatic downloading and updating of the current ports tree.
Automatic downloading of any updated binary packages of installed ports.
These three tasks are set as cron jobs and run once a day/week to check for and download updates. Reports are also sent to the root account on checking so you will be notified where updates are available. The administrator can then manuals install the system updates, binary packages updates, and source port updates from the local cache.
Setup
First off we will add a few cron jobs to auto-download our updates. Add these lines to /etc/cron and customize the run time as desired.
To enable the email reports you need to add an alias to send mail to forward root's mail to an administrator. To do so edit the file /etc/aliases and add line like so with your username.
You will also need to install the portutils package if you don't have it for package updating.
Once installed we need to change the package source location to pull binary package updates from the stable branch instead of the release branch. The release packages are never updated and as such we would never find binary updates. To change this edit the /usr/local/etc/pkgtools.conf file and change the PKG_SITES variable to the following.
Unfortunately the portupgrade utility does not respect packages you customized and build by hand and will just overwrite them with the binary version. To get around this you can add any exceptions you want to HOLD_PKGS array in this file and update them manually. You way also want to add any languages you don't use to the IGNORE_CATEGORIES array at this time as well to speed up the ports commands.
Manual Update
Once all these steps are done we can force a manual update of all three with the following commands, though they will take a bit to complete.
Installing Updates
If using ZFS you may want to make a snapshot first.
When you want to do an actual update to the system here are the commands to install the downloaded updates.
And finally its a good idea to clean out the old files manually or via another cron task..
If everything went smoothly you may wish to remove the old snapshots.
Overview
The default install of FreeBSD is very stable, and works well. And it is relatively simple manually do updates, but I recent looked into setting up auto-updates like Ubuntu does. The way I have it et up now is the following.
Automatic downloading of kernel/world updates to the FreeBSD release.
Automatic downloading and updating of the current ports tree.
Automatic downloading of any updated binary packages of installed ports.
These three tasks are set as cron jobs and run once a day/week to check for and download updates. Reports are also sent to the root account on checking so you will be notified where updates are available. The administrator can then manuals install the system updates, binary packages updates, and source port updates from the local cache.
Setup
First off we will add a few cron jobs to auto-download our updates. Add these lines to /etc/cron and customize the run time as desired.
# Check for freebsd updates, download them, and mail root. 0 2 * * 0 root freebsd-update cron # Check for ports updates, download them, and mail root. 0 3 * * 0 root portsnap cron update && pkg_version -vIL= # Check for binary pacakge updates, download them, and mail root. 0 4 * * 0 root portupgrade -PFa
To enable the email reports you need to add an alias to send mail to forward root's mail to an administrator. To do so edit the file /etc/aliases and add line like so with your username.
root: adminaccountThen run the following command to make the change take effect.
cd /etc/mail && sudo make aliases
You will also need to install the portutils package if you don't have it for package updating.
cd /usr/ports/ports-mgmt/portupgrade && sudo make install
Once installed we need to change the package source location to pull binary package updates from the stable branch instead of the release branch. The release packages are never updated and as such we would never find binary updates. To change this edit the /usr/local/etc/pkgtools.conf file and change the PKG_SITES variable to the following.
PKG_SITES = [ sprintf('ftp://ftp.freebsd.org/pub/FreeBSD/ports/%s/packages-%s-stable/', OS_PLATFORM, OS_MAJOR) ]
Unfortunately the portupgrade utility does not respect packages you customized and build by hand and will just overwrite them with the binary version. To get around this you can add any exceptions you want to HOLD_PKGS array in this file and update them manually. You way also want to add any languages you don't use to the IGNORE_CATEGORIES array at this time as well to speed up the ports commands.
Manual Update
Once all these steps are done we can force a manual update of all three with the following commands, though they will take a bit to complete.
sudo freebsd-update fetch sudo portsnap fetch update sudo portupgrade -PFa
Installing Updates
If using ZFS you may want to make a snapshot first.
sudo zfs snapshot zroot@ver-date sudo zfs snapshot zroot/usr@ver-date
When you want to do an actual update to the system here are the commands to install the downloaded updates.
sudo freebsd-update install sudo portupgrade -Pa
And finally its a good idea to clean out the old files manually or via another cron task..
portsclean -CDPL
If everything went smoothly you may wish to remove the old snapshots.
sudo zfs destroy zroot@ver-date sudo zfs destroy zroot/usr@ver-date
Subscribe to:
Posts (Atom)
Project Licenses
These works by Jeremy Pyne are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License