Apr 06

Listing files by Update date in SVN and zipping them

How to get a list of all files changed from a specific date in the past. Secondly, how to zip them all up.

Step 1

svn diff http://subversion-url –summarize -r {2012-03-01}:{2012-03-31} > /var/log.txt

What this does is list the files with full path changed between Mar 1 to Mar 21 and append all the filepaths into a file called log.txt

Step 2

cat /var/log.txt | while read a; do zip changes.zip $a; done

Use piping to get each line from log.txt into variable a and pass the value of a into the zip command. Each filename from log.txt is added to the file changes.zip


Oct 22

Installing Flash plugin 10 for Firefox 7 in FreeBSD unix 8.0

When I upgraded from Firefox 3.x to Firefox 7, the older flash plugin stopped working.These are the steps which worked for me, to reinstall the flash plugin:

Assumptions

The Linux® process file system, linprocfs(5) is already mounted using either the manual command:

# mount -t linprocfs linproc /usr/compat/linux/proc

or set to run at boot time by adding the following line in /etc/fstab

linproc /usr/compat/linux/proc linprocfs rw 0 0

The linux emulator port /usr/ports/emulators/linux_base-f10 is already installed.

Firefox 7 is already installed. Note that firefox runs as firefox and not as firefox7 (Firefox 3.x ran as firefox3)

Steps

Install the /usr/ports/www/nspluginwrapper port using make or portmaster

Install the /usr/ports/www/linux-f10-flashplugin10 port

Make sure that you have $HOME/.mozilla/plugins folder present. If not, then create it manually.

The .mozilla/plugins folder is where the flash plugin should be installed by default but generally it doesnt so this has to be resolved by creating a symlink

# ln -s /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so
/$HOME/.mozilla/plugins/

For each user the plugin must be installed using the command

nspluginwrapper -v -a -i

Next run the command nspluginwrapper -l to see if the plugin was found in $HOME/.mozilla/plugins folder. If not then remove the symlink above and manually copy the libflashplayer.so into that folder. Run

nspluginwrapper -v -a -i

Close firefox if open and reload it. Type in about:plugins and it should the presense of the flash plugin.

Hope this helps.

Jul 30

Installing VSFTPD

1.Install it from the ports

cd /usr/ports/ftp/vsftpd

make config

make install clean

2.Edit the vstfpd.conf file in /usr/local/etc/vsftpd.conf to customize the settings

3.To run it from the command line:

/usr/local/libexec/vsftpd &

3.To make it run at startup create an executable file in /etc/rc.d

#! /bin/sh

#

/usr/local/libexec/vsftpd &

4.Restart computer

Jul 26

How to delete .svn folders recursively

There is a very simple way of doing this. We use the find command to get all the s/.v .svn folders in a folder. The next step is to pass the output of this command to the delete command .

So  to list all .svn folders in the current folder:

find . -type d -name .svn

Next pass the output of this to the rm command by enclosing the find command in accented single quotes:

rm -rf `find. -type d -name .svn`

Another way is to first change your current directory to your project folder and the type :

find ./ -name “.svn” | xargs rm -Rf
May 26

Checklist of applications to install

A reference list of all installed apps required for use on FreeBSD 8.0 or later

abiword – Word processing application

aterm – Better alternative to xterm

firefox – browser

fluxbox – window manager

filezilla – ftp client

gcolor2 – color picker utility

gkrellm – system monitoring util

linux-base-f10  – fedora linux compatibility base libraries

linux-f10-flashplugin – flash plugin for firefox and other browsers

mysql 5.x – mysql server and client

apache22 – apache http server

php5.x – php

opera – browser

portsnap – port updater tool

portaudit – port security tool

portmaster – port installer

putty – ssh tool

subversion – svn version control

vim – editor

xpdf – pdf viewer

xnview – image capture and processing utility

ffmpeg – audio/video conversion tool

xmms – mp3 player

mplayer – video player

Selenium – Firefox add-on for automated web testing

siege – web stress testing tool fromn joe dog sofware

May 19

Recovering from a corrupt rc.conf

Sometimes we may make a mistake in the rc.conf file – either a syntax error or loading something which causes the system to crash. In such a case we need to fix the rc.conf file so that the system can boot normally.

The steps to do this are given below:

  • Boot into single user mode
  • When prompted for a shell pathname,  press Enter
  • Type mount -urw / to re-mount the root file system in read/write mode.
  • Type mount -a -t ufs to mount the current file system so that you can runyour preferred editor eg. vi
  • Edit /etc/rc.conf as required and save it
  • Restart the system
May 18

Apache post-install issue with mod_unique_id

If after installing Apache and starting the server the following message shows in the error logs and the apache server does not start:

hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of xxxxxx

then in httpd.conf disable the line

LoadModule unique_id_module libexec/apache2/mod_unique_id.so

Restart again. This is usually the fix if changing hosts and httpd.conf ServerName entries etc. do not fix the problem.

May 17

Installing Mysql 5.x

The commands are given below. Though this was used to install mysql 5.5.4 , it is applicable to older versions also (and perhaps newer ones as well).

cd /usr/ports/databases/mysql55-server/
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql &
/usr/local/bin/mysqladmin -u root password newpassword

Edit /etc/rc.conf to start mysql server at startup by putting the line

mysql_enable=”YES”

After this, restart FreeBSD.

Apr 23

Setting Background Wallpaper in Fluxbox

First of all you need images to show as wallpaper. You can easily get them from various wallpaper sites on the web. Make sure you store the files in a single directory – you can organize them into sub-directories if there are too many.

Install feh which is an application for viewing images. This is in /usr/ports/graphics .
There are other wallpaper setting applications which can be used:

  • Esetroot
  • wmsetbg
  • feh
  • hsetroot
  • chbg
  • display
  • qiv
  • xv
  • xsri
  • xli
  • xsetbg

Once installed, run fbsetbg (fluxbox set background) . Run it first with fbsetbg -i which makes sure that there is a suitable application to set the wallpaper. You can now set the background wallpaper by using the command

fbsetbg -f /path/to/graphic/file

Eg. fbsetbg -f /var/data/wallpaper.jpg

You can even specify wildcards and fbsetbg will set the first matching file as the wallpaper.

Given below is a sample full-blown fluxbox installation.

screen_lynucs_46828721040bd81f35dc42_2

Apr 21

Always Keep root shell as part of base OS

Most people keep bash as their preferred shell program in FreeBSD. The problem with bash is that it does not come as part of the default FreeBSD package – it has to be installed as a third party application either using pkg_add or by compiling it from ports.

chsh -s /usr/local/bin/bash

If for some reason your ports tree has corruption or the bash port or a supporting port has not been updated properly, you might get locked out from the system the next time you try to log in. The problem would be that root uses bash for login and bash is not working in the ports so you can’t get in.

The way around such a case is to log in to single user mode and set the root shell back to something like sh or tcsh.

To prevent such a thing from happening in the first case, always keep the root shell as something which is not dependent on third party libraries. If you must keep bash then link it statically from ports by specifying WITH_STATIC_BASH during building.

My own preference is install bash but keep csh as the root shell. Once I have logged in to root, I manually run bash and then continue using bash.