VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: Auto add command to /etc/profile when install package... [SOLVED]  (Read 2613 times)

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --

I have build fcitx (free Chinese input toy for X) for VL59. It work fine but I need to make add some extra command to /etc/profile. Is there a way that when I build my package to insert the command to /etc/profile when I install the fcitx?

Below is the extra command that I added to /etc/profile
Quote
# For fcitx
export LC_CTYPE=en_US.UTF-8
export GTK_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"
« Last Edit: May 27, 2008, 10:30:18 am by hata_ph »
Logged

exeterdad

  • Packager
  • Vectorian
  • ****
  • Posts: 2046
Re: Auto add command to /etc/profile when install package...
« Reply #1 on: May 27, 2008, 06:09:53 am »

Code: [Select]
echo '# For fcitx
export LC_CTYPE=en_US.UTF-8
export GTK_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"' >> /etc/profile

Don't confuse the ">>" for a single ">".  A single will completely overwrite /etc/profile instead of appending.
If this is for a package.  This needs to be placed in /install/doinst.sh
If /etc/profile is created in the package, the user's /etc/profile will be wiped out when the package is installed.
Logged

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --
Re: Auto add command to /etc/profile when install package...
« Reply #2 on: May 27, 2008, 09:55:04 am »

I explodepkg the tlz file but there is no doinst.sh file inside the install folder. any idea?

Quote
hata_ph:$ explodepkg fcitx-3.4.2-i586-1vl59.tlz
Exploding package fcitx-3.4.2-i586-1vl59.tlz to the current directory:
./
usr/
usr/share/
usr/share/fcitx/
usr/share/fcitx/doc/
usr/share/fcitx/doc/cjkvinput.txt
usr/share/fcitx/doc/wb_fh.htm
usr/share/fcitx/doc/fcitx3.pdf
usr/share/fcitx/doc/pinyin.txt
usr/share/fcitx/xpm/
usr/share/fcitx/data/
usr/share/fcitx/data/cj.mb
usr/share/fcitx/data/erbi.mb
usr/share/fcitx/data/punc.mb
usr/share/fcitx/data/pybase.mb
usr/share/fcitx/data/pyphrase.mb
usr/share/fcitx/data/pySym.mb
usr/share/fcitx/data/sp.dat
usr/share/fcitx/data/wbx.mb
usr/share/fcitx/data/tables.conf
usr/share/fcitx/data/vk.conf
usr/share/fcitx/data/gbks2t.tab
usr/share/fcitx/data/config
usr/bin/
usr/bin/fcitx
usr/bin/mb2txt
usr/bin/txt2mb
usr/bin/createPYMB
usr/bin/jd2fcitx
usr/bin/pyjj2fcitx
usr/bin/win2fcitx
usr/bin/readPYMB
usr/bin/readPYBase
usr/bin/mb2org
usr/doc/
usr/doc/fcitx-3.4.2/
usr/doc/fcitx-3.4.2/AUTHORS
usr/doc/fcitx-3.4.2/COPYING
usr/doc/fcitx-3.4.2/ChangeLog
usr/doc/fcitx-3.4.2/README
usr/doc/fcitx-3.4.2/TODO
usr/doc/fcitx-3.4.2/fcitx.SlackBuild
install/
install/slack-desc
install/slack-required
Logged

The Headacher

  • Louder than you
  • Global Moderator
  • Vectorian
  • *****
  • Posts: 1553
  • I like the bass to go BOOM!
    • Multimedia on VL (work in progress)
Re: Auto add command to /etc/profile when install package...
« Reply #3 on: May 27, 2008, 10:01:49 am »

You can add one yourself.
Logged
Most music on my soundcloud page was arranged in programs running on VL.

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --
Re: Auto add command to /etc/profile when install package...
« Reply #4 on: May 27, 2008, 10:29:48 am »

You can add one yourself.

WOW...it work...thanks....

I notice some packages will not have doinst.sh, is there a way that I can create it using slackbuild?
Logged

exeterdad

  • Packager
  • Vectorian
  • ****
  • Posts: 2046
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #5 on: May 27, 2008, 11:30:10 am »

You can create a doinst.sh with the above posted text in it.  Then have your SlackBuild copy it into the /install dir after it's created.

cp $CWD/doinst.sh $PKG/install/doinst.sh

Just be sure to include your doinst.sh with your submitted sources.
Logged

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #6 on: May 28, 2008, 05:21:19 am »

ok..it work..I just put the doinst.sh inside the src folder.... :P

btw, if I uninstall fcitx will the setting that I add into /etc/profile be remove?
Logged

exeterdad

  • Packager
  • Vectorian
  • ****
  • Posts: 2046
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #7 on: May 28, 2008, 08:32:42 am »

No it won't.
Logged

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #8 on: May 28, 2008, 09:50:11 am »

is there anyway to remove the setting when I uninstall the fcitx?
Logged

exeterdad

  • Packager
  • Vectorian
  • ****
  • Posts: 2046
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #9 on: May 28, 2008, 01:06:47 pm »

Unfortunately unlike rpm's, slapt-get doesn't have any way to run scripts upon removing packages.  It keeps a list of files and symbolic links that were installed.  Then it deletes those listed items when a package is removed.  Nothing more.

Not sure how it works, but I "think" if you made a fcitx.sh file and placed it in /etc/profile.d it would be executed on boot.  I could be wrong.  ANYONE?

If this is possible, I'd make it like this:
Code: [Select]
#!/bin/sh
# For fcitx
export LC_CTYPE=en_US.UTF-8
export GTK_IM_MODULE=xim
export XMODIFIERS="@im=fcitx"

I'd have this in your sources with your SlackBuild.
Then somewhere in your script I'd do something like this:

Code: [Select]
mkdir -p $PKG/etc/profile.d
cp $CWD/fcitx.sh $PKG/etc/profile.d/fcitx.sh
chmod +x $PKG/etc/profile.d/fcitx.sh


I would then remove all the code you've done with doinst.sh
This way when the package is removed.  Our fcitx.sh file will be on the list and it will be removed cleanly as well.

But please make sure it will work having the .sh file in /etc/profile.d first before taking my idea as "the gospel" :D
Logged

hata_ph

  • Packager
  • Vectorian
  • ****
  • Posts: 3261
  • -- Just being myself --
Re: Auto add command to /etc/profile when install package... [SOLVED]
« Reply #10 on: May 29, 2008, 08:58:00 am »

WOW...it work.....thanks for all the help.... :)
Logged