Q: Can a post-update
/ upgrade
bash script be executed when performing apt-get
? I'm experiencing an error where the post-upgrade/update script is running sh
& not bash
.
See below for details.
- I'm building Debian packages with fpm, e.g.:
fpm -s dir -t deb \
-n "<A NAME>" \
-a all -v "<A VERSION>" \
--after-install <BASH SCRIPT> \
--after-upgrade <BASH SCRIPT> \
-m <MODULE> \
<DIR>=<INSTALL DIR>
- Upon installation I receive the following error:
Syntax error: "(" unexpected (expecting "}")
dpkg: error processing package <MY PACKAGE> (--configure):
installed <MY PACKAGE NAME> package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
<MY PACKAGE NAME>
E: Sub-process /usr/bin/dpkg returned an error code (1)
- Subsequently, I released that the
--after-install
&--after-upgrade
scripts create a wrapper around my bash scripts usingsh
& notbash
and failing because some bash syntax is not available in sh, i.e.cat /var/lib/dpkg/info/<MY PACKAGE>.postinst
script:
#!/bin/sh
after_upgrade() {
:
#!/bin/bash
# Executed after apt-get < install | upgrade >