annotate lib-src/fix-perms.sh @ 5287:cd167465bf69

More permission consistency.
author Stephen J. Turnbull <stephen@xemacs.org>
date Mon, 14 Jun 2010 15:03:08 +0900
parents 4faad22a9fe5
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4947
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
1 #!/bin/sh
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
2 ### fix-perms.sh --- Correct the permissions on XEmacs source/build files
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
3
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
4 # Copyright (C) 2010 Ben Wing.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
5
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
6 # Author: Ben Wing
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
7 # Keywords: internal
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
8
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
9 # This file is part of XEmacs.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
10
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
11 # XEmacs is free software; you can redistribute it and/or modify it
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
12 # under the terms of the GNU General Public License as published by
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
13 # the Free Software Foundation; either version 2, or (at your option)
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
14 # any later version.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
15
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
16 # XEmacs is distributed in the hope that it will be useful, but
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
19 # General Public License for more details.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
20
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
21 # You should have received a copy of the GNU General Public License
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
22 # along with XEmacs; see the file COPYING. If not, write to
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
23 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
24 # Boston, MA 02111-1307, USA.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
25
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
26 ### Commentary:
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
27
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
28 # This program sets the executable bit on all scripts and executable files
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
29 # in the XEmacs source tree, including those that are built.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
30
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
31 ### Code:
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
32
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
33 # List of executable source files in various directories (root, lib-src, etc)
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
34 # other than .sh files. Note that we are free to list files in
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
35 # subdirectories here rather than creating a separate item list"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
36 ROOT_EXES="configure config.guess install-sh move-if-change \
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
37 modules/canna/configure"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
38 LIB_SRC_EXES="ad2c gnuattach gnudoit rcs2log vcdiff *.pl"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
39 ETC_EXES=""
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
40
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
41 LIB_SRC_BUILT_EXES="`cd lib-src; ls -1 *.c | sed 's/\.c$//g'`"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
42 LIB_SRC_BUILT_EXES="minitar ctags $LIB_SRC_BUILT_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
43 SRC_BUILT_EXES="temacs xemacs"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
44
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
45 find . -type f -print0 | xargs -0 chmod a-x
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
46
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
47 for dir in . lib-src etc ; do
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
48 if [ "$dir" = "." ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
49 exes="$ROOT_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
50 elif [ "$dir" = "lib-src" ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
51 exes="$LIB_SRC_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
52 elif [ "$dir" = "etc" ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
53 exes="$ETC_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
54 else
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
55 echo "Error! Don't know how to handle directory '$dir'"; exit 2
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
56 fi
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
57 pwd=`pwd`
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
58 cd $dir
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
59 for x in $exes *.sh ; do
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
60 if [ ! -f $x ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
61 echo "Warning: file '$dir/$x' doesn't exist"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
62 else
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
63 chmod a+x $x
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
64 fi
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
65 done
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
66 cd "$pwd"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
67 done
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
68
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
69 # Now do the built executables. Don't warn or anything if we don't find
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
70 # anything, since they may not be built.
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
71 for dir in lib-src src ; do
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
72 if [ "$dir" = "src" ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
73 exes="$SRC_BUILT_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
74 elif [ "$dir" = "lib-src" ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
75 exes="$LIB_SRC_BUILT_EXES"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
76 else
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
77 echo "Error! Don't know how to handle directory '$dir'"; exit 2
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
78 fi
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
79 pwd=`pwd`
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
80 cd $dir
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
81 for x in $exes *.exe ; do
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
82 if [ -f $x ]; then
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
83 chmod a+x $x
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
84 fi
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
85 done
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
86 cd "$pwd"
4faad22a9fe5 Somehow fix-perms.sh didn't get committed
Ben Wing <ben@xemacs.org>
parents:
diff changeset
87 done