]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
RedHat: Avoid the DKMS escaping silliness
authorAndrew Deason <adeason@sinenomine.net>
Tue, 25 Sep 2012 16:16:35 +0000 (11:16 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 1 Oct 2012 18:34:58 +0000 (11:34 -0700)
Depending on the version of DKMS, the current MAKE[0] variable in the
dkms.conf needs different numbers of backslashes. Commit 81a9a33e
tried to address this by changing the contents of dkms.conf depending
on whether or not we were on Fedora. However, the change occurred in
DKMS 2.2, so if someone running RHEL tries to use a newer DKMS, this
will fail.

So instead of trying to guess at the level of escaping we need, just
avoid needing to escape anything with backslashes. We can quote the
heredoc marker to avoid variable expansion inside the heredoc, we can
use a case statement instead of using backticks and local variables
and such, and we can use single quotes for the outer MAKE assignment.
With this, we should not need any backslashes when writing dkms.conf,
so we should work with any DKMS version.

Change-Id: I5484826c37da13ee383e08bbfeb473aa993e245e
Reviewed-on: http://gerrit.openafs.org/8156
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/packaging/RedHat/openafs.spec.in

index 35e287b64310c2c234d884e0867e488efe4e39b5..1793310e029e0c7ea8c6e69019b605282d1b20c3 100644 (file)
@@ -1079,43 +1079,22 @@ install -p -m 644 src/packaging/RedHat/openafs-cacheinfo $uve/cacheinfo
 install -d -m 755 $RPM_BUILD_ROOT%{_prefix}/src
 cp -a libafs_tree $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}
 
-%if 0%{?fedora}
-
-cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<EOF
+cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<"EOF"
 
 PACKAGE_VERSION="%{dkms_version}"
 
 # Items below here should not have to change with each driver version
 PACKAGE_NAME="%{name}"
-MAKE[0]="KMODNAME=openafs.ko; DSTKMOD=\\".\\"; [ \\"\\\`echo \\"\${kernelver_array[0]}\${kernelver[0]}\\" | sed -e 's/^\\([0-9]*\\.[0-9]*\\)\\..*/\\1/'\\\`\\" = \\"2.4\\" ] && KMODNAME=\\"libafs-*\\" && DSTKMOD=openafs.o; ./configure --with-linux-kernel-headers=\${kernel_source_dir} --with-linux-kernel-packaging; make; mv src/libafs/MODLOAD-*/\\\\\\\$KMODNAME \\\\\\\$DSTKMOD"
+MAKE[0]='./configure --with-linux-kernel-headers=${kernel_source_dir} --with-linux-kernel-packaging && make && case "${kernelver_array[0]}${kernelver[0]}" in 2.4.*) mv src/libafs/MODLOAD-*/libafs-* openafs.o ;; *) mv src/libafs/MODLOAD-*/openafs.ko . ;; esac'
 CLEAN="make -C src/libafs clean"
 
-BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
-DEST_MODULE_LOCATION[0]="/kernel/3rdparty/\$PACKAGE_NAME/"
+BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
+DEST_MODULE_LOCATION[0]="/kernel/3rdparty/$PACKAGE_NAME/"
 STRIP[0]=no
 AUTOINSTALL=yes
 
 EOF
 
-%else
-cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<EOF
-
-PACKAGE_VERSION="%{dkms_version}"
-
-# Items below here should not have to change with each driver version
-PACKAGE_NAME="%{name}"
-MAKE[0]="KMODNAME=openafs.ko; DSTKMOD=\\".\\"; [ \\"\\\`echo \\"\${kernelver_array[0]}\${kernelver[0]}\\" | sed -e 's/^\\([0-9]*\\.[0-9]*\\)\\..*/\\1/'\\\`\\" = \\"2.4\\" ] && KMODNAME=\\"libafs-*\\" && DSTKMOD=openafs.o; ./configure --with-linux-kernel-headers=\${kernel_source_dir} --with-linux-kernel-packaging; make; mv src/libafs/MODLOAD-*/\\\$KMODNAME \\\$DSTKMOD"
-CLEAN="make -C src/libafs clean"
-
-BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
-DEST_MODULE_LOCATION[0]="/kernel/3rdparty/\$PACKAGE_NAME/"
-STRIP[0]=no
-AUTOINSTALL=yes
-
-EOF
-
-%endif
-
 #
 # install kernel-source
 #