Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37664084
en ru br
Репозитории ALT
S:2.1.9-alt1
D:2.0.869.2-alt0.1
5.1: 2.0.871-alt3
4.1: 2.0.730-alt2
4.0: 2.0.730-alt2
www.altlinux.org/Changes

Группа :: Система/Ядро и оборудование
Пакет: open-iscsi

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

#!/bin/bash
#
# /sbin/iscsi-gen-initiatorname
#
# Generate a default iSCSI Initiatorname for ALT installations.
#
# Copyright (c) 2007 Hannes Reinecke, SUSE Linux Products GmbH.
# All rights reserved.
#

if [ "$1" ] ; then
if [ "$1" = "-f" ] ; then
FORCE=1
else
echo "Invalid option $1"
echo "Usage: $0 [-f]"
exit 1
fi
fi

if [ -d /sys/firmware/ibft/initiator ] ; then
read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator/initiator-name
fi

if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
if [ "$iSCSI_INITIATOR_NAME" ] ; then
eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d')
if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then
echo "iSCSI Initiatorname from iBFT is different from the current setting."
echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname."
exit 1
fi
fi
fi

if [ "$iSCSI_INITIATOR_NAME" ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## iSCSI Initiatorname taken from iBFT BIOS tables.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## Any change here will not be reflected to the iBFT BIOS tables.
## If a different initiatorname is required please change the
## initiatorname in the BIOS setup and call
## /sbin/iscsi-gen-initiatorname -f
## to recreate an updated version of this file.
##
InitiatorName=$iSCSI_INITIATOR_NAME
EOF
fi

if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## Default iSCSI Initiatorname.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
EOF
ISSUEDATE=$(date +%F)
INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.ua.alt:01)
printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi
chmod 0600 /etc/iscsi/initiatorname.iscsi
fi

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin