feat: Add complete iSCSI target management to Web UI- Add iSCSI tab with full target management- Implement create/delete targets with auto-generated IQN- Add LUN (backing store) management- Implement initiator ACL management (bind/unbind)- Add real-time target listing with LUN/ACL counts- Add comprehensive iSCSI management guide- Update sudoers to allow tgtadm commands- Add tape management features (create/list/delete/bulk delete)- Add service status monitoring- Security: Input validation, path security, sudo restrictions- Tested: Full CRUD operations working- Package size: 29KB, production ready
This commit is contained in:
114
dist/adastra-vtl-installer/scripts/post-install.sh
vendored
Executable file
114
dist/adastra-vtl-installer/scripts/post-install.sh
vendored
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "=========================================="
|
||||
echo " VTL Linux Post-Install Setup"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Error: This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[1/5] Applying system optimizations..."
|
||||
if [ -f "/tmp/sysctl-vtl.conf" ]; then
|
||||
cp /tmp/sysctl-vtl.conf /etc/sysctl.d/99-vtl.conf
|
||||
sysctl -p /etc/sysctl.d/99-vtl.conf
|
||||
fi
|
||||
|
||||
echo "[2/5] Installing mhvtl..."
|
||||
if [ -f "/usr/local/bin/install-mhvtl.sh" ]; then
|
||||
bash /usr/local/bin/install-mhvtl.sh
|
||||
else
|
||||
echo "Warning: mhvtl installation script not found"
|
||||
fi
|
||||
|
||||
echo "[3/5] Configuring iSCSI targets..."
|
||||
if [ -f "/usr/local/bin/configure-iscsi.sh" ]; then
|
||||
bash /usr/local/bin/configure-iscsi.sh
|
||||
else
|
||||
echo "Warning: iSCSI configuration script not found"
|
||||
fi
|
||||
|
||||
echo "[4/5] Setting up monitoring..."
|
||||
cat > /usr/local/bin/vtl-status << 'EOF'
|
||||
#!/bin/bash
|
||||
|
||||
echo "=========================================="
|
||||
echo " VTL System Status"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
echo "=== mhvtl Status ==="
|
||||
systemctl status mhvtl --no-pager | head -n 10
|
||||
echo ""
|
||||
|
||||
echo "=== SCSI Devices ==="
|
||||
lsscsi -g
|
||||
echo ""
|
||||
|
||||
echo "=== Library Status ==="
|
||||
if [ -e /dev/sg0 ]; then
|
||||
mtx -f /dev/sg0 status 2>/dev/null || echo "Library not ready"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "=== iSCSI Targets ==="
|
||||
tgt-admin --show
|
||||
echo ""
|
||||
|
||||
echo "=== Network Interfaces ==="
|
||||
ip -br addr
|
||||
echo ""
|
||||
|
||||
echo "=== Disk Usage ==="
|
||||
df -h /opt/mhvtl 2>/dev/null || echo "/opt/mhvtl not mounted"
|
||||
echo ""
|
||||
EOF
|
||||
|
||||
chmod +x /usr/local/bin/vtl-status
|
||||
|
||||
echo "[5/5] Creating welcome message..."
|
||||
cat > /etc/motd << 'EOF'
|
||||
|
||||
__ _______ _ _ _
|
||||
\ \ / /_ _| | | | (_)
|
||||
\ \ / / | | | | | | _ _ __ _ ___ __
|
||||
\ \/ / | | | | | | | | '_ \| | | \ \/ /
|
||||
\ / _| |_| |____ | |___| | | | | |_| |> <
|
||||
\/ |_____|______||_____|_|_| |_|\__,_/_/\_\
|
||||
|
||||
Virtual Tape Library Distribution v1.0
|
||||
|
||||
========================================
|
||||
Quick Commands:
|
||||
vtl-status - Show VTL system status
|
||||
systemctl status mhvtl - Check mhvtl service
|
||||
lsscsi -g - List SCSI devices
|
||||
tgt-admin --show - Show iSCSI targets
|
||||
|
||||
Default Credentials:
|
||||
User: vtladmin / Password: vtladmin
|
||||
Root: root / Password: vtlroot
|
||||
|
||||
iSCSI Authentication:
|
||||
Username: vtl-user
|
||||
Password: vtl-password
|
||||
========================================
|
||||
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " Post-Install Setup Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Configure network settings"
|
||||
echo " 2. Change default passwords"
|
||||
echo " 3. Customize mhvtl configuration in /etc/mhvtl/"
|
||||
echo " 4. Update iSCSI targets in /etc/tgt/conf.d/"
|
||||
echo " 5. Run 'vtl-status' to verify setup"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user