Группа :: Система/Ядро и оборудование
Пакет: modutils
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: modutils-2.4.26-alt-kernelversion.patch
diff -uprk.orig modutils-2.4.26.orig/insmod/kernelversion modutils-2.4.26/insmod/kernelversion
--- modutils-2.4.26.orig/insmod/kernelversion 2001-01-05 04:45:19 +0300
+++ modutils-2.4.26/insmod/kernelversion 2004-02-18 16:09:30 +0300
@@ -8,14 +8,14 @@ pick1() {
eval 'echo $'"$pick_index"
}
pick() {
- OLD_IFS=IFS
+ local OLD_IFS="$IFS"
local delimiter="$1"
shift
pick_index="$1"
shift
IFS=" "$delimiter
pick1 $*
- IFS=$OLD_IFS
+ IFS="$OLD_IFS"
unset pick_index
}
diff -uprk.orig modutils-2.4.26.orig/insmod/kernelversion_major modutils-2.4.26/insmod/kernelversion_major
--- modutils-2.4.26.orig/insmod/kernelversion_major 1970-01-01 03:00:00 +0300
+++ modutils-2.4.26/insmod/kernelversion_major 2004-02-18 16:09:15 +0300
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Small script to get the kernel major version
+# Made by Dmitry V. Levin for the ALT Linux modutils package.
+# Based on the kernelversion script from modutils package.
+# Helper functions from Bruce Perens to replace cut
+
+pick1() {
+ eval 'echo $'"$pick_index"
+}
+pick() {
+ local OLD_IFS="$IFS"
+ local delimiter="$1"
+ shift
+ pick_index="$1"
+ shift
+ IFS=" "$delimiter
+ pick1 $*
+ IFS="$OLD_IFS"
+ unset pick_index
+}
+
+version=$(uname -r)
+echo `pick . 1 $version`
diff -uprk.orig modutils-2.4.26.orig/insmod/kernelversion_minor modutils-2.4.26/insmod/kernelversion_minor
--- modutils-2.4.26.orig/insmod/kernelversion_minor 1970-01-01 03:00:00 +0300
+++ modutils-2.4.26/insmod/kernelversion_minor 2004-02-18 16:09:21 +0300
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Small script to get the kernel minor version
+# Made by Dmitry V. Levin for the ALT Linux modutils package.
+# Based on the kernelversion script from modutils package.
+# Helper functions from Bruce Perens to replace cut
+
+pick1() {
+ eval 'echo $'"$pick_index"
+}
+pick() {
+ local OLD_IFS="$IFS"
+ local delimiter="$1"
+ shift
+ pick_index="$1"
+ shift
+ IFS=" "$delimiter
+ pick1 $*
+ IFS="$OLD_IFS"
+ unset pick_index
+}
+
+version=$(uname -r)
+echo `pick . 2 $version`
diff -uprk.orig modutils-2.4.26.orig/insmod/Makefile.in modutils-2.4.26/insmod/Makefile.in
--- modutils-2.4.26.orig/insmod/Makefile.in 2003-10-27 07:42:07 +0300
+++ modutils-2.4.26/insmod/Makefile.in 2004-02-18 16:07:40 +0300
@@ -126,7 +126,7 @@ install install-bin: all
$(MKDIR) $(DESTDIR)$(sbindir); \
$(INSTALL) $(STRIP) $$i $(DESTDIR)$(sbindir); done;
set -e; \
- for i in $(srcdir)/insmod_ksymoops_clean $(srcdir)/kernelversion; do \
+ for i in $(srcdir)/insmod_ksymoops_clean $(srcdir)/kernelversion{,_major,_minor}; do \
$(MKDIR) $(DESTDIR)$(sbindir); \
$(INSTALL) $$i $(DESTDIR)$(sbindir); done;
set -e; \
diff -uprk.orig modutils-2.4.26.orig/util/meta_expand.c modutils-2.4.26/util/meta_expand.c
--- modutils-2.4.26.orig/util/meta_expand.c 2001-01-05 04:45:19 +0300
+++ modutils-2.4.26/util/meta_expand.c 2004-02-18 16:07:40 +0300
@@ -174,6 +174,8 @@ int meta_expand(char *pt, GLOB_LIST *g,
if ((p = strchr(pt, '`')) != NULL && (type & ME_BUILTIN_COMMAND)) {
do {
char *s;
+ const char kv_maj[] = "kernelversion_major";
+ const char kv_min[] = "kernelversion_minor";
for (s = p + 1; isspace(*s); ++s)
;
@@ -191,6 +193,57 @@ int meta_expand(char *pt, GLOB_LIST *g,
}
strcpy(tmpline, wrk); /* safe, same size */
pt = tmpline;
+ } else if (strncmp(s, kv_maj, sizeof(kv_maj)-1) == 0) {
+ while (*s && (*s != '`'))
+ ++s;
+ if (*s == '`') {
+ const char *k;
+
+ *p = '\0';
+ for (k = version; *k; ++k) {
+ if (*k == '.')
+ break;
+ }
+ snprintf(wrk, sizeof(wrk), "%s%.*s%s",
+ pt,
+ /* typecast for Alpha */
+ (int)(k - version),
+ version,
+ s + 1);
+ *p = '`';
+ strcpy(tmpline, wrk); /* safe, same size */
+ pt = tmpline;
+ }
+ } else if (strncmp(s, kv_min, sizeof(kv_min)-1) == 0) {
+ while (*s && (*s != '`'))
+ ++s;
+ if (*s == '`') {
+ const char *k, *v = 0;
+
+ *p = '\0';
+ for (k = version; *k; ++k) {
+ if (*k == '.') {
+ v = ++k;
+ break;
+ }
+ }
+ if (v)
+ for (; *k; ++k) {
+ if (*k == '.')
+ break;
+ }
+ else
+ v = k;
+ snprintf(wrk, sizeof(wrk), "%s%.*s%s",
+ pt,
+ /* typecast for Alpha */
+ (int)(k - v),
+ v,
+ s + 1);
+ *p = '`';
+ strcpy(tmpline, wrk); /* safe, same size */
+ pt = tmpline;
+ }
} else if (strncmp(s, "kernelversion", 13) == 0) {
while (*s && (*s != '`'))
++s;