Files
vtl-appliance/dist/adastra-vtl-installer/scripts/install-mhvtl.sh

134 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "=========================================="
echo " mhvtl Installation Script"
echo "=========================================="
echo ""
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run as root"
exit 1
fi
MHVTL_VERSION="1.6-7"
MHVTL_DIR="/opt/mhvtl"
MHVTL_CONFIG="/etc/mhvtl"
echo "[1/5] Installing build dependencies..."
apt-get update
apt-get install -y \
build-essential \
git \
zlib1g-dev \
libibverbs-dev \
libconfig-dev \
libssl-dev \
uuid-dev \
linux-headers-$(uname -r) \
mt-st \
mtx \
lsscsi \
sg3-utils
echo "[2/5] Downloading mhvtl source..."
cd /tmp
if [ -d "mhvtl" ]; then
rm -rf mhvtl
fi
git clone https://github.com/markh794/mhvtl.git
cd mhvtl
echo "[3/5] Building mhvtl..."
make
echo "[4/5] Installing mhvtl..."
make install
echo "[5/5] Configuring mhvtl..."
mkdir -p "$MHVTL_DIR"
mkdir -p "$MHVTL_CONFIG"
if [ ! -f "$MHVTL_CONFIG/device.conf" ]; then
cat > "$MHVTL_CONFIG/device.conf" << 'EOF'
VERSION: 5
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
Vendor identification: STK
Product identification: L700
Unit serial number: XYZZY_A
NAA: 10:22:33:44:ab:cd:ef:00
Home directory: /opt/mhvtl
Backoff: 400
Drive: 00 CHANNEL: 00 TARGET: 01 LUN: 00
Library ID: 10 Slot: 01
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A1
NAA: 10:22:33:44:ab:cd:ef:01
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 01 CHANNEL: 00 TARGET: 02 LUN: 00
Library ID: 10 Slot: 02
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A2
NAA: 10:22:33:44:ab:cd:ef:02
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 02 CHANNEL: 00 TARGET: 03 LUN: 00
Library ID: 10 Slot: 03
Vendor identification: IBM
Product identification: ULT3580-TD6
Unit serial number: XYZZY_A3
NAA: 10:22:33:44:ab:cd:ef:03
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 03 CHANNEL: 00 TARGET: 04 LUN: 00
Library ID: 10 Slot: 04
Vendor identification: IBM
Product identification: ULT3580-TD6
Unit serial number: XYZZY_A4
NAA: 10:22:33:44:ab:cd:ef:04
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
EOF
fi
if [ ! -f "$MHVTL_CONFIG/library_contents.10" ]; then
/usr/bin/mktape -l 10 -s 100 -m /opt/mhvtl -t LTO5 -d 20
fi
modprobe mhvtl
systemctl daemon-reload
systemctl enable mhvtl
systemctl start mhvtl
echo ""
echo "=========================================="
echo " mhvtl Installation Complete!"
echo "=========================================="
echo ""
echo "Configuration:"
echo " - Config directory: $MHVTL_CONFIG"
echo " - Data directory: $MHVTL_DIR"
echo " - Library: STK L700 (ID: 10)"
echo " - Drives: 4x LTO-5/6 drives"
echo " - Media: 20 LTO-5 tapes"
echo ""
echo "Check status:"
echo " systemctl status mhvtl"
echo " lsscsi -g"
echo " mtx -f /dev/sg0 status"
echo ""