Commit da417183 authored by Julien Leduc's avatar Julien Leduc
Browse files

Removing `buildtree_runner` docker tree.

Everything is now merged in the standard `ctafrontend` docker tree completely removing file duplication.
parent b0fb630e
# `ctafrontend` docker image repository
- This is the repository for CERN Tape Archive frontend docker image.
## Aim
The aim of this project is to provide a CTA frontend through Docker® containers.
## Components
* Dockerfile - The file describing how to build the Docker image for building CASTOR, in turn.
* etc/yum.repos.d - directory containing yum repos for installing necessary packages.
* etc/xrootd - directory containing static configuration files for xrootd
* run.sh - The main script to setup runtime environment.
## Setup
In order to be able to use the container, you should have Docker installed on your machine. You can get more information on how to setup Docker [here](https://docs.docker.com/linux/).
The base image used is CERN CentOS 7 (gitlab-registry.cern.ch/linuxsupport/cc7-base).
## Build image
In order to build the image, after making sure that the Docker daemon is running, run from the repository directory:
```bash
docker build --force-rm -t ctafrontend-cc7 cc7/
```
After the image has finished building successfully, run the following command:
```bash
# Run CTA fronted with prepared object store and catalogue DB.
# All logs will be passed back to the docker host through /dev/log socket.
# Shared path must be passed inside to the container.
# A host name have to be used for the container to run xrootd.
#
# @param objectstore CTA object store directory path name.
# @param catdb CTA catalogue DB setup.
#
docker run -h ctasystestf.cern.ch -it -e objectstore="/shared/jobStoreVFS1FlpYW" -e catdb="sqlite:/shared/sqliteDb/db" -v /dev/log:/dev/log -v /opt/cta/docker:/shared ctafrontend-cc7
```
# Should we run with another limit on the core file size other than the default?
DAEMON_COREFILE_LIMIT=unlimited
# Disable the KRB5 replay cache
export KRB5RCACHETYPE=none
# What roles should the xroot daemon run for. For each role you can overwrite
# the default options using a dedicate sysconfig file
# e.g. /etc/sysconfig/xrd.<role>. The role based mechanism allows for
# multiple xrd's running with different options to be controlled via
# the same initd script
XRD_ROLES="mq mgm fst"
# ------------------------------------------------------------------
# EOS Configuration
# ------------------------------------------------------------------
# The EOS instance name
export EOS_INSTANCE_NAME=DUMMY_INSTANCE_TO_REPLACE
# The EOS configuration to load after daemon start
export EOS_AUTOLOAD_CONFIG=default
# The EOS broker URL
export EOS_BROKER_URL=root://DUMMY_HOST_TO_REPLACE:1097//eos/
# The EOS host geo location tag used to sort hosts into geographical (rack) locations
export EOS_GEOTAG="DUMMY_HOST_TO_REPLACE"
# The fully qualified hostname of MGM master1
export EOS_MGM_MASTER1=DUMMY_HOST_TO_REPLACE
# The fully qualified hostname of MGM master2
export EOS_MGM_MASTER2=DUMMY_HOST_TO_REPLACE
# The alias which selects master 1 or 2
export EOS_MGM_ALIAS=DUMMY_HOST_TO_REPLACE
# The mail notification in case of fail-over
export EOS_MAIL_CC="none@mail.cern.ch"
export EOS_NOTIFY="mail -s `date +%s`-`hostname`-eos-notify $EOS_MAIL_CC"
# Changel minimum file system size setting - default is to have atleast 5 GB free on a partition
export EOS_FS_FULL_SIZE_IN_GB=5
# define the log file where you want to grep
export EOS_TTY_BROADCAST_LISTEN_LOGFILE="/var/log/eos/mgm/xrdlog.mgm"
# define the log file regex you want to broad cast to all consoles
export EOS_TTY_BROACAST_EGREP="\"CRIT|ALERT|EMERG|PROGRESS\""
###########################################################
set MGM=$EOS_MGM_ALIAS
###########################################################
xrootd.fslib -2 libXrdEosFst.so
xrootd.async off nosf
xrd.network keepalive
xrootd.redirect $(MGM):1094 chksum
###########################################################
xrootd.seclib libXrdSec.so
sec.protocol unix
sec.protocol sss -c /etc/eos.keytab -s /etc/eos.keytab
sec.protbind * only unix sss
###########################################################
all.export / nolock
all.trace none
all.manager DUMMY_HOST_TO_REPLACE 2131
#ofs.trace open
###########################################################
xrd.port 1095
ofs.persist off
ofs.osslib libEosFstOss.so
ofs.tpc pgm /usr/bin/xrdcp
###########################################################
# this URL can be overwritten by EOS_BROKER_URL defined /etc/sysconfig/xrd
fstofs.broker root://DUMMY_HOST_TO_REPLACE:1097//eos/
fstofs.autoboot true
fstofs.quotainterval 10
fstofs.metalog /var/eos/md/
#fstofs.trace client
###########################################################
###########################################################
xrootd.fslib libXrdEosMgm.so
xrootd.seclib libXrdSec.so
xrootd.async off nosf
xrootd.chksum adler32
###########################################################
xrd.sched mint 8 maxt 256 idle 64
###########################################################
all.export /
all.role manager
###########################################################
oss.fdlimit 16384 32768
###########################################################
# UNIX authentication
sec.protocol unix
# SSS authentication
sec.protocol sss -c /etc/eos.keytab -s /etc/eos.keytab
# KRB authentication
#sec.protocol krb5 -exptkn:/var/eos/auth/krb5#<uid> host/<host>@CERN.CH
#sec.protocol krb5 host/<host>@CERN.CH
sec.protbind localhost.localdomain unix sss
sec.protbind localhost unix sss
sec.protbind * only sss unix
###########################################################
mgmofs.fs /
mgmofs.targetport 1095
###########################################################
# this URL can be overwritten by EOS_BROKER_URL defined in /etc/sysconfig/eos
mgmofs.broker root://DUMMY_HOST_TO_REPLACE:1097//eos/
# this name can be overwritten by EOS_INSTANCE_NAME defined in /etc/sysconfig/eos
mgmofs.instance DUMMY_INSTANCE_TO_REPLACE
# configuration, namespace , transfer and authentication export directory
mgmofs.configdir /var/eos/config
mgmofs.metalog /var/eos/md
mgmofs.txdir /var/eos/tx
mgmofs.authdir /var/eos/auth
mgmofs.archivedir /var/eos/archive
# report store path
mgmofs.reportstorepath /var/eos/report
# this defines the default config to load
mgmofs.autoloadconfig default
# this enables that every change get's immedeatly stored to the active configuration - can be overwritten by EOS_AUTOSAVE_CONFIG defined in /etc/sysconfig/eos
mgmofs.autosaveconfig true
#-------------------------------------------------------------------------------
# Set the namespace plugin implementation
#-------------------------------------------------------------------------------
mgmofs.nslib /usr/lib64/libEosNsInMemory.so
######################### Broker OFS ########################
xrootd.fslib libXrdMqOfs.so
all.export /eos/ nolock
all.role server
xrootd.async off nosf
#############################################################
# SSS authentication
xrootd.seclib libXrdSec.so
sec.protocol sss -c /etc/eos.keytab -s /etc/eos.keytab
sec.protbind * only sss
#############################################################
#allow upto 1024 threads
xrd.sched mint 16 maxt 1024 idle 128
#run on port 1097
xrd.port 1097
#############################################################
#keepalive + idle timeout
xrd.network keepalive
xrd.timeout idle 120
mq.maxmessagebacklog 100000
mq.maxqueuebacklog 50000
mq.rejectqueuebacklog 100000
#############################################################
# low|medium|high as trace levels
mq.trace low
#############################################################
mq.queue /eos/
# Load the plugin XrdCtaOfs
xrootd.fslib libXrdCtaOfs.so
# Use the security module
xrootd.seclib libXrdSec.so
# Protocol specification
# The xroot server process needs to be able to read the keytab file
#sec.protocol krb5 /etc/krb5.keytab.cta host/<host>@CERN.CH
#sec.protocol sss -s /var/spool/xrootd/.xrd/sss.keytab -c /tmp/sss.keytab
sec.protocol unix
# Only Kerberos 5 and sss are allowed
#sec.protbind * only sss
sec.protbind 172.17.0* only unix
# Allow copying from absolute paths
all.export /
# Turn off asynchronous i/o
xrootd.async off
# Use a port other than 1094, already used by EOS xroot server
xrd.port 10955
[castor]
name=CASTOR Repositories in LINUXSOFT
baseurl=http://linuxsoft.cern.ch/internal/repos/castor7-testing/$basearch/os
enabled=0
gpgcheck=0
priority=2
[centos-cernonly]
name=CentOS-7 - CERN Only [20161019]
baseurl=http://linuxsoft.cern.ch/internal/yumsnapshot/20161019/cern/centos/7/cernonly/x86_64
enabled=1
gpgcheck=0
priority=10
[cta-ci-castor]
name=CTA CI repo castor cache
baseurl=https://cta-ci-repo.web.cern.ch/cta-ci-repo/castor/
priority=2
gpgcheck=0
enabled=1
[cta-ci-ceph]
name=CTA CI repo ceph cache
baseurl=https://cta-ci-repo.web.cern.ch/cta-ci-repo/ceph/
priority=3
gpgcheck=0
enabled=1
[cta-ci-eos]
name=CTA CI repo eos cache
baseurl=https://cta-ci-repo.web.cern.ch/cta-ci-repo/eos/
priority=4
gpgcheck=0
enabled=1
[cta-ci-others]
name=CTA CI repo any additional needed RPM cache
baseurl=https://cta-ci-repo.web.cern.ch/cta-ci-repo/others/
priority=4
gpgcheck=0
enabled=1
[cta-ci-xroot]
name=CTA CI repo xroot cache
baseurl=https://cta-ci-repo.web.cern.ch/cta-ci-repo/xroot/
priority=4
gpgcheck=0
enabled=1
0:eos-4.1.24-20170620133305git0008625.el7.cern.src
0:eos-archive-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-cleanup-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-client-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-debuginfo-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-server-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-srm-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-test-4.1.24-20170620133305git0008625.el7.cern.x86_64
0:eos-testkeytab-4.1.24-20170620133305git0008625.el7.cern.x86_64
1:xrootd-4.4.1-1.el7.x86_64
1:xrootd-debuginfo-4.4.1-1.el7.x86_64
1:xrootd-client-libs-4.4.1-1.el7.x86_64
1:xrootd-client-4.4.1-1.el7.x86_64
1:xrootd-selinux-4.4.1-1.el7.noarch
1:xrootd-server-4.4.1-1.el7.x86_64
1:xrootd-libs-4.4.1-1.el7.x86_64
1:xrootd-server-libs-4.4.1-1.el7.x86_64
#!/bin/bash
/opt/run/bin/init_pod.sh
cat <<EOF > /etc/cta/cta-cli.conf
# The CTA frontend address in the form <FQDN>:<TCPPort>
# solved by kubernetes DNS server so KIS...
ctafrontend:10955
EOF
# sleep forever but exit immediately when pod is deleted
exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
#!/bin/sh
# fix reverse DNS for EOS
/opt/run/bin/init_pod.sh
# copy needed template configuration files (nice to get all lines for logs)
yes | cp -r /opt/ci/ctaeos/etc /
eoshost=`hostname -f`
EOS_INSTANCE=`hostname -s`
TAPE_FS_ID=65535
CTA_BIN=/usr/bin/cta
CTA_KT=/etc/ctafrontend_SSS_c.keytab
CTA_XrdSecPROTOCOL=sss
CTA_PROC_DIR=/eos/${EOS_INSTANCE}/proc/cta
CTA_WF_DIR=${CTA_PROC_DIR}/workflow
CTA_TEST_DIR=/eos/${EOS_INSTANCE}/cta
# prepare CTA cli commands environment
cat <<EOF > /etc/cta/cta-cli.conf
# The CTA frontend address in the form <FQDN>:<TCPPort>
# solved by kubernetes DNS server so KIS...
ctafrontend:10955
EOF
# setup eos host and instance name
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/sysconfig/eos
sed -i -e "s/DUMMY_INSTANCE_TO_REPLACE/${EOS_INSTANCE}/" /etc/sysconfig/eos
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.mgm
sed -i -e "s/DUMMY_INSTANCE_TO_REPLACE/${EOS_INSTANCE}/" /etc/xrd.cf.mgm
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.mq
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.fst
# prepare eos startup
# skip systemd for eos initscripts
export SYSTEMCTL_SKIP_REDIRECT=1
# echo y | xrdsssadmin -k ${EOS_INSTANCE} -u daemon -g daemon add /etc/eos.keytab
# need a deterministic key for taped
# can only have one key????
echo -n '0 u:daemon g:daemon n:ctaeos+ N:6361884315374059521 c:1481241620 e:0 f:0 k:1a08f769e9c8e0c4c5a7e673247c8561cd23a0e7d8eee75e4a543f2d2dd3fd22' > /etc/eos.keytab
chmod 400 /etc/eos.keytab
chown daemon:daemon /etc/eos.keytab
mkdir -p /run/lock/subsys
mkdir -p /var/eos/config/${eoshost}
chown daemon:root /var/eos/config/${eoshost}
touch /var/eos/config/${eoshost}/default.eoscf
chown daemon:daemon /var/eos/config/${eoshost}/default.eoscf
# add taped SSS must be in a kubernetes secret
#echo >> /etc/eos.keytab
#echo '0 u:stage g:tape n:taped+ N:6361736405290319874 c:1481207182 e:0 f:0 k:8e2335f24cf8c7d043b65b3b47758860cbad6691f5775ebd211b5807e1a6ec84' >> /etc/eos.keytab
#/etc/init.d/eos master mgm
#/etc/init.d/eos master mq
touch /var/eos/eos.mq.master
touch /var/eos/eos.mgm.rw
echo "Configured mq mgm on localhost as master"
source /etc/sysconfig/eos
mkdir -p /fst
chown daemon:daemon /fst/
# start and setup eos for xrdcp to the ${CTA_TEST_DIR}
#/etc/init.d/eos start
/usr/bin/xrootd -n mq -c /etc/xrd.cf.mq -l /var/log/eos/xrdlog.mq -b -Rdaemon
/usr/bin/xrootd -n mgm -c /etc/xrd.cf.mgm -m -l /var/log/eos/xrdlog.mgm -b -Rdaemon
/usr/bin/xrootd -n fst -c /etc/xrd.cf.fst -l /var/log/eos/xrdlog.fst -b -Rdaemon
eos vid enable sss
eos vid enable unix
EOS_MGM_URL="root://${eoshost}" eosfstregister -r /fst default:1
eos node set ${eoshost} on
eos space set default on
eos attr -r set default=replica /eos
eos attr -r set sys.forced.nstripes=1 /eos
eos fs add -m ${TAPE_FS_ID} tape localhost:1234 /does_not_exist tape
eos mkdir ${CTA_PROC_DIR}
eos mkdir ${CTA_WF_DIR}
eos attr set CTA_TapeFsId=${TAPE_FS_ID} ${CTA_WF_DIR}
eos mkdir ${CTA_TEST_DIR}
eos chmod 777 ${CTA_TEST_DIR}
eos attr set CTA_StorageClass=ctaStorageClass ${CTA_TEST_DIR}
# hack before it is fixed in EOS
TAPE_FS_ID_TOSET=`eos attr ls ${CTA_WF_DIR} | grep CTA_TapeFsId= | tr '"' ' ' | cut -d ' ' -f 2`
eos attr set CTA_TapeFsId=${TAPE_FS_ID_TOSET} ${CTA_TEST_DIR}
# Link the attributes of CTA worklow directory to the test directory
eos attr link ${CTA_WF_DIR} ${CTA_TEST_DIR}
# test EOS
# eos slow behind us and we need to give it time to be ready
# 5 secs is not enough
sleep 10
eos -b node ls
xrdcp /etc/group root://${eoshost}:/${CTA_TEST_DIR}/testFile
# prepare EOS workflow
eos space config default space.wfe=on
# ATTENTION
# for sss authorisation unix has to be replaced by sss
# Set the worfklow rule for archiving files to tape
eos attr set sys.workflow.closew.default="bash:shell:cta XrdSecPROTOCOL=${CTA_XrdSecPROTOCOL} XrdSecSSSKT=${CTA_KT} ${CTA_BIN} archive --user <eos::wfe::rusername> --group <eos::wfe::rgroupname> --diskid <eos::wfe::fid> --instance eoscta --srcurl <eos::wfe::turl> --size <eos::wfe::size> --checksumtype <eos::wfe::checksumtype> --checksumvalue <eos::wfe::checksum> --storageclass <eos::wfe::cxattr:CTA_StorageClass> --diskfilepath <eos::wfe::path> --diskfileowner <eos::wfe::username> --diskfilegroup <eos::wfe::groupname> --recoveryblob:base64 <eos::wfe::base64:metadata> --reportURL 'eosQuery://${EOS_INSTANCE}//eos/wfe/passwd?mgm.pcmd=event\&mgm.fid=<eos::wfe::fxid>\&mgm.logid=cta\&mgm.event=archived\&mgm.workflow=default\&mgm.path=/eos/wfe/passwd\&mgm.ruid=0\&mgm.rgid=0' --stderr" ${CTA_WF_DIR}
# Set the worflow rule for creating tape file replicas in the EOS namespace.
eos attr set sys.workflow.archived.default="bash:shell:cta eos file tag <eos::wfe::path> +<eos::wfe::cxattr:CTA_TapeFsId>" ${CTA_WF_DIR}
# Set the worfklow rule for retrieving file from tape.
eos attr set sys.workflow.sync::prepare.default="bash:shell:cta XrdSecPROTOCOL=${CTA_XrdSecPROTOCOL} XrdSecSSSKT=${CTA_KT} ${CTA_BIN} retrieve --user <eos::wfe::rusername> --group <eos::wfe::rgroupname> --id <eos::wfe::fxattr:sys.archiveFileId> --dsturl '<eos::wfe::turl>\&eos.ruid=0\&eos.rgid=0\&eos.injection=1\&eos.workflow=CTA_retrieve' --diskfilepath <eos::wfe::path> --diskfileowner <eos::wfe::username> --diskfilegroup <eos::wfe::groupname> --recoveryblob:base64 <eos::wfe::base64:metadata> --stderr" ${CTA_WF_DIR}
# Set the workflow rule for the closew event of the CTA_retrieve workflow.
# Using the CTA_retrieve workflow will prevent the default workflow from
# receiving the closew event. Triggering the default workflow in this way would
# haved causes the unwanted action of copying the disk file to tape again.
# The action of the CTA_retrieve workflow when triggered by the closew event is
# to set the CTA_retrieved_timestamp attribute.
eos attr set sys.workflow.closew.CTA_retrieve="bash:shell:cta eos attr set 'CTA_retrieved_timestamp=\"\`date\`\"' <eos::wfe::path>" ${CTA_WF_DIR}
echo "### ctaeos mgm ready ###"
/bin/bash
#!/bin/sh
/opt/run/bin/init_pod.sh
echo "Adding cta user and group"
/usr/bin/getent group cta || /usr/sbin/groupadd cta
/usr/bin/getent passwd cta || /usr/sbin/useradd -s /bin/nologin -c "CTA system account" -g cta cta
yes | cp -r /opt/ci/ctafrontend/etc /
/opt/run/bin/init_objectstore.sh
. /tmp/objectstore-rc.sh
echo "ObjectStore BackendPath $OBJECTSTOREURL" > /etc/cta/cta-frontend.conf
echo "Catalogue NumberOfConnections 1" >>/etc/cta/cta-frontend.conf
echo "Log URL file:/cta-frontend.log" >>/etc/cta/cta-frontend.conf
/opt/run/bin/init_database.sh
. /tmp/database-rc.sh
echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
# EOS INSTANCE NAME used as username for SSS key
EOSINSTANCE=ctaeos
# Create SSS key for ctafrontend, must be forwardable in kubernetes realm
echo y | xrdsssadmin -k ctafrontend+ -u ${EOSINSTANCE} -g cta add /etc/ctafrontend_SSS_s.keytab
# copy it in the client file that contains only one SSS
cp /etc/ctafrontend_SSS_s.keytab /etc/ctafrontend_SSS_c.keytab
chmod 600 /etc/ctafrontend_SSS_s.keytab /etc/ctafrontend_SSS_c.keytab
chown cta /etc/ctafrontend_SSS_s.keytab /etc/ctafrontend_SSS_c.keytab
sed -i 's|.*sec.protocol sss.*|sec.protocol sss -s /etc/ctafrontend_SSS_s.keytab -c /etc/ctafrontend_SSS_c.keytab|' /etc/xrootd/xrootd-cta.cfg
sed -i 's|.*sec.protocol unix.*|#sec.protocol unix|' /etc/xrootd/xrootd-cta.cfg
# Hack the default xrootd-cta.cfg provided by the sources
sed -i 's|.*sec.protocol krb5.*|sec.protocol krb5 /etc/cta-frontend.keytab cta/cta-frontend@TEST.CTA|' /etc/xrootd/xrootd-cta.cfg
# Allow only SSS and krb5 for frontend
sed -i 's|^sec.protbind .*|sec.protbind * only sss krb5|' /etc/xrootd/xrootd-cta.cfg
# Wait for the keytab file to be pushed in by the creation script.
echo -n "Waiting for /etc/cta-frontend.keytab"
for ((;;)); do test -e /etc/cta-frontend.keytab && break; sleep 1; echo -n .; done
echo OK
touch /cta-frontend.log
chmod a+w /cta-frontend.log
tail -F /cta-frontend.log &
echo "Launching frontend"
runuser --shell='/bin/bash' --session-command='cd ~cta; xrootd -n cta -c /etc/xrootd/xrootd-cta.cfg -I v4' cta
echo "frontend died"
sleep infinity
#!/bin/sh
/opt/run/bin/init_pod.sh
echo "Using this configuration for library:"
/opt/run/bin/init_library.sh
cat /tmp/library-rc.sh
. /tmp/library-rc.sh
echo "Configuring objectstore:"
/opt/run/bin/init_objectstore.sh
. /tmp/objectstore-rc.sh
if [ "$KEEP_OBJECTSTORE" == "0" ]; then
echo "Wiping objectstore"
if [ "$OBJECTSTORETYPE" == "file" ]; then
rm -fr $OBJECTSTOREURL
mkdir -p $OBJECTSTOREURL
cta-objectstore-initialize $OBJECTSTOREURL
chmod -R 777 $OBJECTSTOREURL
else
if [[ $(rados -p $OBJECTSTOREPOOL --id $OBJECTSTOREID --namespace $OBJECTSTORENAMESPACE ls | wc -l) -gt 0 ]]; then
echo "Rados objectstore ${OBJECTSTOREURL} is not empty: deleting content"
rados -p $OBJECTSTOREPOOL --id $OBJECTSTOREID --namespace $OBJECTSTORENAMESPACE ls | xargs -itoto rados -p $OBJECTSTOREPOOL --id $OBJECTSTOREID --namespace $OBJECTSTORENAMESPACE rm toto
fi
cta-objectstore-initialize $OBJECTSTOREURL
echo "Rados objectstore ${OBJECTSTOREURL} content:"
rados -p $OBJECTSTOREPOOL --id $OBJECTSTOREID --namespace $OBJECTSTORENAMESPACE ls
fi
else
echo "Reusing objectstore (no check)"
fi
echo "Configuring database:"
/opt/run/bin/init_database.sh
. /tmp/database-rc.sh
echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
if [ "$KEEP_DATABASE" == "0" ]; then
echo "Wiping database"
echo yes | cta-catalogue-schema-drop /etc/cta/cta_catalogue_db.conf
if [ "$DATABASETYPE" == "sqlite" ]; then
mkdir -p $(dirname $(echo ${DATABASEURL} | cut -d: -f2))
cta-catalogue-schema-create /etc/cta/cta_catalogue_db.conf
chmod -R 777 $(dirname $(echo ${DATABASEURL} | cut -d: -f2)) # needed?
else
cta-catalogue-schema-create /etc/cta/cta_catalogue_db.conf
fi
else
echo "Reusing database (no check)"
fi
if [ ! $LIBRARYTYPE == "mhvtl" ]; then
echo "Real tapes, not labelling";
else
# library management
# BEWARE STORAGE SLOTS START @1 and DRIVE SLOTS START @0!!
echo "Labelling tapes using the first drive in ${LIBRARYNAME}: ${DRIVENAMES[${driveslot}]} on /dev/${DRIVEDEVICES[${driveslot}]}:"
for ((i=0; i<${#TAPES[@]}; i++)); do
vid=${TAPES[${i}]}
tapeslot=$((${i}+1)) # tape slot is 1 for tape[0] and so on...
echo -n "${vid} in slot ${tapeslot} "
mtx -f /dev/${LIBRARYDEVICE} load ${tapeslot} ${driveslot}
cd /tmp