- renamed init script to fcoe (#497604)
- init script condrestart fixed - fixed issue with accepting long options (#498551)
This commit is contained in:
parent
5af7502deb
commit
c30f31436b
20
fcoe-utils-1.0.7-init-condrestart.patch
Normal file
20
fcoe-utils-1.0.7-init-condrestart.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
--- fcoe-utils-1.0.7/etc/initd/initd.fedora 2009-03-27 21:40:22.000000000 +0100
|
||||||
|
+++ fcoe-utils-1.0.7/etc/initd/initd.fedora.update 2009-04-03 09:54:39.000000000 +0200
|
||||||
|
service_status()
|
||||||
|
@@ -243,6 +243,8 @@ service_status()
|
||||||
|
else
|
||||||
|
echo "Created interfaces: $IF_LIST"
|
||||||
|
fi
|
||||||
|
+ test -f /var/lock/subsys/fcoe
|
||||||
|
+ return $@
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
@@ -282,6 +284,7 @@ case "$1" in
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
service_status
|
||||||
|
+ exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
@ -25,7 +25,7 @@
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
+ echo
|
+ echo
|
||||||
+ touch /var/lock/subsys/fcoe-utils
|
+ touch /var/lock/subsys/fcoe
|
||||||
+
|
+
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@
|
|||||||
done
|
done
|
||||||
rm -f /var/run/fcoemon.*
|
rm -f /var/run/fcoemon.*
|
||||||
rm -f /tmp/fcoemon.dcbd.*
|
rm -f /tmp/fcoemon.dcbd.*
|
||||||
+ rm -f /var/lock/subsys/fcoe-utils
|
+ rm -f /var/lock/subsys/fcoe
|
||||||
}
|
}
|
||||||
|
|
||||||
service_status()
|
service_status()
|
||||||
|
199
fcoe-utils-1.0.7-longOpts.patch
Normal file
199
fcoe-utils-1.0.7-longOpts.patch
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
--- fcoe-utils-1.0.7/fcoeadm.c 2009-05-04 11:29:00.000000000 +0200
|
||||||
|
+++ fcoe-utils-1.0.7/fcoeadm.c.longOptions 2009-05-11 13:57:22.000000000 +0200
|
||||||
|
@@ -7,7 +7,7 @@
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
@@ -38,19 +38,19 @@ Copyright (c) 2009, Intel Corporation.\n
|
||||||
|
#define FCOE_CREATE SYSFS_FCOE "/create"
|
||||||
|
#define FCOE_DESTROY SYSFS_FCOE "/destroy"
|
||||||
|
|
||||||
|
-#define FCHOSTBUFLEN 64
|
||||||
|
+#define FCHOSTBUFLEN 64
|
||||||
|
|
||||||
|
static struct option fcoeadm_opts[] = {
|
||||||
|
- {"create", 1, 0, 'c'},
|
||||||
|
- {"destroy", 1, 0, 'd'},
|
||||||
|
- {"reset", 1, 0, 'r'},
|
||||||
|
- {"interface", 1, 0, 'a'},
|
||||||
|
- {"target", 1, 0, 't'},
|
||||||
|
- {"lun", 1, 0, 'l'},
|
||||||
|
- {"stats", 1, 0, 's'},
|
||||||
|
- {"help", 0, 0, 'h'},
|
||||||
|
- {"version", 0, 0, 'v'},
|
||||||
|
- {0, 0, 0, 0}
|
||||||
|
+ {"create", 1, 0, 'c'},
|
||||||
|
+ {"destroy", 1, 0, 'd'},
|
||||||
|
+ {"reset", 1, 0, 'r'},
|
||||||
|
+ {"interface", 1, 0, 'i'},
|
||||||
|
+ {"target", 1, 0, 't'},
|
||||||
|
+ {"lun", 1, 0, 'l'},
|
||||||
|
+ {"stats", 1, 0, 's'},
|
||||||
|
+ {"help", 0, 0, 'h'},
|
||||||
|
+ {"version", 0, 0, 'v'},
|
||||||
|
+ {0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct opt_info _opt_info, *opt_info = &_opt_info;
|
||||||
|
@@ -230,7 +230,7 @@ fcoeadm_find_fchost(char *ifname, char *
|
||||||
|
while (n--) {
|
||||||
|
/* check symbolic name */
|
||||||
|
if (!fcoeadm_check_fchost(ifname,
|
||||||
|
- namelist[n]->d_name)) {
|
||||||
|
+ namelist[n]->d_name)) {
|
||||||
|
dname_len = strnlen(namelist[n]->d_name, len);
|
||||||
|
if (dname_len != len) {
|
||||||
|
/*
|
||||||
|
@@ -250,7 +250,7 @@ fcoeadm_find_fchost(char *ifname, char *
|
||||||
|
}
|
||||||
|
free(namelist[n]);
|
||||||
|
}
|
||||||
|
- free(namelist);
|
||||||
|
+ free(namelist);
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
@@ -320,7 +320,7 @@ fcoeadm_reset(char *ifname)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse a user-entered hex field.
|
||||||
|
- * Format may be xx-xx-xx OR xxxxxx OR xx:xx:xx for len bytes (up to 8).
|
||||||
|
+ * Format may be xx-xx-xx OR xxxxxx OR xx:xx:xx for len bytes (up to 8).
|
||||||
|
* Leading zeros may be omitted.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
@@ -444,49 +444,53 @@ int main(int argc, char *argv[])
|
||||||
|
memset(opt_info, 0, sizeof(*opt_info));
|
||||||
|
|
||||||
|
while ((opt = getopt_long(argc, argv, "c:d:r:itl:s:n:hv",
|
||||||
|
- fcoeadm_opts, NULL)) != -1) {
|
||||||
|
+ fcoeadm_opts, NULL)) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'c':
|
||||||
|
if ((argc < 2 || argc > 3) ||
|
||||||
|
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
|
||||||
|
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
|
||||||
|
+ argv[1][1] != '-'))
|
||||||
|
goto error;
|
||||||
|
rc = fcoeadm_create(optarg);
|
||||||
|
goto done;
|
||||||
|
case 'd':
|
||||||
|
if ((argc < 2 || argc > 3) ||
|
||||||
|
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
|
||||||
|
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
|
||||||
|
+ argv[1][1] != '-'))
|
||||||
|
goto error;
|
||||||
|
rc = fcoeadm_destroy(optarg);
|
||||||
|
goto done;
|
||||||
|
case 'r':
|
||||||
|
if ((argc < 2 || argc > 3) ||
|
||||||
|
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
|
||||||
|
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
|
||||||
|
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
|
||||||
|
+ argv[1][1] != '-'))
|
||||||
|
goto error;
|
||||||
|
rc = fcoeadm_reset(optarg);
|
||||||
|
goto done;
|
||||||
|
case 'i':
|
||||||
|
- if (argc < 2 || argc > 3)
|
||||||
|
+ if (argc < 2 || argc > 3 ||
|
||||||
|
+ (argc == 3 && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
|
||||||
|
+ (argv[1][1] != '-' || strchr(argv[1],'=') != NULL)))
|
||||||
|
goto error;
|
||||||
|
s = NULL;
|
||||||
|
- if (argc == 2 && argv[optind]) {
|
||||||
|
- if (strnlen(argv[optind], MAX_ARG_LEN) >
|
||||||
|
- (IFNAMSIZ - 1))
|
||||||
|
- goto error;
|
||||||
|
- if (strnlen(argv[optind], MAX_ARG_LEN) > 2)
|
||||||
|
- s = argv[optind] + 2;
|
||||||
|
+ if (argc == 2) {
|
||||||
|
+ if (argv[1][1] == '-')
|
||||||
|
+ s = strchr(argv[1],'=')+1;
|
||||||
|
+ else
|
||||||
|
+ s = argv[1]+2;
|
||||||
|
}
|
||||||
|
- if (argc == 3) {
|
||||||
|
- if ((optind == 1) &&
|
||||||
|
- strnlen(argv[1], MAX_ARG_LEN) > 2)
|
||||||
|
- goto error;
|
||||||
|
- s = argv[optind];
|
||||||
|
+ else {
|
||||||
|
+ s = argv[2];
|
||||||
|
}
|
||||||
|
- if (s)
|
||||||
|
+ if (s) {
|
||||||
|
+ if (strnlen(s,MAX_ARG_LEN) > (IFNAMSIZ - 1))
|
||||||
|
+ goto error;
|
||||||
|
strncpy(opt_info->ifname, s,
|
||||||
|
sizeof(opt_info->ifname));
|
||||||
|
+ }
|
||||||
|
if (strnlen(opt_info->ifname, IFNAMSIZ - 1)) {
|
||||||
|
if (fcoeadm_validate_interface(
|
||||||
|
opt_info->ifname,
|
||||||
|
@@ -497,21 +501,26 @@ int main(int argc, char *argv[])
|
||||||
|
rc = fcoeadm_display_adapter_info(opt_info);
|
||||||
|
goto done;
|
||||||
|
case 't':
|
||||||
|
- if ((argc < 2 || argc > 3) ||
|
||||||
|
- (argv[1] &&
|
||||||
|
- strnlen(argv[1], MAX_ARG_LEN) > (IFNAMSIZ - 1)) ||
|
||||||
|
- (argv[2] &&
|
||||||
|
- strnlen(argv[2], MAX_ARG_LEN) > (IFNAMSIZ - 1)))
|
||||||
|
+ if (argc < 2 || argc > 3 ||
|
||||||
|
+ (argc == 3 && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
|
||||||
|
+ (argv[1][1] != '-' || strchr(argv[1],'=') != NULL)))
|
||||||
|
goto error;
|
||||||
|
- if (strnlen(argv[1], MAX_ARG_LEN) > 2) {
|
||||||
|
- if (argc >= 3)
|
||||||
|
+ s = NULL;
|
||||||
|
+ if (argc == 2) {
|
||||||
|
+ if (argv[1][1] == '-')
|
||||||
|
+ s = strchr(argv[1],'=')+1;
|
||||||
|
+ else
|
||||||
|
+ s = argv[1]+2;
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ s = argv[2];
|
||||||
|
+ }
|
||||||
|
+ if (s) {
|
||||||
|
+ if (strnlen(s,MAX_ARG_LEN) > (IFNAMSIZ - 1))
|
||||||
|
goto error;
|
||||||
|
- strncpy(opt_info->ifname, argv[1] + 2,
|
||||||
|
+ strncpy(opt_info->ifname, s,
|
||||||
|
sizeof(opt_info->ifname));
|
||||||
|
}
|
||||||
|
- if (argv[2])
|
||||||
|
- strncpy(opt_info->ifname, argv[2],
|
||||||
|
- sizeof(opt_info->ifname));
|
||||||
|
if (strnlen(opt_info->ifname, IFNAMSIZ - 1)) {
|
||||||
|
if (fcoeadm_validate_interface(
|
||||||
|
opt_info->ifname,
|
||||||
|
@@ -538,7 +547,7 @@ int main(int argc, char *argv[])
|
||||||
|
goto done;
|
||||||
|
case 's':
|
||||||
|
if ((argc < 2 || argc > 5) ||
|
||||||
|
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1))
|
||||||
|
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1))
|
||||||
|
goto error;
|
||||||
|
if (optarg)
|
||||||
|
strncpy(opt_info->ifname, optarg,
|
||||||
|
@@ -560,7 +569,7 @@ int main(int argc, char *argv[])
|
||||||
|
if (opt_info->n_interval <= 0)
|
||||||
|
goto error;
|
||||||
|
if (argv[optind] &&
|
||||||
|
- strnlen(argv[optind], MAX_ARG_LEN<<1) > MAX_ARG_LEN)
|
||||||
|
+ strnlen(argv[optind], MAX_ARG_LEN<<1) > MAX_ARG_LEN)
|
||||||
|
goto error;
|
||||||
|
opt_info->n_flag = 1;
|
||||||
|
goto stats;
|
@ -1,6 +1,6 @@
|
|||||||
Name: fcoe-utils
|
Name: fcoe-utils
|
||||||
Version: 1.0.7
|
Version: 1.0.7
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: Fibre Channel over Ethernet utilities
|
Summary: Fibre Channel over Ethernet utilities
|
||||||
|
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -9,6 +9,8 @@ URL: http://www.open-fcoe.org
|
|||||||
Source0: http://www.open-fcoe.org/openfc/downloads/%{name}-%{version}.tar.gz
|
Source0: http://www.open-fcoe.org/openfc/downloads/%{name}-%{version}.tar.gz
|
||||||
Patch0: fcoe-utils-1.0.7-init.patch
|
Patch0: fcoe-utils-1.0.7-init.patch
|
||||||
Patch1: fcoe-utils-1.0.7-free.patch
|
Patch1: fcoe-utils-1.0.7-free.patch
|
||||||
|
Patch2: fcoe-utils-1.0.7-init-condrestart.patch
|
||||||
|
Patch3: fcoe-utils-1.0.7-longOpts.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
BuildRequires: libhbaapi-devel dcbd-devel
|
BuildRequires: libhbaapi-devel dcbd-devel
|
||||||
@ -26,6 +28,8 @@ fcoemon - service to configure DCB Ethernet QOS filters, works with dcbd
|
|||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1 -b .initPatch
|
%patch0 -p1 -b .initPatch
|
||||||
%patch1 -p1 -b .freePatch
|
%patch1 -p1 -b .freePatch
|
||||||
|
%patch2 -p1 -b .condrestartPatch
|
||||||
|
%patch3 -p1 -b .longOpts
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -37,7 +41,7 @@ make %{?_smp_mflags}
|
|||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
make install DESTDIR=$RPM_BUILD_ROOT
|
make install DESTDIR=$RPM_BUILD_ROOT
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
|
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
|
||||||
mv $RPM_BUILD_ROOT/etc/init.d/fcoe $RPM_BUILD_ROOT%{_initrddir}/fcoe-utils
|
mv $RPM_BUILD_ROOT/etc/init.d/fcoe $RPM_BUILD_ROOT%{_initrddir}/fcoe
|
||||||
rm -rf $RPM_BUILD_ROOT/etc/init.d
|
rm -rf $RPM_BUILD_ROOT/etc/init.d
|
||||||
|
|
||||||
|
|
||||||
@ -46,17 +50,30 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/sbin/chkconfig --add fcoe-utils
|
/sbin/chkconfig --add fcoe
|
||||||
|
|
||||||
|
%triggerun -- fcoe-utils <= 1.0.7-5
|
||||||
|
if [ -x %{_initrddir}/fcoe-utils ]; then
|
||||||
|
/sbin/service fcoe-utils stop > /dev/null 2>&1
|
||||||
|
/sbin/chkconfig fcoe-utils off
|
||||||
|
# now copy an updated file, which we need to do proper condrestart
|
||||||
|
sed 's/\/var\/lock\/subsys\/fcoe/\/var\/lock\/subsys\/fcoe-utils/' %{_initrddir}/fcoe > %{_initrddir}/fcoe-utils
|
||||||
|
fi
|
||||||
|
|
||||||
|
%triggerpostun -- fcoe-utils <= 1.0.7-5
|
||||||
|
if [ -x %{_initrddir}/fcoe-utils ]; then
|
||||||
|
rm -f %{_initrddir}/fcoe-utils # this file should be already deleted, but just in case ...
|
||||||
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 = 0 ]; then
|
||||||
/sbin/service fcoe-utils stop > /dev/null 2>&1
|
/sbin/service fcoe stop > /dev/null 2>&1
|
||||||
/sbin/chkconfig --del fcoe-utils
|
/sbin/chkconfig --del fcoe
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
if [ "$1" -ge "1" ]; then
|
if [ "$1" -ge "1" ]; then
|
||||||
/sbin/service fcoe-utils condrestart > /dev/null 2>&1 || :
|
/sbin/service fcoe condrestart > /dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -70,11 +87,19 @@ fi
|
|||||||
%dir %{_sysconfdir}/fcoe/scripts/
|
%dir %{_sysconfdir}/fcoe/scripts/
|
||||||
%config(noreplace) %{_sysconfdir}/fcoe/config
|
%config(noreplace) %{_sysconfdir}/fcoe/config
|
||||||
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
|
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
|
||||||
%{_initrddir}/fcoe-utils
|
%{_initrddir}/fcoe
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed May 4 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.7-5
|
* Thu May 14 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.7-6
|
||||||
|
- renamed init script to fcoe, changed lock filename to fcoe
|
||||||
|
(#497604)
|
||||||
|
- init script modified to do condrestart properly
|
||||||
|
- some modifications in spec file to apply previous change
|
||||||
|
to older versions od init script during update
|
||||||
|
- fixed issue with accepting long options (#498551)
|
||||||
|
|
||||||
|
* Mon May 4 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.7-5
|
||||||
- fixed SIGSEGV when fcoe module isn't loaded (#498550)
|
- fixed SIGSEGV when fcoe module isn't loaded (#498550)
|
||||||
|
|
||||||
* Wed Apr 27 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.7-4
|
* Wed Apr 27 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.7-4
|
||||||
|
Loading…
Reference in New Issue
Block a user