Closed MichaIng closed 5 years ago
Resolved with: https://github.com/jcorporation/myMPD/pull/125
Btw bug was introduced with: https://github.com/jcorporation/myMPD/commit/d3ee3bc6df6b225ba8da489d94c2a483a2af4ca1#diff-07e2cd25f7da0550504d107fb2cae5be
#/bin/bash
=> #/bin/sh
Switching to bourne shell makes generally sense but it has to be taken care about slightly different behaviour 😉.
I merged your pull request. Thanks for your investigation.
Describe the bug After doing a fresh install or reinstall on Debian via
mkrelease.sh
, the systemd unit is not created even that according to code logic it should.To Reproduce Steps to reproduce the behavior:
wget https://github.com/jcorporation/myMPD/archive/master.zip
unzip master.zip
cd myMPD-master
./mkrelease.sh
Expected behavior systemd unit should have been created and enabled
Actual behavior
Additional context Same behavior on fresh install. As can be seen above I added some debug echo to verify that the variables are set correctly:
-nt
seems to be not passed, but checking the same manually succeeds as expected.postinst
has the shebang not correctly assigned,#/bin/sh
instead of#!/bin/sh
but this should not play a role and indeed does not solve the issue.Tried different things, with double quoting arguments and such but what finally solved the issue was changing the shebang to bash:
And indeed while the check succeeds in
bash
, it fails indash
(Debian default shell):-nt
does not return true if the target file does not exist in dash while it does in bash.Solution:
debian/postinst
run as bash explicitly (not recommended to stay flexible), or-nt
, or