annotate lisp/utils/blessmail.el @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents ac2d302a0011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; blessmail.el --- Decide whether movemail needs special privileges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;; This file is part of XEmacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
11 ;; under the terms of the GNU General Public License as published by
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
18 ;; General Public License for more details.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
25 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; This is loaded into a bare Emacs to create the blessmail script,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; which (on systems that need it) is used during installation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; to give appropriate permissions to movemail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; It has to be done from lisp in order to be sure of getting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; correct value of rmail-spool-directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; These are no longer needed because we run this in emacs instead of temacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; (message "Using load-path %s" load-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; (load "paths.el")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; It is not safe to load site-init.el here, because it might have things in it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; that won't load properly unless all the rest of Emacs is loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (let ((dirname (directory-file-name rmail-spool-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 linkname attr modes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; Check for symbolic link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (while (setq linkname (file-symlink-p dirname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (setq dirname (if (file-name-absolute-p linkname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 linkname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (concat (file-name-directory dirname) linkname))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (insert "#!/bin/sh\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq attr (file-attributes dirname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (if (not (eq t (car attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (insert (format "echo %s is not a directory\n" rmail-spool-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (setq modes (nth 8 attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (cond ((= ?w (aref modes 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; Nothing needs to be done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ((= ?w (aref modes 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (insert "chgrp " (number-to-string (nth 3 attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 " $* && chmod g+s $*\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ((= ?w (aref modes 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (insert "chown " (number-to-string (nth 2 attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 " $* && chmod u+s $*\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (insert "chown root $* && chmod u+s $*\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (insert "echo mail directory = " dirname "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (write-region (point-min) (point-max) "blessmail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (kill-emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; blessmail.el ends here