Skip to content

dumping pre/post install/remove/upgrade scripts as sh instead of bash #1936

@sinhlam

Description

@sinhlam

apologies if this has been asked/brought up before but I'm running into an odd issue.

I'm building deb packages with the before/after install/remove options and those are fine. I examine the postinst and preinst scripts in /var/lib/dpkg/info/package.* and what I've found is that when I specify a before/after upgrade option it executes those scripts as sh instead of bash.

something like this (from the preinst script):

#!/bin/sh


before_upgrade() {
    :
#!/bin/bash

echo "running pre-upgrade.sh"

exit 0

}

before_install() {
    :
#!/bin/bash
echo "running pre-inst.sh"

if I build a package without the upgrade options, those preinst/postinst scripts are executed as bash. normally the packages I make have explicit instructions to purge instead of "upgrading" them. only ran into this because I wanted to try going the upgrade route instead of the purge/install method.

thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions