update installer script
Some checks failed
CI / test-build (push) Failing after 2m16s

This commit is contained in:
2025-12-15 01:32:41 +07:00
parent 921e7219ab
commit 7ac7e77f1d
3 changed files with 37 additions and 7 deletions

View File

@@ -80,13 +80,15 @@ sudo apt-get install -y \
zfsutils-linux \
samba \
nfs-kernel-server \
targetcli \
targetcli-fb \
sqlite3 \
golang-go \
git \
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
```bash

View File

@@ -95,11 +95,18 @@ install_dependencies() {
case $DISTRO in
ubuntu|debian)
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 \
zfsutils-linux \
samba \
nfs-kernel-server \
targetcli \
$TARGETCLI_PKG \
sqlite3 \
golang-go \
git \
@@ -138,7 +145,7 @@ install_dependencies() {
echo " - ZFS utilities"
echo " - Samba (SMB/CIFS)"
echo " - NFS server"
echo " - targetcli (iSCSI)"
echo " - targetcli or targetcli-fb (iSCSI)"
echo " - SQLite"
echo " - Go compiler"
echo " - Build tools"
@@ -363,15 +370,28 @@ setup_nfs() {
setup_iscsi() {
echo -e "${GREEN}Setting up iSCSI...${NC}"
if ! command -v targetcli &> /dev/null; then
echo -e "${YELLOW}Warning: targetcli not found${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
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
fi
# Enable and start iSCSI target (if not already)
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

View File

@@ -17,8 +17,16 @@ type ISCSIService struct {
// NewISCSIService creates a new iSCSI service manager
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{
targetcliPath: "targetcli",
targetcliPath: targetcliPath,
}
}