Open cryptolukas opened 8 years ago
Trying to test this:
% cat after.sh
#!/bin/sh
echo "Running after for <%= name %>"
% fpm -s empty -t deb -n two --template-scripts --after-install ./after.sh
% fpm -s empty -t deb -n one -d two --template-scripts --after-install ./after.sh
Installing in either order:
% sudo dpkg -i one_1.0_amd64.deb two_1.0_amd64.deb
(Reading database ... 150568 files and directories currently installed.)
Preparing to unpack one_1.0_amd64.deb ...
Unpacking one (1.0) over (1.0) ...
Preparing to unpack two_1.0_amd64.deb ...
Unpacking two (1.0) over (1.0) ...
Setting up two (1.0) ...
Running after for two
Setting up one (1.0) ...
Running after for one
% sudo dpkg -i two_1.0_amd64.deb one_1.0_amd64.deb
Selecting previously unselected package two.
(Reading database ... 150564 files and directories currently installed.)
Preparing to unpack two_1.0_amd64.deb ...
Unpacking two (1.0) ...
Selecting previously unselected package one.
Preparing to unpack one_1.0_amd64.deb ...
Unpacking one (1.0) ...
Setting up two (1.0) ...
Running after for two
Setting up one (1.0) ...
Running after for one
It looks like this works for me, at least for what I expect. Here's what I see:
postinst
behaves).Can you desribe more about what you're trying to do?
Yes this works for some case, but I build a meta package with important tools. This package after also dependencies.
Shortend snippets:
First Package: meaconf
fpm -n metaconf -v 0.0.4-0 -s dir -t deb --depends basic-install
Second Package basic-install:
fpm -n basic-install -v 0.0.6-6 -s dir -t deb --depends zsh-conf --depends check-mk-agent-mldsol
Third Packages zsh-conf:
fpm -n zsh-conf -v 0.0.4-0 -s dir -t deb --post-install /data/zsh-conf/after-install.sh
cat after-install.sh
#!/bin/bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cp -a /root/.zshrc.pre-oh-my-zsh /root/.zshrc
fpm -n check-mk-agent-mldsol -v 0.0.2-0 -s dir -t deb --depends xinetd --post-install /data/check-mk-agent/after-install.sh
cat after-install.sh
#!/bin/bash
systemctl restart xinetd.service
The result show like this:
`Cloning Oh My Zsh... Cloning into '/root/.oh-my-zsh'... remote: Counting objects: 780, done. remote: Compressing objects: 100% (646/646), done. remote: Total 780 (delta 20), reused 676 (delta 9), pack-reused 0 Receiving objects: 100% (780/780), 520.93 KiB | 0 bytes/s, done. Resolving deltas: 100% (20/20), done. Checking connectivity... done. Looking for an existing zsh config... Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh Using the Oh My Zsh template file and adding it to ~/.zshrc Time to change your default shell to zsh!
_ / / ___ _ ____/ /_
/ \/ \ / ` \/ / / / / / / **/ \
/ // / / / / / / / / / / // / / /(** ) / / /
// // // // //\, / //// /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
➜ / Setting up xinetd (1:2.3.15-6) ... Setting up check-mk-agent (0.0.2-0) ... Setting up basic-install (0.0.6-6) ... Setting up metaconf (0.0.4-0) ... Processing triggers for libc-bin (2.23-0ubuntu3) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for dbus (1.10.6-1ubuntu3) ...`
I think the cosmetic problem based on the oh-my-zsh script.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
After execute this he goes back to shell and don't finished the apt-get process.
This sounds beyond things I have tried to do in Debian packages. I am unaware of a deb feature of "this thing to execute at the end of the full transaction", but if it does exist, we can probably add support for it in fpm.
It sounds very good. :+1: Can you estimate when this feature is available or it this feature not so important? I think for debian packages it is a great feature.
@LukasDoe being able to implement this in fpm requires that the Debian package format support what you are describing. At this time, I do not believe Debian packages support this, so there's nothing we can do in fpm to provide it :\
Hi,
I have the need to execute a post-install-script. I know you cann execure the paramter
--after-install FILE
This is early. A lot of tasks are not complete at this point. Maybe, also Dependencies. This should execute when really all is done.As example: I build a custom Package for Postfix with a set of files and parameter, but some jobs aren't running before the after-install script execute. The jobs in the after-install script fails. At the moment I can only fix it to execute a other script after the complete installation. It's not a smart solution. :(