aur/open-iscsi to 2.0.873-3

This commit is contained in:
Kevin Mihelich 2012-05-30 16:52:47 -04:00
parent cac26491c5
commit 6ae7179662
3 changed files with 77 additions and 68 deletions

View file

@ -1,29 +1,27 @@
# Maintainer: Stefan Kirrmann <stefan.kirrmann at gmail dot com>
plugrel=1
pkgname=open-iscsi
pkgver=2.0.872
_pkgver=2.0-872
pkgrel=2
pkgver=2.0.873
_pkgver=2.0-873
pkgrel=3
pkgdesc="userland tools"
arch=('i686' 'x86_64')
url="http://www.open-iscsi.org"
license=('GPL')
depends=('bash')
install="${pkgname}.install"
install=$pkgname.install
backup=('etc/iscsi/iscsid.conf' 'etc/iscsi/initiatorname.iscsi' 'etc/conf.d/open-iscsi')
source=("http://www.open-iscsi.org/bits/${pkgname}-${_pkgver}.tar.gz" \
"open-iscsi" "open-iscsi.conf.d")
options=('docs')
sha256sums=('37753697a170223ac02a292b3a23a315a3c747b490c42480e4057b676c9f8d4f'
'817791c59d1c271ad5eb78a7609e4fa081cf9414f3d7ac26df897b9327286c23'
sha256sums=('7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9'
'649536c4abc9c4d9f994cc1c0033449d46c120b73a836854a228f7e103711314'
'289ba27b72a3bd9d251e08b3d61dd3ae2f6ad545e5ffe2edaa2b79638996654c')
build() {
cd ${srcdir}/${pkgname}-${_pkgver}
# include iscsistart program in the package
# include iscsistart in the package
sed -i -e '/^PROGRAMS = /s/$/ usr\/iscsistart/' Makefile
# build breaks if the openslp package is installed
@ -35,6 +33,8 @@ build() {
install -D -m755 ${srcdir}/open-iscsi ${pkgdir}/etc/rc.d/open-iscsi
install -D -m644 ${srcdir}/open-iscsi.conf.d ${pkgdir}/etc/conf.d/open-iscsi
install -D -m644 ${srcdir}/${pkgname}-${_pkgver}/etc/iscsid.conf ${pkgdir}/etc/iscsi
touch ${pkgdir}/etc/iscsi/initiatorname.iscsi
# copy docs
mkdir -p ${pkgdir}/usr/share/doc/${pkgname}

View file

@ -11,17 +11,14 @@
[ -z "$SEC_BEFORE_MOUNT" ] && SEC_BEFORE_MOUNT=2
[ -z "$ISCSIADM_EXTRAARGS" ] && ISCSIADM_EXTRAARGS=""
DAEMON_NAME="open-iscsi"
ISCSIADM=/sbin/iscsiadm
PIDFILE=/var/run/iscsid.pid
case "$1" in
start)
if [ "$SERVER" == "" ]; then
echo "Please configure \$SERVER in /etc/conf.d/open-iscsi!"
stat_fail
exit 1
fi
modprobe -q iscsi_tcp &>/dev/null
modprobe -q ib_iser &>/dev/null
stat_busy "Starting Open-iSCSI daemon"
/sbin/iscsid ${ISCSID_ARGS}
if [ $? -ne 0 ]; then
@ -32,40 +29,42 @@ case "$1" in
stat_done
fi
stat_busy "Discovering targets"
/sbin/iscsiadm -m discovery -t sendtargets -p $SERVER $ISCSIADM_EXTRAARGS > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 3
else
stat_done
fi
if [ -n "$SERVER" ]; then
stat_busy "Discovering targets"
$ISCSIADM -m discovery -t sendtargets -p $SERVER $ISCSIADM_EXTRAARGS > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 3
else
stat_done
fi
stat_busy "Login to all portals"
/sbin/iscsiadm -m node -L all > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 4
else
stat_done
fi
stat_busy "Login to all portals"
$ISCSIADM -m node -L all > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 4
else
stat_done
fi
if [[ "$MOUNT" != "" ]]; then
# wait n seconds to settle
sleep $SEC_BEFORE_MOUNT
status "Mounting devices"
for MTPT in ${MOUNT[@]}; do
stat_busy "mounting $MTPT"
mount $MTPT
sleep 1
if [ $? -eq 0 ]; then
stat_done
else
stat_fail
fi
done
else
status "No devices to mount defined"
if [[ "$MOUNT" != "" ]]; then
# wait n seconds to settle
sleep $SEC_BEFORE_MOUNT
status "Mounting devices"
for MTPT in ${MOUNT[@]}; do
stat_busy "mounting $MTPT"
mount $MTPT
sleep 1
if [ $? -eq 0 ]; then
stat_done
else
stat_fail
fi
done
else
status "No devices to mount defined"
fi
fi
;;
stop)
@ -78,7 +77,7 @@ case "$1" in
UMOUNT="$UMOUNT ${MOUNT[$LEN]}";
done
for MTPT in $UMOUNT; do
MOUNTED=$(mount|grep -c `/bin/readlink -mns $MTPT`)
MOUNTED=$(mount|grep -c `/usr/bin/readlink -mns $MTPT`)
if [ $MOUNTED -ne 0 ]; then
stat_busy "unmounting $MTPT"
umount $MTPT
@ -98,21 +97,24 @@ case "$1" in
status "No devices to unmount defined"
fi
stat_busy "Logout to all portals"
/sbin/iscsiadm -m node -U all > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 6
else
stat_done
$ISCSIADM -m session $> /dev/null
if [ $? -eq 0 ]; then
stat_busy "Logout to all portals"
$ISCSIADM -m node -U all > /dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 6
else
stat_done
fi
fi
stat_busy "Stopping Open-iSCSI daemon"
[ -f /var/run/iscsid.pid ] && kill -9 `cat /var/run/iscsid.pid` &> /dev/null
[ -f $PIDFILE ] && kill -9 `cat $PIDFILE` &> /dev/null
if [ $? -ne 0 ]; then
stat_fail
else
rm -f /var/run/iscsid.pid
rm -f $PIDFILE
killall iscsid > /dev/null
rm_daemon $DAEMON_NAME
stat_done
@ -137,7 +139,7 @@ case "$1" in
ck_daemon $DAEMON_NAME
status "Detailed session info"
echo
/sbin/iscsiadm -m session -P 2
$ISCSIADM -m session -P 2
echo
;;
restart)

View file

@ -1,12 +1,19 @@
## arg 1: the new package version
post_install() {
echo
echo "The open-iscsi package contains the userland tools of the"
echo "Open-iSCSI project. It depends on iSCSI modules which are already"
echo "present in current (>= 2.6.16) kernels and must be present on"
echo "your system or statically compiled inside your kernel image."
echo
echo ">>> Setting Initiatorname ..."
echo "InitiatorName=$(iscsi-iname)" > /etc/iscsi/initiatorname.iscsi
echo
if [ -z $(</etc/iscsi/initiatorname.iscsi) ]; then
name=$(iscsi-iname)
echo
echo ">>> Setting Initiatorname '$name'"
echo "InitiatorName=$name" > /etc/iscsi/initiatorname.iscsi
fi
echo
echo "Configure /etc/conf.d/open-iscsi to enable:"
echo " - portal discovery"
echo " - automatic login to available targets"
echo " - automount of targets"
echo
}
post_upgrade() {
post_install
}