1 |
hollow 08/02/22 14:06:05 |
2 |
|
3 |
Modified: webapp.eclass |
4 |
Log: |
5 |
use bash keyword for tests; minor cleanups |
6 |
|
7 |
Revision Changes Path |
8 |
1.53 eclass/webapp.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.53&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.53&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?r1=1.52&r2=1.53 |
13 |
|
14 |
Index: webapp.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v |
17 |
retrieving revision 1.52 |
18 |
retrieving revision 1.53 |
19 |
diff -u -r1.52 -r1.53 |
20 |
--- webapp.eclass 22 Feb 2008 13:53:38 -0000 1.52 |
21 |
+++ webapp.eclass 22 Feb 2008 14:06:05 -0000 1.53 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2006 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.52 2008/02/22 13:53:38 hollow Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.53 2008/02/22 14:06:05 hollow Exp $ |
27 |
# |
28 |
# @ECLASS: webapp.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -50,7 +50,7 @@ |
31 |
|
32 |
local my_prefix=${2:+${2}/} |
33 |
|
34 |
- if [ ! -e "${my_prefix}${1}" ]; then |
35 |
+ if [[ ! -e "${my_prefix}${1}" ]]; then |
36 |
msg="ebuild fault: file '${1}' not found" |
37 |
eerror "$msg" |
38 |
eerror "Please report this as a bug at http://bugs.gentoo.org/" |
39 |
@@ -81,12 +81,12 @@ |
40 |
webapp_getinstalltype() { |
41 |
debug-print-function $FUNCNAME $* |
42 |
|
43 |
- if ! use vhosts ; then |
44 |
+ if ! use vhosts; then |
45 |
local my_output |
46 |
|
47 |
my_output="$(webapp_check_installedat)" |
48 |
|
49 |
- if [ "${?}" = "0" ] ; then |
50 |
+ if [[ $? -eq 0 ]]; then |
51 |
# something is already installed there |
52 |
# make sure it isn't the same version |
53 |
|
54 |
@@ -95,8 +95,8 @@ |
55 |
|
56 |
REMOVE_PKG="${my_pn}-${my_pvr}" |
57 |
|
58 |
- if [ "${my_pn}" == "${PN}" ]; then |
59 |
- if [ "${my_pvr}" != "${PVR}" ]; then |
60 |
+ if [[ "${my_pn}" == "${PN}" ]]; then |
61 |
+ if [[ "${my_pvr}" != "${PVR}" ]]; then |
62 |
elog "This is an upgrade" |
63 |
IS_UPGRADE=1 |
64 |
else |
65 |
@@ -124,7 +124,7 @@ |
66 |
debug-print-function $FUNCNAME $* |
67 |
|
68 |
local m="" |
69 |
- for m in "$@" ; do |
70 |
+ for m in "$@"; do |
71 |
webapp_checkfileexists "${m}" "${D}" |
72 |
|
73 |
local MY_FILE="$(webapp_strip_appdir "${m}")" |
74 |
@@ -187,9 +187,9 @@ |
75 |
|
76 |
local a="" |
77 |
local m="" |
78 |
- if [ "${1}" = "-R" ]; then |
79 |
+ if [[ "${1}" == "-R" ]]; then |
80 |
shift |
81 |
- for m in "$@" ; do |
82 |
+ for m in "$@"; do |
83 |
for a in $(find ${D}/${m}); do |
84 |
a=${a/${D}\/\///} |
85 |
webapp_checkfileexists "${a}" "$D" |
86 |
@@ -201,7 +201,7 @@ |
87 |
done |
88 |
done |
89 |
else |
90 |
- for m in "$@" ; do |
91 |
+ for m in "$@"; do |
92 |
webapp_checkfileexists "${m}" "$D" |
93 |
local MY_FILE="$(webapp_strip_appdir "${m}")" |
94 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
95 |
@@ -247,7 +247,7 @@ |
96 |
|
97 |
webapp_checkfileexists "${2}" |
98 |
|
99 |
- if [ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]; then |
100 |
+ if [[ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]]; then |
101 |
mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}" |
102 |
fi |
103 |
|
104 |
@@ -256,8 +256,8 @@ |
105 |
# do NOT change the naming convention used here without changing all |
106 |
# the other scripts that also rely upon these names |
107 |
|
108 |
- if [ -n "${3}" ]; then |
109 |
- elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}" |
110 |
+ if [[ -n "${3}" ]]; then |
111 |
+ elog "(${1}) upgrade script for ${PN}-${3} to ${PVR}" |
112 |
cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
113 |
chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
114 |
else |
115 |
@@ -338,14 +338,14 @@ |
116 |
|
117 |
# are we installing a webapp-config solution over the top of a |
118 |
# non-webapp-config solution? |
119 |
- if ! use vhosts ; then |
120 |
+ if ! use vhosts; then |
121 |
local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}" |
122 |
local my_output |
123 |
|
124 |
- if [ -d "${my_dir}" ] ; then |
125 |
+ if [[ -d "${my_dir}" ]]; then |
126 |
my_output="$(webapp_check_installedat)" |
127 |
|
128 |
- if [ "$?" != "0" ]; then |
129 |
+ if [[ $? -ne 0 ]]; then |
130 |
# okay, whatever is there, it isn't webapp-config-compatible |
131 |
ewarn "You already have something installed in ${my_dir}" |
132 |
ewarn |
133 |
@@ -354,7 +354,7 @@ |
134 |
ewarn |
135 |
ewarn "This ebuild may be overwriting important files." |
136 |
ewarn |
137 |
- elif [ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]; then |
138 |
+ elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then |
139 |
eerror "${my_dir} contains ${my_output}" |
140 |
eerror "I cannot upgrade that" |
141 |
die "Cannot upgrade contents of ${my_dir}" |
142 |
@@ -377,7 +377,7 @@ |
143 |
webapp_read_config |
144 |
|
145 |
# sanity checks, to catch bugs in the ebuild |
146 |
- if [ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]; then |
147 |
+ if [[ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]]; then |
148 |
eerror |
149 |
eerror "This ebuild did not call webapp_src_install() at the end" |
150 |
eerror "of the src_install() function" |
151 |
@@ -390,7 +390,7 @@ |
152 |
die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" |
153 |
fi |
154 |
|
155 |
- if ! use vhosts ; then |
156 |
+ if ! use vhosts; then |
157 |
echo |
158 |
elog "vhosts USE flag not set - auto-installing using webapp-config" |
159 |
|
160 |
@@ -400,10 +400,10 @@ |
161 |
local my_mode=-I |
162 |
webapp_read_config |
163 |
|
164 |
- if [ "${IS_REPLACE}" = "1" ]; then |
165 |
+ if [[ "${IS_REPLACE}" == "1" ]]; then |
166 |
elog "${PN}-${PVR} is already installed - replacing" |
167 |
my_mode=-I |
168 |
- elif [ "${IS_UPGRADE}" = "1" ]; then |
169 |
+ elif [[ "${IS_UPGRADE}" == "1" ]]; then |
170 |
elog "${REMOVE_PKG} is already installed - upgrading" |
171 |
my_mode=-U |
172 |
else |
173 |
@@ -430,8 +430,6 @@ |
174 |
elog |
175 |
elog "For more details, see the webapp-config(8) man page" |
176 |
fi |
177 |
- |
178 |
- return 0 |
179 |
} |
180 |
|
181 |
# @FUNCTION: webapp_pkg_prerm |
182 |
@@ -442,20 +440,16 @@ |
183 |
webapp_pkg_prerm() { |
184 |
debug-print-function $FUNCNAME $* |
185 |
|
186 |
- local my_output |
187 |
- local x |
188 |
- |
189 |
+ local my_output= |
190 |
my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})" |
191 |
+ [[ $? -ne 0 ]] && return |
192 |
|
193 |
- if [ "${?}" != "0" ]; then |
194 |
- return |
195 |
- fi |
196 |
- |
197 |
- if ! use vhosts ; then |
198 |
+ local x |
199 |
+ if ! use vhosts; then |
200 |
|
201 |
- for x in ${my_output} ; do |
202 |
- [ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp" |
203 |
- if [ "${WEB_HOSTNAME}" -a "${WEB_INSTALLDIR}" ]; then |
204 |
+ for x in ${my_output}; do |
205 |
+ [[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp" |
206 |
+ if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then |
207 |
${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} |
208 |
fi |
209 |
done |
210 |
@@ -465,8 +459,8 @@ |
211 |
ewarn "${PN}-${PVR} installed in" |
212 |
ewarn |
213 |
|
214 |
- for x in ${my_output} ; do |
215 |
- [ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp" |
216 |
+ for x in ${my_output}; do |
217 |
+ [[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp" |
218 |
ewarn " ${x}" |
219 |
done |
220 |
fi |
221 |
|
222 |
|
223 |
|
224 |
-- |
225 |
gentoo-commits@l.g.o mailing list |