maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   How to prevent installation of RPM file ? (https://talk.maemo.org/showthread.php?t=92559)

Schturman 2014-01-30 19:09

How to prevent installation of RPM file ?
 
Hi
Someone know how to prevent installation of RPM file with the same files structure ?
For example I have 3 hebrew vkb RPM files, all of them have the same structure:
/usr/share/jolla-hebrewvkb/jolla/layouts
/usr/share/jolla-hebrewvkb/font
/usr/share/jolla-hebrewvkb/backup

If one of packages already installed and I trying to install another one, it installed without any problem over the same files... How to prevent it ?

I tried to add this lines to .spec file before packaging:
Code:

%pre
if [ ! -d /usr/share/jolla-hebrewvkb ]; then
:
else
exit 0
fi

or

Code:

%pre
status=$(rpm -qa hebrewvkb*|wc -l)
if [ "$status" > "0" ]; then
exit 0
fi

But it just don't do nothing...
Maybe I need to add something else ? Please, any advice ?

coderus 2014-01-30 19:33

Re: How to prevent installation of RPM file ?
 
@Schturman exit 1

nieldk 2014-01-30 19:39

Re: How to prevent installation of RPM file ?
 
hmm
maybe somthing like
%pre
%if [ -d /usr/share/jolla-hebrewvkb ]
exit 0
%endif

Schturman 2014-01-30 19:42

Re: How to prevent installation of RPM file ?
 
Thanks guys, I will try later and report..

Schturman 2014-01-30 20:13

Re: How to prevent installation of RPM file ?
 
Ok tested...
nieldk, you method not work at all..

coderus, You method work, but not so good...
It's good, I can't install another vkb:
Code:

Installing packages          [=========================]
Fatal error: Installation aborted by user

But I also can't reinstall the same package (same error), maybe my command is wrong ?:
Code:

pkcon install-local -y /home/nemo/Downloads/hebrewvkb-4ar-0.1-1.armv7hl.rpm
Also I can't uninstall this package, used:
Code:

pkcon remove hebrewvkb-4ar
:
Code:

Downloading packages          [=========================]
Fatal error: Specified path '/var/tmp/TmpDir.szc6vD' is not a directory: dir:///var/tmp/TmpDir.szc6vD

Needed to reinstall previous build and only after this remove.

:(

rainisto 2014-01-31 05:48

Re: How to prevent installation of RPM file ?
 
Just use .spec file.

Obsoletes: - if you want to uninstall other versions

Conflicts: - if you want to keep 1st installed rpm package and stop 2 other packages from installing

(And you all 3 packages can use Provides: hebvbk for example so depending packages dont care which one of the 3 packages is installed).

Schturman 2014-01-31 10:18

Re: How to prevent installation of RPM file ?
 
Quote:

Originally Posted by rainisto (Post 1409909)
Just use .spec file.

Obsoletes: - if you want to uninstall other versions

Conflicts: - if you want to keep 1st installed rpm package and stop 2 other packages from installing

(And you all 3 packages can use Provides: hebvbk for example so depending packages dont care which one of the 3 packages is installed).

Thank you very much ! Conflicts:work like a charm! :)
Wanted to ask you about Provides: if I understand it right..

For example I have 3 packages named:
hebrewvkb-4ar
hebrewvkb-2ar-3lang
hebrewvkb-2ar-2lang

I'm going to create another/different app/package and I know it can be conflicted with this 3 packages.
I will add:
Provides: hebrewvkb to new package and that mean, when I will try to install new package and I already have one of 3 packages (vkb) installed - it just will not allow me to install new package ? I'm right ?

marmistrz 2014-01-31 12:21

Re: How to prevent installation of RPM file ?
 
Shouldn't the pkg mgr refuse to overwrite files, as dpkg does?

Schturman 2014-01-31 22:56

Re: How to prevent installation of RPM file ?
 
Hmmm, I have also another question, why when I try to update to new version of my app, the install command show me that all installed ok, but when I check /usr/share/ the folder of my package is not here. Looks like it just uninstalled my previous version but not installed new one and I need run install command again to get it.
Something missing my spec file ?


EDIT:
Nevermind, I found where is my problem, I added this line to spec file:
Code:

%postun
rm -rf /usr/share/jolla-adrestart

But the problem is when I uninstall package, it remove all files but leave the folder /usr/share/jolla-adrestart
How I can completely remove package (include folder of my app) ?

Penguin 2014-02-03 01:16

Re: How to prevent installation of RPM file ?
 
Is there something in /usr/share/jolla-adrestart that your application writes there in installation scripts or after installation during runtime? All files in that directory must be included into the rpm otherwise it will not remove it as there are files not belonging to the rpm package uninstalled.


All times are GMT. The time now is 07:30.

vBulletin® Version 3.8.8