List Maven Artficats deployed by a Project

The Goal

You want to have a table containing the names and versions of all artifacts delpoyed by a mvn install in Microsoft Word.

The Solution

  1. Create a temporary directory <tmp>

    $ mkidr <tmp>
    
  2. Deploy to <tmp>.

    $ mvn verify deploy:deploy \
      -DaltDeploymentRepository=snapshots::default::file://<tmp>  
    
  3. Create text table.

    $ find . -type d -a -name "*SNAPSHOT" |\
        sed "s/-SNAPSHOT//" |\
        cut -f 3- -d/ |\
        sed 's#/\([^/]*\)$#\t\1#' |\
        sed 's#/#\.#g' |\
        grep -v parent
    
  4. Copy text table from shell into Word.

  5. Select inserted text in Word.

  6. Select “Text to Table”.

Installing all available depends of a FreeBSD port via pkg

  • Write the names of the depends into a file:

    $ cd /usr/ports/...
    $ make all-depends-list | cut -f4- -d/ > ~/depends
    
  • Update the ports:

    $ sudo portsnap fetch update
    
  • Update package repository:

    $ sudo pkg update
    
  • Prevent pkg install from updating the package repository:

    $ export REPO_AUTOUPDATE="NO"
    
  • Run pkg install -y for all depends:

    $ for x in `cat owncloud-depends`; do pkg install -y $x; done
    

Setting up ezjails in FreeBSD

Install and Configure ezjail

  • Install the package: $ sudo pkg install ezjail
  • Edit the ezjail configuration: $ sudo vim /usr/local/etc/ezjail.conf
    Change the following assignments

    ezjail_use_zfs="YES"
    ezjail_use_zfs_for_jails="YES"
    ezjail_jailzfs="zroot/ezjail"
    
  • Install the basejail (man-pages, source and ports): $ sudo ezjail-admin -msp

  • Create a default flavour for ezjail:

    $ cd /usr/jails/flavours
    $ cp -R example default
    
  • Edit etc/rc.conf to contain sshd_enable="YES" and defaultrouter=<your default router>.

  • Edit etc/resolv.conf to contain nameserver <your nameserver>.

Let jails share the same IP address (optional)

  • Edit /etc/rc.config to define a new loopback device:

    #subnet for jails
    cloned_interfaces="lo1"
    ifconfig_lo1="inet 10.0.0.254 netmask 255.255.255.0"
    ifconfig_lo1_alias0="inet 10.0.0.1 netmask 255.255.255.0"
    # Define aliases for your other jails here
    
  • Edit /etc/pf.conf to define the ports to forward:

    PUBLIC_IP=<your public IP>
    nat on em0 from lo1:network to any -> (em0)
    rdr on em0 proto tcp from any to $PUBLIC_IP port http -> 10.0.0.1 port http
    # Put entries for your other jails here
    
  • Edit /etc/rc.conf to enable packet filter:

    pf_enable="YES"
    
  • Restart the network interfaces and the packet filter:

    $ sudo service netif restart
    $ sudo dhclient em0
    $ sudo service pf restart
    

Create a Jail

  • Create a jail with your prepared flavour:

    $ sudo ezjail-admin create -f default <jail name> <jail IP>
    
  • Start the jail:

    $ sudo ezjail-admin start <jail name>
    

Cloning a Git-Repository and syncing git-svn

First clone the repository:

$ git clone repo repo2

Migrate the configuration of the SVN repository from repo/.git/config to repo2/.git/config:

[svn-remote "svn"]
    url = ...
    fetch = :refs/remotes/git-svn

Find out the hash of the Reference git-svn in repo:

$ cd repo
$ git show-ref git-svn
15fd88684377d1578652d7cba801e08153352563 refs/remotes/git-svn

Set the Reference git-svn in repo2 to the same hash as in repo:

$ cd reop2
$ git update-ref refs/remotes/git-svn 15fd88684377d1578652d7cba801e08153352563

Mind the first parameter is refs/remotes/git-svn, not git-svn.

Rebuild the revision map:

$ git svn fetch
Partial-rebuilding .git/svn/refs/remotes/git-svn/.rev_map.5b3e15bb-e2e7-4315-b388-b0b4f57e8913 ...
Currently at 7487 = ac1a2b316a1baf9a8f37dbad6bdff5de6e1b7b0a
r12560 = 5623c616ba3cfdbd3a2e471da4949e5c2e30caac
r12561 = ae3bf32421d8da8f9f74f589f5d305a0aac863de
...
r14699 = 15fd88684377d1578652d7cba801e08153352563
Done rebuilding .git/svn/refs/remotes/git-svn/.rev_map.5b3e15bb-e2e7-4315-b388-b0b4f57e8913

Note: The hash 15fd88684377d1578652d7cba801e08153352563 for the last SVN revision (r14699) is the same as reference git-svn in repo and repo2.

Setting up a NAS with FreeBSD 10

Attention: This is work in progress.

Preparing the installation medium

Use the console (COM1) for input/output during installation

  • Boot installation medium inside VirtualBox
  • Change /boot/loader.conf:

    echo 'console="comconsole"' >> /boot/loader.conf

After installation

Setup ssh

Use comconsole

  • echo 'console="comconsole"' >> /boot/loader.conf
  • Change /etc/ttys: ttyu0 "/usr/libexec/getty std.9600" vt100 on secure

Use sudo

  • Install sudo: pkg install sudo
  • Enable sudo without password for group wheel in /usr/local/etc/sudoers:
    %wheel ALL=(ALL) NOPASSWD: ALL

netatalk

  • pkg install netatalk3
  • Change config files

/usr/local/etc/afp.conf

[Global] 
; Global server settings 
hostname = ... 
; login message = "Welcome"

mimic model = Xserve 
zeroconf = yes 
uam list = uams_guest.so uams_dhx.so uams_dhx2.so 
guest account = nobody

[Timemachine] 
path = /timemachine 
valid users = @timemachine 
time machine = yes

[Server] 
path = /server 
valid users = ...

/usr/local/etc/avahi/services/afp.service

<?xml version="1.0" standalone="no"?>
<service-group>
<name replace-wildcards="yes">...</name>
  <service>
   <type>_afpovertcp._tcp</type>
   <port>548</port>
  </service>
  <service>
   <type>_device-info._tcp</type>
   <port>0</port>
   <txt-record>model=Xserve</txt-record>
  </service>
  <service>
   <type>_adisk._tcp</type>
   <port>9</port>
   <txt-record>sys=waMA=xx:xx:xx:xx:xx:xx,adVF=0x100</txt-record>
  </service>
</service-group>

Automatic ZFS-Snapshots

  • pkg install zfstools
  • crontab -e:
15,30,45 * * * * root /usr/local/bin/zfs-auto-snapshot frequent  4
0        * * * * root /usr/local/bin/zfs-auto-snapshot hourly   24
7        0 * * * root /usr/local/bin/zfs-auto-snapshot daily     7
14       0 * * 7 root /usr/local/bin/zfs-auto-snapshot weekly    4
28       0 1 * * root /usr/local/bin/zfs-auto-snapshot monthly  12

Icy Harbor

Winter, evening sun, Harbor. Sounds like ingredients of great photos. Judge yourself.