Re: [aur-general] postinstall script and local user directory

2012-05-23 Thread Jorge Barroso
 2012/5/22 rafael ff1 rafael.f...@gmail.com


 Looks good. Try to build the package and then verify if
 pkg/usr/bin/lmd has the command added with sed. Case yes, then you're
 good to go.

 Rafael Ferreira


2012/5/23 Auguste Pop augu...@gmail.com

  ok. in this case, i suggest you make a wrapper script that 1. checks
  the content in user's $HOME directory, 2. does whatever is necessary,
  3. runs the actual program.

  in this case, what you have done is totally transparent to the user
  and every user on the system can use that application.

  best regards,

It doesn't worked :S I'll see what to do... maybe it's because of I have to
change something else on the PKGBUILD

Auguste... It's a good idea, doing it like a patch, it'll be easier, but I
don't like adding patches... even I'll do a patch if I can't do it on
another way ;)


Re: [aur-general] postinstall script and local user directory

2012-05-22 Thread Jorge Barroso
2012/5/22 rafael ff1 rafael.f...@gmail.com

 Since your first post, I was not comfortable having a install script
 looking for a normal user's home folder, because you can always find
 yourself in the situation that a user might be added after LMD is
 installed. (not being harsh, just not a good idea, IMO)

 So, I came up with the idea of applying a patch in the 'ldm' script.
 With this patch, 'lmd' would verify if the user have '~/.LMD'
 everytime, right before starting the gtkdialog. See my diff:


 --- src/usr/local/bin/lmd   2011-07-03 17:19:24.0 -0300
 +++ pkg/usr/bin/lmd 2012-05-21 22:07:06.587084106 -0300
 @@ -323,6 +323,7 @@

   if [ -z $1 ];
   then
 +   [ ! -d ~/.LMD ]  lmd -reconf
gtkdialog --program=MAIN_DIALOG
  fi
  echo $1


 I added the following line the PKGBUILD, after installing lmd to
 '$pkgdir':

  sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \\ lmd -reconf#' -i
 ${pkgdir}/usr/bin/lmd

 which just replace in line 325 the then, adding one more line with
 the command command you provided.

 Hope it helps.

 Rafael


Mmm yes it helps, I know what you mean, adding a line on the own lmd binary
script that checks if .LMD already exists... any time you run lmd an for
any user ;) Not bad :D but... if fear I don't know so sed command, so I
can't comprehend where are you exactly telling me that I should put that
or... well :S sorry, could you explain it a little more :S

My bigest thanks friend


Re: [aur-general] postinstall script and local user directory

2012-05-22 Thread rafael ff1
2012/5/22 Jorge Barroso jorge.barroso...@gmail.com:
 2012/5/22 rafael ff1 rafael.f...@gmail.com


  sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \\ lmd -reconf#' -i
 ${pkgdir}/usr/bin/lmd


 Mmm yes it helps, I know what you mean, adding a line on the own lmd binary
 script that checks if .LMD already exists... any time you run lmd an for
 any user ;) Not bad :D but... if fear I don't know so sed command, so I
 can't comprehend where are you exactly telling me that I should put that
 or... well :S sorry, could you explain it a little more :S

 My bigest thanks friend

If you're not comfortable with sed, you can always create a patch
using 'diff -u foo1 bar2  foo-bar.patch' and add to source=() ... But
since we are here:

My sed command executes an expression in an input text. The input text
is from the file 'lmd'. I also added the flag '-i' so the output of
this command will not go to stdout, but directly to the input file.
So, it will not just read the file, but alter/write too.

The expression structure is basically 'A#B#C#', where #s are
delimiters; A is a specific line number that sed will look and
replace; B is the regexp to look (and to be replaced) in that line in
A; and C is the replacement regexp that I want to replace B. Please
note that '\n' is a newline character and '\t' is a tab character.

So, as I mentioned before, I replaced the string 'then' in line 325
with the new line/command you provided.

'sed' can do much more than that. Man page and google can help a lot.

Cheers,

Rafael Ferreira


Re: [aur-general] postinstall script and local user directory

2012-05-22 Thread Jorge Barroso
2012/5/22 rafael ff1 rafael.f...@gmail.com


 If you're not comfortable with sed, you can always create a patch
 using 'diff -u foo1 bar2  foo-bar.patch' and add to source=() ... But
 since we are here:

 My sed command executes an expression in an input text. The input text
 is from the file 'lmd'. I also added the flag '-i' so the output of
 this command will not go to stdout, but directly to the input file.
 So, it will not just read the file, but alter/write too.

 The expression structure is basically 'A#B#C#', where #s are
 delimiters; A is a specific line number that sed will look and
 replace; B is the regexp to look (and to be replaced) in that line in
 A; and C is the replacement regexp that I want to replace B. Please
 note that '\n' is a newline character and '\t' is a tab character.

 So, as I mentioned before, I replaced the string 'then' in line 325
 with the new line/command you provided.

 'sed' can do much more than that. Man page and google can help a lot.


Oh, ok, yeah I read a bit on the man page and o a webpage, but it's too
large, it has so many functions. Eitherway, I understand what you said now.
Then, on my PKGBUILD, I should modify the package()... in the next way?:

package() {
cd ${srcdir}

tar xf data.tar.gz
mkdir -p ${pkgdir}/usr/
cp -r ${srcdir}/./usr/local/bin ${pkgdir}/usr/bin
cp -r ${srcdir}/./usr/share ${pkgdir}/usr/share

sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \\ lmd -reconf#' -i
${pkgdir}/usr/bin/lmd

chmod +x ${pkgdir}/usr/bin/*
sed 's|usr/local|usr|' -i ${pkgdir}/usr/bin/*
sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/applications/LMD.desktop
sed 's|usr/local|usr|' -i
${pkgdir}/usr/share/doc/linux-manga-downloader/copyright
sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/icons/pen.png
sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/lmd/langs/ca_ES
sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/lmd/langs/es_ES
}


Re: [aur-general] postinstall script and local user directory

2012-05-22 Thread rafael ff1
2012/5/22 Jorge Barroso jorge.barroso...@gmail.com:
 2012/5/22 rafael ff1 rafael.f...@gmail.com


 If you're not comfortable with sed, you can always create a patch
 using 'diff -u foo1 bar2  foo-bar.patch' and add to source=() ... But
 since we are here:

 My sed command executes an expression in an input text. The input text
 is from the file 'lmd'. I also added the flag '-i' so the output of
 this command will not go to stdout, but directly to the input file.
 So, it will not just read the file, but alter/write too.

 The expression structure is basically 'A#B#C#', where #s are
 delimiters; A is a specific line number that sed will look and
 replace; B is the regexp to look (and to be replaced) in that line in
 A; and C is the replacement regexp that I want to replace B. Please
 note that '\n' is a newline character and '\t' is a tab character.

 So, as I mentioned before, I replaced the string 'then' in line 325
 with the new line/command you provided.

 'sed' can do much more than that. Man page and google can help a lot.


 Oh, ok, yeah I read a bit on the man page and o a webpage, but it's too
 large, it has so many functions. Eitherway, I understand what you said now.
 Then, on my PKGBUILD, I should modify the package()... in the next way?:

 package() {
 cd ${srcdir}

 tar xf data.tar.gz
 mkdir -p ${pkgdir}/usr/
 cp -r ${srcdir}/./usr/local/bin ${pkgdir}/usr/bin
 cp -r ${srcdir}/./usr/share ${pkgdir}/usr/share

 sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \\ lmd -reconf#' -i
 ${pkgdir}/usr/bin/lmd

 chmod +x ${pkgdir}/usr/bin/*
 sed 's|usr/local|usr|' -i ${pkgdir}/usr/bin/*
 sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/applications/LMD.desktop
 sed 's|usr/local|usr|' -i
 ${pkgdir}/usr/share/doc/linux-manga-downloader/copyright
 sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/icons/pen.png
 sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/lmd/langs/ca_ES
 sed 's|usr/local|usr|' -i ${pkgdir}/usr/share/lmd/langs/es_ES
 }

Looks good. Try to build the package and then verify if
pkg/usr/bin/lmd has the command added with sed. Case yes, then you're
good to go.

Rafael Ferreira


Re: [aur-general] postinstall script and local user directory

2012-05-22 Thread Auguste Pop
On Tue, May 22, 2012 at 7:56 AM, Jorge Barroso
jorge.barroso...@gmail.com wrote:
 2012/5/22 Auguste Pop augu...@gmail.com


 i suggest installing a script doing what you want to do in $HOME
 directory and print out an instruction in post_install function to
 remind the user to run that script as normal user without sudo.

 inside the script, $HOME can be used, or ~ too.


 Thanks Auguste, I'd like to do it all in the postinstall even though, I'll
 try a little changes on it and I'll see what can I do and if I see it
 doesn't works... I'll keep that on account

 Good Idea, I wasn't thought about that ;)

ok. in this case, i suggest you make a wrapper script that 1. checks
the content in user's $HOME directory, 2. does whatever is necessary,
3. runs the actual program.

in this case, what you have done is totally transparent to the user
and every user on the system can use that application.

best regards,


Re: [aur-general] postinstall script and local user directory

2012-05-21 Thread Myles English
 On Tue, 22 May 2012 00:52:00 +0200, Jorge Barroso said:

   Hello, I need a little help with a postinstall script, the script should
   make automatically a few postinstall steps on the LMD installation, qhat
   the script should make it's to detect if a directory called .LMD on the
   home directory exists, if it exists, it shows an informative message, if it
   doesn't exist it makes it.
   All right the problem is: It acts over the root directory, and I want it to
   act over the user normal directory (/home/'user')
   For you tu understand what I mean, this is the code:

   http://pastebin.com/57L2Jt2P - With that it looks for a directory called
   ~, not home directory

   I als otried with an array, and it was here when it used root like home
   directory, and not the local user directory:

   http://pastebin.com/TCh94dC9

   I want the script to do the same that it makes with the second paste bin,
   but not in root, it should be, in my pc for example, on /home/jorge...

   Thanks in advance

Hi Jorge,

Try /home/$USER instead of ~.

-- 
  `--[ Myles ]


Re: [aur-general] postinstall script and local user directory

2012-05-21 Thread Auguste Pop
On Tue, May 22, 2012 at 6:52 AM, Jorge Barroso
jorge.barroso...@gmail.com wrote:
 Hello, I need a little help with a postinstall script, the script should
 make automatically a few postinstall steps on the LMD installation, qhat
 the script should make it's to detect if a directory called .LMD on the
 home directory exists, if it exists, it shows an informative message, if it
 doesn't exist it makes it.
 All right the problem is: It acts over the root directory, and I want it to
 act over the user normal directory (/home/'user')
 For you tu understand what I mean, this is the code:

 http://pastebin.com/57L2Jt2P - With that it looks for a directory called
 ~, not home directory

 I als otried with an array, and it was here when it used root like home
 directory, and not the local user directory:

 http://pastebin.com/TCh94dC9

 I want the script to do the same that it makes with the second paste bin,
 but not in root, it should be, in my pc for example, on /home/jorge...

 Thanks in advance

i suggest installing a script doing what you want to do in $HOME
directory and print out an instruction in post_install function to
remind the user to run that script as normal user without sudo.

inside the script, $HOME can be used, or ~ too.

regards,


Re: [aur-general] postinstall script and local user directory

2012-05-21 Thread Jorge Barroso
2012/5/22 Myles English mylesengl...@gmail.com



 Hi Jorge,

 Try /home/$USER instead of ~.

 --
  `--[ Myles ]


It takes it like /home/root... :S thanks even though ;)


Re: [aur-general] postinstall script and local user directory

2012-05-21 Thread Jorge Barroso
2012/5/22 Auguste Pop augu...@gmail.com


 i suggest installing a script doing what you want to do in $HOME
 directory and print out an instruction in post_install function to
 remind the user to run that script as normal user without sudo.

 inside the script, $HOME can be used, or ~ too.


Thanks Auguste, I'd like to do it all in the postinstall even though, I'll
try a little changes on it and I'll see what can I do and if I see it
doesn't works... I'll keep that on account

Good Idea, I wasn't thought about that ;)


Re: [aur-general] postinstall script and local user directory

2012-05-21 Thread rafael ff1
2012/5/21 Jorge Barroso jorge.barroso...@gmail.com:
 2012/5/22 Auguste Pop augu...@gmail.com


 i suggest installing a script doing what you want to do in $HOME
 directory and print out an instruction in post_install function to
 remind the user to run that script as normal user without sudo.

 inside the script, $HOME can be used, or ~ too.


 Thanks Auguste, I'd like to do it all in the postinstall even though, I'll
 try a little changes on it and I'll see what can I do and if I see it
 doesn't works... I'll keep that on account

 Good Idea, I wasn't thought about that ;)


Since your first post, I was not comfortable having a install script
looking for a normal user's home folder, because you can always find
yourself in the situation that a user might be added after LMD is
installed. (not being harsh, just not a good idea, IMO)

So, I came up with the idea of applying a patch in the 'ldm' script.
With this patch, 'lmd' would verify if the user have '~/.LMD'
everytime, right before starting the gtkdialog. See my diff:


--- src/usr/local/bin/lmd   2011-07-03 17:19:24.0 -0300
+++ pkg/usr/bin/lmd 2012-05-21 22:07:06.587084106 -0300
@@ -323,6 +323,7 @@

 if [ -z $1 ];
 then
+   [ ! -d ~/.LMD ]  lmd -reconf
gtkdialog --program=MAIN_DIALOG
 fi
 echo $1


I added the following line the PKGBUILD, after installing lmd to '$pkgdir':

  sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \\ lmd -reconf#' -i
${pkgdir}/usr/bin/lmd

which just replace in line 325 the then, adding one more line with
the command command you provided.

Hope it helps.

Rafael