Score:0

Can I use a BASH script for apt-get post update?

cw flag

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.


  1. 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>
  1. 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)
  1. Subsequently, I released that the --after-install & --after-upgrade scripts create a wrapper around my bash scripts using sh & not bash 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 >


I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.