I'm trying to find a way to run dch in non-interactive mode, in order to incorporate the debian/changelog file creation and manipulation within a shell script.

It seems that only when running it with the argument -r "" it works (as specified here). However, I need to use different arguments.


Found the problem,

It appears that dch will open an editor if it doesn't get all the information that it considers mandatory. So in order to create a debian/changelog without opening an editor I've found that the following combination of options is sufficient:

dch --create --distribution unstable --package "pkgpkg" --newversion "some nice message"
| improve this answer | |
  • 1
    dch -n "some nice message" is enough. – uav Aug 2 '17 at 16:39
  • 1
    @uav the -n flag doesn't work if you need to create a new change log for the first time: dch: fatal error at line 573: Cannot find debian/changelog anywhere! Are you in the source code tree? (You could use --create if you wish to create this file.) – Wimateeka Dec 10 '19 at 19:40

That depends on what you intend to do with it. dch picks up on the VISUAL/EDITOR variables to determine the editor, and the only condition is that it understand/ignore an initial option of the form +n. So I can do:

$ cat edit.sh 
#! /bin/bash

sed -i 's/UNRELEASED/trusty/' "$@"
$ VISUAL='bash edit.sh' dch -i
$ head -3 debian/changelog
mypackage (1.24ubuntu1) trusty; urgency=medium


And get reasonably automated operation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.