nd_login 1010 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash

if [ -z "$1" ]; then
cat << EOT
Script to log into a particular COW and bindmount some directory.

Synopsis
--------

10
  nd_login <family> <codename> <arch> [bindmountdir] [cowbuilderopts]
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

EOT
exit 1
fi

family=$1
dist=$2
arch=$3
bmdir=$4

set -e

if [ -z "$family" ]; then
  echo "You need to provide a distribution family ('debian', 'ubuntu'); prefix with 'nd+' to enable the NeuroDebian repository."
  exit 1
fi

if [ -z "$dist" ]; then
  echo "You need to provide a distribution codename (e.g. 'lenny', 'squeeze')."
  exit 1
fi

if [ -z "$arch" ]; then
  echo "You need to provide an architecture (e.g. 'i386', 'amd64')."
  exit 1
fi

38
. /etc/neurodebian/cmdsettings.sh
39 40 41 42 43

# common options
opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace"


44
if [ -n "bmdir" ]; then
45 46 47 48 49 50 51 52
  options="$opts --bindmounts $bmdir"
else
  options="$opts"
fi

cowbuilder --login \
             --basepath ${cowbuilderroot}/cow/${family}-${dist}-${arch}.cow \
             $options \
53
             "$@"