Author Topic: Bash errors in package  (Read 623 times)

Offline Ertain

  • Sr. Member
  • ****
  • Posts: 365
  • I come in peace. And for some nachos.
Bash errors in package
« on: January 30, 2011, 02:55:18 PM »
Hello everyone.  I've been trying to fix the Linux Wacom package so that the control panel works.  I figure that I need to put some code into the /usr/lib/tcl8.6/TkXInput/pkgIndex.tcl file.  But first I need to check to see if it is there (on account of TkXInput having the same file).

I thought of first checking to see if the file is there and, if so, adding the proper code to it.  And if not, then the code will create the file.  This is as far as I got before RPM (on installing it) gave me an error about the "else" statement.
Code: [Select]
if [-e /usr/lib/tcl8.6/TkXInput/pkgIndex.tcl] then
 sed '/errorhandler/ \apackage ifneeded LIBWACOMXI 1.0 [list tclPkgSetup \$dir LIBWACOMXI 1.0 {{libwacomxi.so load  {wacomxi::bindevent }}}]' /usr/lib/tcl8.6/TkXInput/pkgIndex.tcl
else
# Looks like the file isn't there.  Better make one.
 cat > /usr/lib/tcl8.6/TkXInput/pkgIndex.tcl << EOF
#
# This file has been customized after generated by
# the "pkg_mkIndex" command.
#
package ifneeded LIBWACOMXI 1.0 [list tclPkgSetup $dir LIBWACOMXI 1.0 {{libwacomxi.so load {wacomxi::bindevent }}}]
EOF
fi
I placed this code at the %post part of the rpmspec file.

I'm trying not to have any file conflicts with TkXInput, but the pkgIndex.tcl with linuxwacom-controlpanel must be in the exact spot.
"She's the boss, apple sauce!"
 -Frank Cho

Offline Ertain

  • Sr. Member
  • ****
  • Posts: 365
  • I come in peace. And for some nachos.
Re: Bash errors in package
« Reply #1 on: January 31, 2011, 01:10:11 AM »
Thanks, ongoto, I'll try that.
*Tries that*
"She's the boss, apple sauce!"
 -Frank Cho

Offline critter

  • Full Member
  • ***
  • Posts: 220
Re: Bash errors in package
« Reply #2 on: February 01, 2011, 07:56:06 AM »
can't say I followthe code too well but maybe a backslash before $dir in the here document?
Motherboard   Gigabyte Z68X-UD3H-B3
Hard Drives      2 x Maxtor STM350032 500GB SATA
Memory      16GB RAM
Processor      Intel core i5 3.30GHz
Video         nVidia GeForce GT430
Sound      HDA Intel PCH
PCLinuxOS          KDE

Offline Ertain

  • Sr. Member
  • ****
  • Posts: 365
  • I come in peace. And for some nachos.
Re: Bash errors in package
« Reply #3 on: February 01, 2011, 12:47:52 PM »
Yeah, I tried that.  It seems to be working, but now I've found it over writes the contents of the pkgIndex.tcl file instead of tacking it on.  Also, it has remove the declaration after the RPM is removed, but it doesn't remove any of the lines.
"She's the boss, apple sauce!"
 -Frank Cho

Offline critter

  • Full Member
  • ***
  • Posts: 220
Re: Bash errors in package
« Reply #4 on: February 01, 2011, 02:14:46 PM »
sorry if I'm missing the point here, I'm not a packager, but if the file is being overwritten rather than appended to then perhaps
cat >> /usr/lib/tcl8.6/TkXInput/pkgIndex.tcl <<EOF.
Just a guess.
Motherboard   Gigabyte Z68X-UD3H-B3
Hard Drives      2 x Maxtor STM350032 500GB SATA
Memory      16GB RAM
Processor      Intel core i5 3.30GHz
Video         nVidia GeForce GT430
Sound      HDA Intel PCH
PCLinuxOS          KDE

Offline Ertain

  • Sr. Member
  • ****
  • Posts: 365
  • I come in peace. And for some nachos.
Re: Bash errors in package
« Reply #5 on: February 01, 2011, 08:29:17 PM »
Thanks for the insight, critter.  I shall add that.

But now I have to solve the issue of taking out the code when linuxwacom-controlpanel is uninstalled.
"She's the boss, apple sauce!"
 -Frank Cho