Gentoo Archives: gentoo-commits

From: Christian Ruppert <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, sh/
Date: Sat, 28 Jan 2012 18:32:35
Message-Id: fb4aa20d053d055a83cf25f07f4185ea79cb7b30.idl0r@gentoo
1 commit: fb4aa20d053d055a83cf25f07f4185ea79cb7b30
2 Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 28 18:32:05 2012 +0000
4 Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 28 18:32:05 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=fb4aa20d
7
8 Use "checkpath -W" instead of dir_writable()
9
10 ---
11 init.d/bootmisc.in | 8 ++++----
12 init.d/consolefont.in | 2 +-
13 init.d/keymaps.in | 2 +-
14 init.d/termencoding.in | 2 +-
15 sh/runscript.sh.in | 5 -----
16 5 files changed, 7 insertions(+), 12 deletions(-)
17
18 diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
19 index d75cb6e..a2afbf9 100644
20 --- a/init.d/bootmisc.in
21 +++ b/init.d/bootmisc.in
22 @@ -20,7 +20,7 @@ cleanup_tmp_dir()
23 if ! [ -d "$dir" ]; then
24 mkdir -p "$dir" || return $?
25 fi
26 - dir_writable "$dir" || return 1
27 + checkpath -W "$dir" || return 1
28 chmod a+rwt "$dir" 2> /dev/null
29 cd "$dir" || return 1
30 if yesno $wipe_tmp; then
31 @@ -117,7 +117,7 @@ start()
32 migrate_to_run /var/run /run
33 fi
34
35 - if dir_writable /var/run; then
36 + if checkpath -W /var/run; then
37 ebegin "Creating user login records"
38 local xtra=
39 [ "$RC_UNAME" = NetBSD ] && xtra=x
40 @@ -159,7 +159,7 @@ start()
41 cleanup_tmp_dir "$tmp"
42 done
43
44 - if dir_writable /tmp; then
45 + if checkpath -W /tmp; then
46 # Make sure our X11 stuff have the correct permissions
47 # Omit the chown as bootmisc is run before network is up
48 # and users may be using lame LDAP auth #139411
49 @@ -172,7 +172,7 @@ start()
50 fi
51
52 if yesno $log_dmesg; then
53 - if $logw || dir_writable /var/log; then
54 + if $logw || checkpath -W /var/log; then
55 # Create an 'after-boot' dmesg log
56 if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
57 dmesg > /var/log/dmesg
58
59 diff --git a/init.d/consolefont.in b/init.d/consolefont.in
60 index 2f046d8..66b780d 100644
61 --- a/init.d/consolefont.in
62 +++ b/init.d/consolefont.in
63 @@ -54,7 +54,7 @@ start()
64 eend $retval
65
66 # Store the last font so we can use it ASAP on boot
67 - if [ $retval -eq 0 ] && dir_writable "$RC_LIBEXECDIR"; then
68 + if [ $retval -eq 0 ] && checkpath -W "$RC_LIBEXECDIR"; then
69 mkdir -p "$RC_LIBEXECDIR"/console
70 for font in /usr/share/consolefonts/"$consolefont".*; do
71 :
72
73 diff --git a/init.d/keymaps.in b/init.d/keymaps.in
74 index 851af5e..a55a0e0 100644
75 --- a/init.d/keymaps.in
76 +++ b/init.d/keymaps.in
77 @@ -63,7 +63,7 @@ start()
78 fi
79
80 # Save the keymapping for use immediately at boot
81 - if dir_writable "$RC_LIBEXECDIR"; then
82 + if checkpath -W "$RC_LIBEXECDIR"; then
83 mkdir -p "$RC_LIBEXECDIR"/console
84 dumpkeys >"$RC_LIBEXECDIR"/console/keymap
85 fi
86
87 diff --git a/init.d/termencoding.in b/init.d/termencoding.in
88 index b421898..af4ed15 100644
89 --- a/init.d/termencoding.in
90 +++ b/init.d/termencoding.in
91 @@ -35,7 +35,7 @@ start()
92 done
93
94 # Save the encoding for use immediately at boot
95 - if dir_writable "$RC_LIBEXECDIR"; then
96 + if checkpath -W "$RC_LIBEXECDIR"; then
97 mkdir -p "$RC_LIBEXECDIR"/console
98 if yesno ${unicode:-${UNICODE}}; then
99 echo "" > "$RC_LIBEXECDIR"/console/unicode
100
101 diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
102 index faa85cc..18bf4c3 100644
103 --- a/sh/runscript.sh.in
104 +++ b/sh/runscript.sh.in
105 @@ -4,11 +4,6 @@
106 # Copyright (c) 2007-2009 Roy Marples <roy@×××××××.name>
107 # Released under the 2-clause BSD license.
108
109 -dir_writable()
110 -{
111 - mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
112 -}
113 -
114 sourcex()
115 {
116 if [ "$1" = "-e" ]; then