]> git.pld-linux.org Git - packages/env-update.git/blob - env-update.patch
- pldize
[packages/env-update.git] / env-update.patch
1 --- rc-scripts-1.6.14/sbin/env-update.sh        2004-12-03 05:56:17.000000000 +0200
2 +++ rc-scripts-1.6.14.fix/sbin/env-update.sh    2006-03-25 00:49:08.000000000 +0200
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 @@ -15,29 +15,48 @@
23  echo "usage: env-update.sh
24  
25  note:
26 -      This utility generates /etc/profile.env and /etc/csh.env
27 -      from the contents of /etc/env.d/
28 +         This utility generates /etc/profile.env and /etc/csh.env
29 +         from the contents of /etc/env.d/
30  "
31         exit 1
32  }
33  
34 -export SVCDIR="${svcdir}"
35 +# bool is_older_than(reference, files/dirs to check)
36 +#
37 +#   return 0 if any of the files/dirs are newer than
38 +#   the reference file
39 +#
40 +#   EXAMPLE: if is_older_than a.out *.o ; then ...
41 +is_older_than() {
42 +       local x=
43 +       local ref="$1"
44 +       shift
45 +
46 +       for x in "$@" ; do
47 +               [[ ${x} -nt ${ref} ]] && return 0
48 +
49 +               if [[ -d ${x} ]] ; then
50 +                       is_older_than "${ref}" "${x}"/* && return 0
51 +               fi
52 +       done
53 +
54 +       return 1
55 +}
56 +
57 +export SVCDIR="/var/cache"
58  
59  # Only update if files have actually changed
60 -if [ "$1" == "-u" ]
61 -then
62 +if [ "$1" == "-u" ]; then
63         is_older_than "${svcdir}/envcache" /etc/env.d && exit 0
64         shift
65  fi
66  
67 -if [ "$#" -ne 0 ]
68 -then
69 +if [ "$#" -ne 0 ]; then
70         usage
71  else
72 -       /bin/gawk \
73 -               -f /lib/rcscripts/awk/functions.awk \
74 -               -f /lib/rcscripts/awk/genenviron.awk
75 +       gawk \
76 +               -f /usr/lib/functions.awk \
77 +               -f /usr/lib/genenviron.awk
78  fi
79  
80 -
81  # vim:ts=4
82 --- rc-scripts-1.6.14/src/awk/genenviron.awk    2005-09-10 05:28:19.000000000 +0300
83 +++ /usr/lib/genenviron.awk     2006-03-25 00:42:33.000000000 +0200
84 @@ -3,7 +3,7 @@
85  
86  BEGIN {
87  
88 -       extension("/lib/rcscripts/filefuncs.so", "dlload")
89 +       extension("/usr/lib/filefuncs.so", "dlload")
90  
91         # Get our environment variables
92         SVCDIR = ENVIRON["SVCDIR"]
This page took 0.061905 seconds and 4 git commands to generate.