07_log_to_file_by_default.dpatch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #! /bin/sh -e
  2. ## 07_log_to_file_by_default.dpatch by <weasel@debian.org>
  3. ##
  4. ## All lines beginning with `## DP:' are a description of the patch.
  5. ## DP: Change default logging target from stdout to a logfile
  6. if [ $# -lt 1 ]; then
  7. echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
  8. exit 1
  9. fi
  10. [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
  11. patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
  12. case "$1" in
  13. -patch) patch -p1 ${patch_opts} < $0;;
  14. -unpatch) patch -R -p1 ${patch_opts} < $0;;
  15. *)
  16. echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
  17. exit 1;;
  18. esac
  19. exit 0
  20. @DPATCH@
  21. diff -urNad tor~/src/or/config.c tor/src/or/config.c
  22. --- tor~/src/or/config.c 2006-07-24 05:15:02.576170550 +0200
  23. +++ tor/src/or/config.c 2006-07-24 05:18:45.286651501 +0200
  24. @@ -2118,8 +2118,13 @@
  25. REJECT("Failed to normalize old Log options. See logs for details.");
  26. /* Special case on first boot if no Log options are given. */
  27. - if (!options->Logs && !options->RunAsDaemon && !from_setconf)
  28. - config_line_append(&options->Logs, "Log", "notice stdout");
  29. + if (debian_running_as_debiantor()) {
  30. + if (!options->Logs && !from_setconf)
  31. + config_line_append(&options->Logs, "Log", "notice file /var/log/tor/log");
  32. + } else {
  33. + if (!options->Logs && !options->RunAsDaemon && !from_setconf)
  34. + config_line_append(&options->Logs, "Log", "notice stdout");
  35. + }
  36. if (options_init_logs(options, 1)<0) /* Validate the log(s) */
  37. REJECT("Failed to validate Log options. See logs for details.");