This commit is contained in:
@@ -80,13 +80,15 @@ sudo apt-get install -y \
|
|||||||
zfsutils-linux \
|
zfsutils-linux \
|
||||||
samba \
|
samba \
|
||||||
nfs-kernel-server \
|
nfs-kernel-server \
|
||||||
targetcli \
|
targetcli-fb \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
golang-go \
|
golang-go \
|
||||||
git \
|
git \
|
||||||
build-essential
|
build-essential
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** On newer Ubuntu/Debian versions, the iSCSI target CLI is packaged as `targetcli-fb`. If `targetcli-fb` is not available, try `targetcli`.
|
||||||
|
|
||||||
#### Fedora/RHEL/CentOS
|
#### Fedora/RHEL/CentOS
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
28
install.sh
28
install.sh
@@ -95,11 +95,18 @@ install_dependencies() {
|
|||||||
case $DISTRO in
|
case $DISTRO in
|
||||||
ubuntu|debian)
|
ubuntu|debian)
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
# Try targetcli-fb first (common on newer Ubuntu/Debian), fallback to targetcli
|
||||||
|
TARGETCLI_PKG="targetcli-fb"
|
||||||
|
if ! apt-cache show targetcli-fb &>/dev/null; then
|
||||||
|
TARGETCLI_PKG="targetcli"
|
||||||
|
fi
|
||||||
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
zfsutils-linux \
|
zfsutils-linux \
|
||||||
samba \
|
samba \
|
||||||
nfs-kernel-server \
|
nfs-kernel-server \
|
||||||
targetcli \
|
$TARGETCLI_PKG \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
golang-go \
|
golang-go \
|
||||||
git \
|
git \
|
||||||
@@ -138,7 +145,7 @@ install_dependencies() {
|
|||||||
echo " - ZFS utilities"
|
echo " - ZFS utilities"
|
||||||
echo " - Samba (SMB/CIFS)"
|
echo " - Samba (SMB/CIFS)"
|
||||||
echo " - NFS server"
|
echo " - NFS server"
|
||||||
echo " - targetcli (iSCSI)"
|
echo " - targetcli or targetcli-fb (iSCSI)"
|
||||||
echo " - SQLite"
|
echo " - SQLite"
|
||||||
echo " - Go compiler"
|
echo " - Go compiler"
|
||||||
echo " - Build tools"
|
echo " - Build tools"
|
||||||
@@ -363,15 +370,28 @@ setup_nfs() {
|
|||||||
setup_iscsi() {
|
setup_iscsi() {
|
||||||
echo -e "${GREEN}Setting up iSCSI...${NC}"
|
echo -e "${GREEN}Setting up iSCSI...${NC}"
|
||||||
|
|
||||||
|
# Check for targetcli or targetcli-fb
|
||||||
|
TARGETCLI_CMD=""
|
||||||
|
if command -v targetcli &> /dev/null; then
|
||||||
|
TARGETCLI_CMD="targetcli"
|
||||||
|
elif command -v targetcli-fb &> /dev/null; then
|
||||||
|
TARGETCLI_CMD="targetcli-fb"
|
||||||
|
# Create symlink if targetcli doesn't exist
|
||||||
if ! command -v targetcli &> /dev/null; then
|
if ! command -v targetcli &> /dev/null; then
|
||||||
echo -e "${YELLOW}Warning: targetcli not found${NC}"
|
ln -s $(which targetcli-fb) /usr/local/bin/targetcli 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$TARGETCLI_CMD" ]]; then
|
||||||
|
echo -e "${YELLOW}Warning: targetcli or targetcli-fb not found${NC}"
|
||||||
|
echo " Install with: apt-get install targetcli-fb (Ubuntu/Debian)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable and start iSCSI target (if not already)
|
# Enable and start iSCSI target (if not already)
|
||||||
systemctl enable target 2>/dev/null || true
|
systemctl enable target 2>/dev/null || true
|
||||||
|
|
||||||
echo -e "${GREEN}iSCSI setup complete${NC}"
|
echo -e "${GREEN}iSCSI setup complete (using $TARGETCLI_CMD)${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create initial admin user
|
# Create initial admin user
|
||||||
|
|||||||
@@ -17,8 +17,16 @@ type ISCSIService struct {
|
|||||||
|
|
||||||
// NewISCSIService creates a new iSCSI service manager
|
// NewISCSIService creates a new iSCSI service manager
|
||||||
func NewISCSIService() *ISCSIService {
|
func NewISCSIService() *ISCSIService {
|
||||||
|
// Try targetcli first, fallback to targetcli-fb
|
||||||
|
targetcliPath := "targetcli"
|
||||||
|
if _, err := exec.LookPath("targetcli"); err != nil {
|
||||||
|
if _, err := exec.LookPath("targetcli-fb"); err == nil {
|
||||||
|
targetcliPath = "targetcli-fb"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &ISCSIService{
|
return &ISCSIService{
|
||||||
targetcliPath: "targetcli",
|
targetcliPath: targetcliPath,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user