[aur-general] postinstall script and local user directory

rafael ff1 rafael.f.f1 at gmail.com
Mon May 21 21:22:18 EDT 2012


2012/5/21 Jorge Barroso <jorge.barroso.11 at gmail.com>:
> 2012/5/22 Auguste Pop <auguste at 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.000000000 -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


More information about the aur-general mailing list