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

View file

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

View file

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