SVN 命令列使用技巧

有時候必須使用 命令列 方式 來 commit files
但經常有很多散在各個子目錄裡的新增檔案
若用 svn add 一個一個來新增 實在費時費工
後來在這裡找到一個好方法:

    svn status | grep “^?” | awk ‘{print $2}’ | xargs svn add

這樣就可一次將新增檔案加入
不過要小心不要加到垃圾檔了….

OpenSUSE 12.3 checkpassword-pam 失效?!

從 OpenSUSE 12.2 升級至 OpenSUSE 12.3 後
不知為何原本正常的 Apache + NIS Authentication 居然
一直出現密碼錯誤無法登入

[Thu Apr 11 18:33:55 2013] [error] [client 192.168.103.1] AuthExtern checkpassword-pam [/usr/local/bin/checkpassword-pam -H --noenv --debug --stdout -s httpd -- /bin/true]: Failed (2) for user steve
[Thu Apr 11 18:33:55 2013] [error] [client 192.168.103.1] user steve: authentication failure for "/svn/": Password Mismatch

似乎是 checkpassword-pam 出了問題
重新下載 checkpassword source re-compile and re-install 也無效
大膽假設 checkpassword 在 OpenSUSE 12.3 有相容性問題 無法工作
無計可施的情況下,只好尋求其他的 Apache + NIS Authentication 的方案
最後找到另一個 solution : http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html#NIS

Step.1 Install Perl Modules: ExtUtils-AutoInstall, Net-NIS, Apache2-AuthenNIS

$ perl -MCPAN -e shell 
  ... (Answer no)
install ExtUtils::AutoInstall
install Net::NIS
install Apache2::AuthenNIS
quit

Step.2 Test if perl modules installed correct

$ vi testApache2AuthenNIS.pl
#!/usr/bin/perl
BEGIN{push @INC, "/usr/lib/perl5/site_perl/5.16.2/Apache2";}
eval "use Apache2::AuthenNIS"; $hasApacheAuth = $@ ? 0 : 1;
printf "Apache2::AuthenNIS". ($hasApacheAuth ?  "" : " not") . " installed";
printf "n";
$ sudo perl testApache2AuthenNIS.pl
Apache2::AuthenNIS installed

Step.3 Modify subversion.conf

$ vi /etc/apache2/conf.d/subversion.conf
        <Location /svn/>
                DAV svn
                SVNParentPath /svn/repos
                SVNListParentPath on
                # Limit write permission to list of valid users.

                # Require SSL connection for password protection.
                # SSLRequireSSL

                AuthType Basic
                AuthName "Subversion Server"
                PerlAuthenHandler Apache2::AuthenNIS
                PerlSetVar AllowAlternateAuth no
                #AuthExternal checkpassword-pam
                #AuthBasicProvider external
                Require valid-user
                AuthzSVNAccessFile /svn/svnaccess.conf
        </Location>

Step.5 restart Apache2

Done!

在 Mac OS X 10.6 安裝 SVN

Create User/Password for Access Control

sudo htpasswd -cm /etc/apache2/svn-auth-file username

Create /etc/apache2/other/svn.conf:

LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so
&lt;Location /svn&gt;
    DAV svn
    SVNParentPath /Users/SVN-ROOT
    SVNListParentPath on
    AuthType Basic
    AuthName &quot;Subversion repository&quot;
    AuthUserFile /etc/apache2/svn-auth-file
    Require valid-user
&lt;/Location&gt;

This will make the Subversion repository /Users/SVN-ROOT available at http://localhost/svn .

Update the repositories owner (otherwise commits would fail):


chown -R www:www /Users/SVN-ROOT

Restart Apache

sudo apachectl restart