Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] /usr/local/bin/leofs-adm should be removed #617

Closed
mocchira opened this issue Feb 10, 2017 · 5 comments
Closed

[package] /usr/local/bin/leofs-adm should be removed #617

mocchira opened this issue Feb 10, 2017 · 5 comments

Comments

@mocchira
Copy link
Member

in order to install multiple version on the same node. (there must be no overlap files between any version)
suggested on https://groups.google.com/d/msg/leoproject_leofs/QsxY2wNWhYg/cKczaySaBAAJ
instead
Replacing that file with symlink created after installation will solve this problem.

%post
ln -sf /usr/local/leofs/%{version}/leofs-adm /usr/local/bin/leofs-adm

%postun
# remove symlink only if this is the last installed copy
if [ $1 -lt 0 ]; then
rm -f /usr/local/bin/leofs-adm
fi
@vstax
Copy link
Contributor

vstax commented Feb 23, 2017

Current problem (here, version 1.3.0.1 was specially constructed with modified leofs-adm version):

[root@leo-m1 x86_64]# rpm -i leofs-1.3.0-1.x86_64.rpm
[root@leo-m1 x86_64]# rpm -i leofs-1.3.0.1-1.x86_64.rpm
    file /usr/local/bin/leofs-adm from install of leofs-1.3.0.1-1.x86_64 conflicts with file from package leofs-1.3.0-1.x86_64

From now on, 1.3.0 has /usr/local/bin/leofs-adm as a real file (like current package) and 1.3.1 and 1.3.2 package it as an alternative. This and some other fixes for RPM package are here: leo-project/leofs_package#3

[root@leo-m1 leofs]# rpm -ivh /home/vm/old/leofs-1.3.0-1.x86_64.rpm
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm
-rwxr-xr-x. 1 root root 40098 Feb 21 22:40 /usr/local/bin/leofs-adm

Side by side installation during upgrade

[root@leo-m1 leofs]# rpm -i /home/vm/rpmbuild/RPMS/x86_64/leofs-1.3.1-1.x86_64.rpm
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm /etc/alternatives/leofs-adm
lrwxrwxrwx. 1 root root 32 Feb 22 22:35 /etc/alternatives/leofs-adm -> /usr/local/leofs/1.3.1/leofs-adm
lrwxrwxrwx. 1 root root 27 Feb 22 22:35 /usr/local/bin/leofs-adm -> /etc/alternatives/leofs-adm

Symlink isn't removed when uninstalling old version which packaged real file because of %ghost file in new package

[root@leo-m1 leofs]# rpm -e leofs-1.3.0 
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm /etc/alternatives/leofs-adm
lrwxrwxrwx. 1 root root 32 Feb 22 22:35 /etc/alternatives/leofs-adm -> /usr/local/leofs/1.3.1/leofs-adm
lrwxrwxrwx. 1 root root 27 Feb 22 22:35 /usr/local/bin/leofs-adm -> /etc/alternatives/leofs-adm 

All packages install alternative with same priority, so it isn't updated to new version just after installation. It is possible to make it work differently, for example by manually or automatically increasing priority each version. This change can be made in the future, if desired. I think current way is fine to avoid confusion, it's only a matter of preference.

[root@leo-m1 leofs]# rpm -i /home/vm/rpmbuild/RPMS/x86_64/leofs-1.3.2-1.x86_64.rpm
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm /etc/alternatives/leofs-adm
lrwxrwxrwx. 1 root root 32 Feb 22 22:37 /etc/alternatives/leofs-adm -> /usr/local/leofs/1.3.1/leofs-adm
lrwxrwxrwx. 1 root root 27 Feb 22 22:37 /usr/local/bin/leofs-adm -> /etc/alternatives/leofs-adm

However, after old version is uninstalled symlink is updated

[root@leo-m1 leofs]# rpm -e leofs-1.3.1
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm /etc/alternatives/leofs-adm
lrwxrwxrwx. 1 root root 32 Feb 22 22:37 /etc/alternatives/leofs-adm -> /usr/local/leofs/1.3.2/leofs-adm
lrwxrwxrwx. 1 root root 27 Feb 22 22:37 /usr/local/bin/leofs-adm -> /etc/alternatives/leofs-adm

Cleanup

[root@leo-m1 leofs]# rpm -e leofs-1.3.2
[root@leo-m1 leofs]# ll /usr/local/bin/leofs-adm /etc/alternatives/leofs-adm
ls: cannot access /usr/local/bin/leofs-adm: No such file or directory
ls: cannot access /etc/alternatives/leofs-adm: No such file or directory

I don't know much about debian packaging and how dpkg works when installing multiple versions of the same package. If exactly the same problem exists there, the same "alternatives" solution can be used. However, since apparently deb packages don't support anything similar to %ghost tag of RPM - which is used here so that RPM won't wipe /usr/local/bin/leofs-adm after uninstalling old package which contained it as a real file - some other solution is needed.

For RPM, if ghost files weren't available this could be solved by post-uninstall trigger which works after uninstalling old version like this:

%triggerpostun -- leofs < 1.3.3 
%{_sbindir}/update-alternatives --auto leofs-adm

maybe someone with experience in debian packaging can do the similar fixes there.

@mocchira
Copy link
Member Author

@vstax
Thanks for your contribution with the detailed comment!
Looks very good to me.
As for the deb,
I'm sure we can go forward with the similar approach you achieved in rpm with a little tweaks.
I'd like to assign the task applying this hack to the deb to a member who is responsible for managing packages.

@yosukehara can you assign fixes for the deb to appropriate one ( @windkit or @firejun )?
I'll close this issue after confirming the fixes for deb also working.

@yosukehara
Copy link
Member

can you assign fixes for the deb to appropriate one ( @windkit or @firejun )?
I'll close this issue after confirming the fixes for deb also working.

@mocchira I'd like to ask you to fix it because they're now working on other tasks.

@mocchira
Copy link
Member Author

@yosukehara Got it. I'll PR later.

@mocchira
Copy link
Member Author

@yosukehara @vstax
Since it turned out that dpkg prohibit installing multiple versions of the same package(simply the new one override the old one), this hack is no need for deb so keep make_deb.sh as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants