Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37492250
en ru br
ALT Linux repositórios
S:2.1.9-alt1
D:2.0.869.2-alt0.1
5.0: 2.0.870.3-alt1
4.1: 2.0.730-alt2
4.0: 2.0.730-alt2

Group :: Sistema/Kernel e hardware
RPM: open-iscsi

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e 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

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009