VectorLinux
April 19, 2014, 04:43:29 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Auto add command to /etc/profile when install package... [SOLVED]  (Read 2131 times)
hata_ph
Packager
Vectorian
****
Posts: 3206


-- Just being myself --


« on: May 27, 2008, 04:05:25 am »

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, 09:30:18 am by hata_ph » Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #1 on: May 27, 2008, 05:09:53 am »

Code:
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: 3206


-- Just being myself --


« Reply #2 on: May 27, 2008, 08: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: 1545


I like the bass to go BOOM!


WWW
« Reply #3 on: May 27, 2008, 09: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: 3206


-- Just being myself --


« Reply #4 on: May 27, 2008, 09: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



« Reply #5 on: May 27, 2008, 10: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: 3206


-- Just being myself --


« Reply #6 on: May 28, 2008, 04:21:19 am »

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

btw, if I uninstall fcitx will the setting that I add into /etc/profile be remove?
Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #7 on: May 28, 2008, 07:32:42 am »

No it won't.
Logged
hata_ph
Packager
Vectorian
****
Posts: 3206


-- Just being myself --


« Reply #8 on: May 28, 2008, 08:50:11 am »

is there anyway to remove the setting when I uninstall the fcitx?
Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #9 on: May 28, 2008, 12: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:
#!/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:
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" Cheesy
Logged
hata_ph
Packager
Vectorian
****
Posts: 3206


-- Just being myself --


« Reply #10 on: May 29, 2008, 07:58:00 am »

WOW...it work.....thanks for all the help.... Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!