16

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.

2 Answers2

16

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 0.0.0.0-0.test "some nice message"
0

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

shift
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.

muru
  • 197,895
  • 55
  • 485
  • 740