summaryrefslogtreecommitdiff
path: root/ucf
Commit message (Collapse)AuthorAge
* Merge branch 'upstream'Manoj Srivastava2020-06-15
|\ | | | | | | | | | | | | * upstream: fix(bug) Handle diverted files correctly Signed-off-by: Manoj Srivastava <srivasta@debian.org>
| * fix(bug) Handle diverted files correctlyManoj Srivastava2020-06-15
| | | | | | | | | | | | | | The argument to dpkg-divert needs to be the actual file name, not the fully escaped regexp safe one. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* | bug(quote) Fix a quoting bug that triggered on dashdebian/3.0042archive/debian/3.0042Manoj Srivastava2020-05-22
|/ | | | | | | | | | | | | | | | | | | | | | So this is something, one I didn't know about: In bash and dash, var=$(something) works as expected even if that ``something`` contains spaces, like in var=$(date '+%F %T') Things are however different in dash if you're within a function and want to limit the scope, i.e. local var=$(date '+%F %T') Quite frankly, I haven't checked which shell implementation does not follow the specification, if any, or if this is just another bashism. Quoting fixes this Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* bug(perm): ucf set permissions if destination file does not existManoj Srivastava2020-05-20
| | | | | | | | | while ucf should not alter the attributes of the file if the destination exists (the maintainer can do anythjing she wants after ucf is done), when there is no destination copy the permissions from the source. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* fix(bash): Remove spurious dependencies on bashManoj Srivastava2020-05-19
| | | | | | | There have been no dependencies on bash in ucf for ages. Just changed the shebang line. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* feat(divert): Honor dpkg diversionsManoj Srivastava2020-05-19
| | | | | | | | When a configuration file managed by ucf is diverted (using dpkg-divert), ucf attempts to modify the original path for the conffile, rather than the diverted path. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* feat(SELinux): Allow specifying selinux attributes for dest filesManoj Srivastava2020-05-19
| | | | | | | Currently ucf does not support creating the destination files with the correct SELinux type. This pull adds that. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Backport fixes from master.Manoj Srivastava2020-05-19
| | | | Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* fix(ucf): Do not change permission if 3 way mergeManoj Srivastava2020-05-11
| | | | | | | | | | | | | This commit fixes a bug wyhere ucf did not preserve configuratrion file attributes if three way merges were chosen by the user. Apart from that, there are minor improvements, like adding UCF_CONFFILE_OLD and UCF_CONFFILE_NEW to the inferior shell created by ucf. Closes: Bug#935439, Bug#930130, Bug#892301 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Do not spit diagnostics to STDOUTManoj Srivastava2015-11-13
| | | | | | | | | This commit redirects verbose diagostic messages to STDERR, and thus no longer confuses debconf. Closes: Bug#762857 Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: Use dpkg-query --control-path instead of hard-coding a pathManoj Srivastava2013-05-18
| | | | | | | | | | | ucf's use of a hard-coded path for its debconf templates file is incompatible with multiarch, which will create arch subdirectories and store its state there. As a result, debootstrapping a system using a multiarch-enabled dpkg now fails, since rsyslog uses ucf Closes: 615931 Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: Do not exit normally after errors.Manoj Srivastava2013-04-24
| | | | Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: ucf: script is 'set -e', but tries to test for $?Manoj Srivastava2013-04-24
| | | | | | | | No longer test for $? closes: Bug#633001 Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: Typo fix.Manoj Srivastava2013-04-24
| | | | Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: ucf fails when VERBOSE is set to 1 in /etc/ucf.confManoj Srivastava2013-04-24
| | | | | | | | | | | | | | ucf fails with error code 20 when VERBOSE is set to 1 in /etc/ucf.conf. Actually it is debconf's /usr/share/debconf/confmodule which fails and subsequently topples ucf. The problem seems to be, that some of the messages in ucf are written to stdout instead of stderr, which confuses confmodule's function _db_cmd when reading _db_internal_line. I believe the same is true when DEBUG is set > 0 in ucf.conf, but I had no time to test it in more detail. Fix thanks to Aljoscha Lautenbach <aljoscha.lautenbach@gmail.com> Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: use my_pager when it is setManoj Srivastava2013-04-24
| | | | | | | This takes into account the $PAGER variable. close: Bug#596452 Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* [upstream]: Improve the test for a controlling tty before lauching a shellManoj Srivastava2013-04-24
| | | | | | | | Closes: Bug#574266 Fix thanks to Aaron Hope <asbestos@xemed.com> Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
* Handle errors in three way mergesManoj Srivastava2009-08-27
| | | | | | | | | | | | | | | This fix is one that was first implemented in Ubuntu, and has only been lightly modified. The problem was the handling of merge failures in three way merges, ucf used to just pass the error through to the maintainer script, and so a merge failure resulted in a maintainer script failure, which could cascade in a upgrade. However, trapping the error, and showing it via debconf, and then returning to the ucf debconf menu allows users to resolve this issue as they please. This patch implements that. Signed-off-by: Steve Langasek <vorlon@debian.org> Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Sleep for 3 seconds after emitting warningManoj Srivastava2009-08-24
| | | | | | | | | | | | When there is no tty present (which means we cannot attach to the keyboard), and there is no DISPLAY set, which means we cannopt fire off another window, we cannot fork off a shell. This is not a bug, really, but merely a reality. This patch sleeps for a couple of seconds so that the error message we dump on STDERR can be read. Closes: #543367 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Do not restore $@ until after sanity checks.Manoj Srivastava2009-03-21
| | | | Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Stash any configuration file less than 25KB in sizeManoj Srivastava2009-03-21
| | | | | | | | | | Also, allow the three way merge options whenever there is a stashed version of the file, whether or not the package maintainer has explicitly asked for a three way capability. This way, are closer to making three way capabilities the default, except for large configuration files, where large is defined as 25 KB. Signed-Off-By: Manoj Srivastava <srivasta@debian.org>
* No longer use a non debconf method to prompt the userManoj Srivastava2009-03-20
| | | | | | | | Also, only run bash directly is the script has a terminal backend. Failing that, if DISPLAY is set, try to start a terminal emulator. If there is no tty and no DISPLAY, gibber and do nothing. Signed-Off-By: Manoj Srivastava <srivasta@debian.org>
* Save and restore command line arguments after parsingManoj Srivastava2009-03-20
| | | | | | | | | | | This way, when the script is called again under debconf, the command line arguments are still around, and have not been eliminated during parsing. And no, getopt was notto blame, ucf was nuking the commandline itself. closes: Bug#520073 Signed-Off-By: Manoj Srivastava <srivasta@debian.org>
* Show the differences on the first tryNiko Tyni2009-02-06
| | | | | | | | | | | | | | | | | | | | Until 3.0012, ucf/show_diff was reset just before showing it to the user. This would unset the 'seen' flag properly. However, moving the db_reset call after db_input made the latter skip the note on the first time if the 'seen' flag was already set. To make things worse, Debconf::ConfModule::finish() sets the 'seen' flag for all the questions it has handled before exiting, so the flag was always true after debconf exited. Simply unsetting the flag before db_input fixes this. Closes: Bug#514071 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Substitute the ucf/show_diff DIFF variable contents to protect sensitive dataNiko Tyni2009-02-06
| | | | | | | | | | | | | > reset diff question after use so contents are not written to disk Unfortunately this is not enough (or even needed): the sensitive data is not stored in the value of ucf/show_diff, but in the DIFF variable associated with it. Closes: Bug#511893 Author: Niko Tyni <ntyni@debian.org> Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Use which, not type -a -pManoj Srivastava2009-02-03
| | | | | | | | | | Although the 'type' command is used by /usr/bin/ucf, a 'type' built-in command cannot be used by posh. It is safer to use '/bin/which' contained in debianutils. Closes: Bug#513755 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Short circuit if we are purging (no need to invoke debconf)Manoj Srivastava2009-01-25
| | | | | | | Also, since we do not have two arguments when we are purging, move the new file processing to after the point where we exi in purge mode. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Move the debconf stuff _after_ command line parsingManoj Srivastava2009-01-25
| | | | | | | If it is done earlier, the DEBCONF_OK flag is not set yet. This is majorly bad. Closes: Bug#512832, Bug#512905 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Rearrange code for readability, and add comment blocksManoj Srivastava2009-01-23
| | | | Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Start issueing a diagnostic if ucf is forced to not use debconfManoj Srivastava2009-01-23
| | | | | | | | If ucf is called without the --debconf-ok switch, and debconf is started, issue a diagnostic, and use old style promping on the command line. This is a olicy violation, and soon the non-debconf prompting shall be removed. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* ucf uses debconf even if called without --debconf-ok and hangsManoj Srivastava2009-01-23
| | | | | | | | | | | ucf, even if is called without --debconf-ok, uses debconf and hangs if db_stop had been already called, since it tries to load /usr/share/debconf/confmodule and loads the ucf debconf templates. This is a minimal change, and just moves the test of DEBCONF_OK earlier. Closes: Bug#511031 Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* reset diff question after use so contents are not written to diskJoey Hess2009-01-23
| | | | | | | | | | | | | | | | | | | Debconf does not use world readable "temporary internal files" as Manoj hypothesises. Data is only written to disk if it is left in the debconf database when the frontend (ucf) exits. Tightening the permissions on the debconf database would break several things including use of debconf-show in reportbug. From 27b3c41c531016ffa506987bf4a856345992a204 Mon Sep 17 00:00:00 2001 From: Joey Hess <joey@gnu.kitenet.net> Date: Wed, 21 Jan 2009 13:03:55 -0500 Subject: [PATCH] reset diff question after use so contents are not written to disk Closes: Bug#511893 (ucf stores diff (of private files) in debconf (world readable)) Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* A one character typo fix.Manoj Srivastava2008-09-03
| | | | Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* Handle exceptional sizes of diff outputManoj Srivastava2008-09-02
| | | | | | | | | With large output of diff or sdiff, the pipe buffers used to communicate with debconf fill up. So now we limit the maximu size to jusr under 100k. Also, we were unable to handle whitespace only differences (which show up empty); this change fixes that too. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
* fails to catch conflicts on three-way mergingManoj Srivastava2008-04-03
| | | | | | | | | | When three-way merging has a conflict and diff3 exits with a non-zero status, the postinst exits immediately as "set -e" is in effect. The attached trivial patch fixes this so that the conflict error message gets printed instead. Thanks to Niko Tyni. git-archimport-id: srivasta@debian.org--lenny/ucf--devel--3.0--patch-5
* Major enhancements to functionalityManoj Srivastava2008-02-21
| | | | | | | | | | | | | | | | | | | | | | | | Add a command line option to specify an alternate, caller provide debconf template to use for prompting. Use db_metaget _template Choices-C to see if the new template should be used. Also, use db_x_loadtemplatefile to load our default templates, in case the debconf DB had become corrupted. This means we can stop using debconf-loadtemplate, which was of a lower priority anyway. In case of three way merge, exit with an error if the merge failed. --This line, and those below, will be ignored-- Files to commit: ucfq ucf.1 ucf ChangeLog This list might be incomplete or outdated if editing the log message was not invoked from an up-to-date changes buffer! git-archimport-id: srivasta@debian.org--lenny/ucf--devel--3.0--patch-4
* Use Choices-C in changeprompt templatesManoj Srivastava2007-11-30
| | | | | | | | | | | For "keep current" and "threeway merge", ucf expects answers from debconf which differ from what is specified in the template master. Frans Pop suggested using the Choices-C feature of debconf, which is relatively new, but defines a fixed alias for each option which Debconf will then use in db_get and db_set operations -- so no more matching the template in the code. closes: #443179, #449274, #453084 git-archimport-id: srivasta@debian.org--lenny/ucf--devel--3.0--patch-2
* Make ucf fit the templateManoj Srivastava2007-09-19
| | | | | | | | | | | | The template (and some of the questions) have been changed; make ucf itself reflect that. * ucf (choice_keep_current): Change the name to fit the changed template (choice_diff_threeway): Ditto Closes: Bug#443179 git-archimport-id: srivasta@debian.org--lenny/ucf--devel--3.0--patch-1
* Add support for displaying diffs using debconf itselfManoj Srivastava2007-05-05
| | | | | | | | | | | | | | | | | | Users using a Graphical frontend are surprised when the display apparently just blocks when they ask to see a diff (or 3-way diff) of the configuration file being handled, when actually the diff is displayed on the terminal window ucf was run on. Until the debconf-escape utility and the escape CAPB support, db_subst ran into newline and line length issues. Patch from Michael Vogt. Closes: Bug#325576 * ucf (show_diff): Added a function to show the diff using debconf * ucf (newsum): Use it git-archimport-id: srivasta@debian.org--lenny/ucf--devel--2.0--patch-2
* Preserve file ownership and permissionsManoj Srivastava2007-04-17
| | | | | | | | | | | | | | | | * ucf: As far as possible, preserve file attributes like ownership and permission by using cp -pf instead of just cp -f. * ucf.1: Document that ucf now tries to preserve owner/permission bits for the file. * ucfq.1: Typo fix postinst-->postrm * examples/postrm: Now ucf creates .ucf-new, .ucf-old, and .ucf-dist suffixes, so the example is updated to clean the new names. git-archimport-id: srivasta@debian.org--lenny/ucf--devel--2.0--patch-1
* typo fixManoj Srivastava2007-01-18
| | | | | | | | | * ucf.1: Typo fix * ucf: Typo fix git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--versionfix-1
* canonicalize the path names presentedManoj Srivastava2006-10-23
| | | | | | | | | * ucf (TEMP): Use readlink to canonicalize the path names presented to ucf. This ensures that we keep track of information about the correct file in ucf, even if it is referred to differently (like, multiple ///s, or a/../a/) git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-18
* Emit better diagnostics when readlink fails.Manoj Srivastava2006-06-16
| | | | | | | | | | * ucf (safe_dest_file): Improve the handling of finding a sensible pager. This now handles a messed up /etc/alternatives/paper setting. Also included sensible pager as an alternative, and fall back to /bin/more if needed. (choice_shell): Cater to readlink failures. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-13
* Make better diagnostic outputManoj Srivastava2006-06-06
| | | | | | | | * ucf (safe_dest_file): mention that we are setting the source directory for verbose output. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-12
* Make file name used in grep more regexp safeManoj Srivastava2006-05-03
| | | | | | | | * ucf (safe_dest_file): Use Perl \Q\E mechanisms instead of sed to create a safer version of the file name to use in grep. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-11
* use ucf-{old,dist} instead of dpkg-{old,dist}Manoj Srivastava2006-04-11
| | | | | | | | | | | | | * ucf (DIST_SUFFIX): Added a new variable to hold the suffix we use to denote the maintainers version of a ucf handled file. Used to be dpkg-dist, is now ucf-dist. (NEW_SUFFIX): Added a new variable to hold the suffix we use to denote the new version of the file. Used to be dpkg-new, is now ucf-new. (OLD_SUFFIX): Added a new variable to hold the suffix we use to denote the old version of the file. Used to be dpkg-old, is now ucf-old. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-8
* Allow ucf to be run as non-root.Manoj Srivastava2005-10-20
| | | | | | | | | | | * ucf: Allow ucf to be run as non-root. This entailed not loading debconf related stuff, since that seems to require root privileges. Instead, we just emit a diagnostic and go on. Hopefully this is enough to let the user know when debconf does not work as expected. Also, if ucf is not running as root, automatically transition into the no-action mode, so a non-root user can still be able run ucf in diagnostic mode. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-7
* Added support for side-by-side diffsManoj Srivastava2005-09-20
| | | | | | | | * ucf: Added support for side-by-side diffs, This is very similar to doing a standard diff, apart from calling sdiff instead (and change the option switches around as needed. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-5
* implement an option to always install a missing configuration file.Manoj Srivastava2005-08-08
| | | | | | | | | | | | | | | | * ucf.1: Document UCF_FORCE_CONFFMISS. This environment variable is only applicable when the installed destination file does not exist (perhaps due to user removal),and forces ucf to recreate the missing file (the default behaviour is to honor the users wishes and not recreate the locally deleted file). * ucf: Add code to determine the value of UCF_FORCE_CONFFMISS, looking at the command line, env variable, config file, or default (the default being unset). No command line option is currently available, but the underpinning are there. Replace the destination file, if missing, and iff the variable is set. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-2
* Make ucf quiet if VERBOSE is set to 0Manoj Srivastava2005-06-25
| | | | | | | | | | * ucf (safe_dest_file): Well, setting VERBOSE to 0 is the same as being quiet, according to the man page. Unfortunately, the code actually looked to see if VERBOSE was set (even if set to 0). Now, we unset VERBOSE if the user had set it to 0, making everyone happy. git-archimport-id: srivasta@debian.org--etch/ucf--devel--2.0--patch-1