Month: December 2006

Different methods of accessing subversion (svn) repository

Different methods of accessing subversion (svn) repository

Introduction –

There are three different methods of accessing subversion repository…

1] Local filesystem or Network filesystem accessed by client directly
2] Apache HTTP using WebDAV module
3] svnserve tunneled over an SSH (svn + ssh)

First of all I am creating base directory for svn as “/var/repos_base”

root@arun:~# mkdir /var/repos_base
root@arun:~# ls -ld  /var/repos_base
drwxr-xr-x 2 root root 4096 2006-12-26 16:32 /var/repos_base
root@arun:~#

How to get help ?

root@arun:~# svnadmin  help
root@arun:~# svn help
root@arun:~# svnlook  help
root@arun:~# svnsync  help
root@arun:~# svnversion  –help
root@arun:~# svnserve  –help

1] How to create svn repository ?

“svnadmin” command is used to perform adminitrative task in subversion. Like creating, taking dump, hotcopy, recovering & verifying subversion repository.

root@arun:~# svnadmin  create  /var/repos_base/myrepository

Here “/var/repos_base/myrepository” is the physical location of repository….

root@arun:~# ls -l /var/repos_base/myrepository/
total 28
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 conf
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 dav
drwxr-sr-x 5 root root 4096 2006-12-26 16:34 db
-r–r–r– 1 root root    2 2006-12-26 16:34 format
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 hooks
drwxr-xr-x 2 root root 4096 2006-12-26 16:34 locks
-rw-r–r– 1 root root  229 2006-12-26 16:34 README.txt
root@arun:~#

2] How to create trunk , branches etc directories in svn repository ?

method (1) ~ Local filesystem

root@arun:~# svn  mkdir   file:///var/repos_base/myrepository/trunk/

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c

Committed revision 1.
root@arun:~# svn  mkdir   file:///var/repos_base/myrepository/branches

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c

Committed revision 2.
root@arun:~#

root@arun:~# svn  list   file:///var/repos_base/myrepository/
branches/
trunk/
root@arun:~#

method (2) ~ Apache HTTP using WebDAV module

arunsb@arun:~$ svn  mkdir    http://192.168.0.1/myrepository/trunk/

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:

Committed revision 1.
arunsb@arun:~$ svn   mkdir    http://192.168.0.1/myrepository/branches/

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c

Committed revision 2.
arunsb@arun:~$ svn  list  http://192.168.0.1/myrepository/
branches/
trunk/
arunsb@arun:~$

method (3) ~ svnserve tunneled over an SSH (svn + ssh)

arunsb@arun:~$ svn mkdir  svn://192.168.0.1/myrepository/branches/

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:

Committed revision 1.
arunsb@arun:~$ svn mkdir  svn://192.168.0.1/myrepository/trunk/

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c

Committed revision 2.
arunsb@arun:~$ svn list  svn://192.168.0.1/myrepository/
branches/
trunk/
arunsb@arun:~$

3] How to import un-versioned data in svn ?

root@arun:~# ls -l  /root/source_code/
total 12
-rwxr-xr-x 1 root root    3 2006-12-26 20:01 arun.html
-rw-r–r– 1 root root 2119 2006-12-26 20:03 License
-rwxr-xr-x 1 root root   64 2006-12-26 20:01 my.pl
root@arun:~#

* I wanted to import this data….

method (1)

root@arun:~# svn import   /root/source_code/ file:///var/repos_base/myrepository/trunk/    -m “welcome to first import”
Adding         /root/source_code/my.pl
Adding         /root/source_code/License
Adding         /root/source_code/arun.html

Committed revision 3.
root@arun:~#

List the imported data from svn repository –

arunsb@arun:~$ svn list file:///var/repos_base/myrepository/trunk/
License
arun.html
my.pl
arunsb@arun:~$

method (2)

arunsb@arun:~$ svn import   /root/source_code/   http://192.168.0.1/myrepository/trunk/  -m “welcome to first import”
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:
Adding         /root/source_code/my.pl
Adding         /root/source_code/License
Adding         /root/source_code/arun.html

Committed revision 3.
arunsb@arun:~$

method (3)

arunsb@arun:~$ svn import   /root/source_code/   svn://192.168.0.1/myrepository/trunk/  -m “welcome to first import”
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Adding         /root/source_code/my.pl
Adding         /root/source_code/License
Adding         /root/source_code/arun.html

Committed revision 3.
arunsb@arun:~$

4] How to check out the svn repository ?

method (1)

arunsb@arun:~$ svn checkout file:///var/repos_base/myrepository/trunk/  /home/arunsb/mysource_code/
A    /home/arunsb/mysource_code/my.pl
A    /home/arunsb/mysource_code/License
A    /home/arunsb/mysource_code/arun.html
Checked out revision 3.
arunsb@arun:~$

method (2)

arunsb@arun:~$ svn checkout   http://192.168.0.1/myrepository/trunk/   /home/arunsb/mysource_code/
Authentication realm: <http://192.168.0.1:80> || Welcome to Subversion Repository ||
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$

method (3)

arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/   /home/arunsb/mysource_code/
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$

* Now check checked out data…

arunsb@arun:~$ ls -l /home/arunsb/mysource_code/
total 12
-rwxr-xr-x 1 arunsb oinstall    3 2006-12-26 20:42 arun.html
-rw-r–r– 1 arunsb oinstall 2119 2006-12-26 20:42 License
-rwxr-xr-x 1 arunsb oinstall   64 2006-12-26 20:42 my.pl
arunsb@arun:~$

** Now go to “/home/arunsb/mysource_code/”

arunsb@arun:~/mysource_code$ cd  /home/arunsb/mysource_code/
arunsb@arun:~/mysource_code$ ls
arun.html  License  my.pl
arunsb@arun:~/mysource_code$

* How to get information about svn repository –

arunsb@arun:~/mysource_code$ svn info
Path: .
URL: file:///var/repos_base/myrepository/trunk
Repository Root: file:///var/repos_base/myrepository
Repository UUID: 361de285-9226-493b-aed7-a95619a457c0
Revision: 3
Node Kind: directory
Schedule: normal
Last Changed Author: root
Last Changed Rev: 3
Last Changed Date: 2006-12-26 20:38:14 +0530 (Fri, 26 Dec 2006)
arunsb@arun:~/mysource_code$

4] How to commit data ?

Now create  new file “new_file.php” in modify the file…

arunsb@arun:~/mysource_code$ touch  new_file.php
arunsb@arun:~/mysource_code$ ls
arun.html  License  my.pl  new_file.php
arunsb@arun:~/mysource_code$ vi new_file.php
arunsb@arun:~/mysource_code$ mkdir  new_dir
arunsb@arun:~/mysource_code$ ls
arun.html  License  my.pl  new_dir  new_file.php
arunsb@arun:~/mysource_code$

* Now check the status… ‘?’ means file or directory NOT in svn repository

arunsb@arun:~/mysource_code$ svn  status
?      new_dir
?      new_file.php
arunsb@arun:~/mysource_code$

* Now add  newly created files and directories…

arunsb@arun:~/mysource_code$ svn add  new_dir
A         new_dir
arunsb@arun:~/mysource_code$ svn add  new_file.php
A         new_file.php
arunsb@arun:~/mysource_code$

* Another method to add directory is…

arunsb@arun:~/mysource_code$ svn mkdir new_dir2
A         new_dir2
arunsb@arun:~/mysource_code$

* Now check the status… ‘A’ means data is modified

arunsb@arun:~/mysource_code$ svn  status
A      new_dir
A      new_dir2
A      new_file.php
arunsb@arun:~/mysource_code$

* commit modified to svn repository…

arunsb@arun:~/mysource_code$ svn commit  -m “committing  data”
Adding         new_dir
Adding         new_dir2
Adding         new_file.php
Transmitting file data .
Committed revision 4.
arunsb@arun:~/mysource_code$

5] How to check svn status (working copy) –

arunsb@arun:~/mysource_code$ svn status
arunsb@arun:~/mysource_code$

arunsb@arun:~/mysource_code$ svn  status
A      new_dir
A      new_dir2
A      new_file.php
arunsb@arun:~/mysource_code$

6] How to update svn working copy –

arunsb@arun:~/mysource_code$ svn update
At revision 4.
arunsb@arun:~/mysource_code$

* update working copy to specific revision….

arunsb@arun:~/mysource_code$ svn update -r20

7] How to check  svn log (working copy) –

arunsb@arun:~/mysource_code$ svn log
————————————————————————
r1 | arunsb | 2008-12-26 21:53:04 +0530 (Fri, 26 Dec 2006) | 1 line
————————————————————————
arunsb@arun:~/mysource_code$

Thank you,
Arun Bagul

How to remove all blank lines from file – grep command

How to remove all blank lines from file – grep command

1] cat the file arun.txt which has several blank lines

root@indianGNU.org:/home# cat arun.txt
This is first line of file

this is second line

ok this script will help you to delete all blank links from file
How to start shell scripting

make sure that you will win

arun bagul

end of file

root@indianGNU.org:/home#

2] Run command for removing lines

root@indianGNU.org:/home# grep -v “^$” arun.txt > no_blank_lines.txt

3] Chcek new file –

root@indianGNU.org:/home# cat no_blank_lines.txt
This is first line of file
this is second line
ok this script will help you to delete all blank links from file
How to start shell scripting
make sure that you will win
arun bagul
end of file
root@indianGNU.org:/home#

Pluggable Authentication Modules (PAM)

Pluggable Authentication Modules (PAM)

Programs which give privileges to users must properly authenticate each user. For instance, when you log into a system, you provide your username and password, and the log in process uses this username and password to verify your identity.

Pluggable Authentication Modules (PAM) allows the system administrator to set authentication policies for PAM-aware applications without having to recompile authentication programs. PAM does this by utilizing a pluggable, modular architecture. Which modules PAM calls for a particular application is determined by looking at that application’s PAM configuration file in the /etc/pam.d/ directory.

In most situations, you will never need to alter the default PAM configuration files for a PAM-aware application. Whenever you use rpm or deb or tgz to install programs that require authentication, they automatically make the changes necessary to do normal password authentication using PAM. However, if you need to customize the PAM configuration file, you must understand the structure of this file.

Advantages of PAM

When used correctly, PAM provides the following advantages for a system administrator:

· It provides a common authentication scheme that can be used with a wide variety of applications.

· It allows great flexibility and control over authentication for both the system administrator and application developer.

· It allows application developers to develop their program without implementing a particular authentication scheme. Instead, they can focus purely on the details of their program.

Thanks

Ravi Bhure