- up to 1.6.15
[packages/env-update.git] / env-update.patch
1 --- rc-scripts-1.6.14.fix/sbin/env-update.sh    2006-03-25 00:49:08.000000000 +0200
2 +++ rc-scripts-1.6.14/sbin/env-update.sh        2006-09-05 21:24:53.230270433 +0300
3 @@ -1,13 +1,13 @@
4 -#!/bin/bash
5 +#!/bin/sh
6  # Copyright 1999-2004 Gentoo Foundation
7  # Distributed under the terms of the GNU General Public License v2
8 +# Copyright 2006 PLD Linux
9  # $Header$
10  
11 -source /etc/init.d/functions.sh || exit 1
12 +. /etc/rc.d/init.d/functions || exit 1
13  
14 -if [ "${EUID}" -ne 0 ]
15 -then
16 -       eerror "$0: must be root."
17 +if [ "$(id -u)" != 0 ]; then
18 +       nls "%s: must be root." $0
19         exit 1
20  fi
21  
22 @@ -17,27 +17,47 @@
23  note:
24 -      This utility generates /etc/profile.env and /etc/csh.env
25 -      from the contents of /etc/env.d/
26 +         This utility generates /etc/profile.env and /etc/csh.env
27 +         from the contents of /etc/env.d/
28  "
29         exit 1
30  }
31  
32 -export SVCDIR="${svcdir}"
33 +# bool is_older_than(reference, files/dirs to check)
34 +#
35 +#   return 0 if any of the files/dirs are newer than
36 +#   the reference file
37 +#
38 +#   EXAMPLE: if is_older_than a.out *.o ; then ...
39 +is_older_than() {
40 +       local x=
41 +       local ref="$1"
42 +       shift
43 +
44 +       for x in "$@" ; do
45 +               [[ ${x} -nt ${ref} ]] && return 0
46 +
47 +               if [[ -d ${x} ]] ; then
48 +                       is_older_than "${ref}" "${x}"/* && return 0
49 +               fi
50 +       done
51 +
52 +       return 1
53 +}
54 +
55 +export SVCDIR="/var/cache"
56  
57  # Only update if files have actually changed
58 -if [ "$1" == "-u" ]
59 -then
60 +if [ "$1" == "-u" ]; then
61         is_older_than "${svcdir}/envcache" /etc/env.d && exit 0
62         shift
63  fi
64  
65 -if [ "$#" -ne 0 ]
66 -then
67 +if [ "$#" -ne 0 ]; then
68         usage
69  else
70 -       /bin/gawk \
71 -               -f /lib/rcscripts/awk/functions.awk \
72 -               -f /lib/rcscripts/awk/genenviron.awk
73 +       umask 002
74 +       gawk \
75 +               -f /lib/functions.awk \
76 +               -f /lib/genenviron.awk
77  fi
78  
79 -
80  # vim:ts=4
81 --- rc-scripts-1.6.14/src/awk/genenviron.awk    2005-09-10 05:28:19.000000000 +0300
82 +++ /usr/lib/genenviron.awk     2006-03-25 00:42:33.000000000 +0200
83 @@ -3,7 +3,7 @@
84  
85  BEGIN {
86  
87 -       extension("/lib/rcscripts/filefuncs.so", "dlload")
88 +       extension("/lib/filefuncs.so", "dlload")
89  
90         # Get our environment variables
91         SVCDIR = ENVIRON["SVCDIR"]
92 --- rc-scripts-1.6.14/src/awk/genenviron.awk    2006-04-30 14:30:43.608236656 +0300
93 +++ rc-scripts-1.6.14/src/awk/genenviron.awk    2006-09-01 02:12:10.772056818 +0300
94 @@ -29,7 +29,7 @@
95                 if (x in TMPENVFILES) {
96                 
97                         if ((isfile(TMPENVFILES[x])) &&
98 -                           (TMPENVFILES[x] !~ /((\.(sh|c|bak))|\~)$/)) {
99 +                           (TMPENVFILES[x] !~ /((\.(sh|c|bak|rpm(new|save|orig)))|\~)$/)) {
100  
101                                 ENVCOUNT++
102  
103 @@ -160,7 +160,7 @@
104         print "" >> (CSHPROFILE)
105  
106  
107 -       pipe = "bash " ENVCACHE
108 +       pipe = "sh " ENVCACHE
109         while ((pipe | getline) > 0) {
110  
111                 sub(/=/, "='")
This page took 0.092338 seconds and 3 git commands to generate.