[prev in list] [next in list] [prev in thread] [next in thread]
List: luci-commits
Subject: [Luci-commits] [luci/pkg-update] initscript, spec: normalized redirection
From: jpokorny () fedoraproject ! org (Jan Pokorny)
Date: 2010-11-30 20:32:15
Message-ID: 20101130203216.09693120284 () lists ! fedorahosted ! org
[Download RAW message or body]
commit 1a49319970f8b7de8b935826cd74ebae4cd72e08
Author: Jan Pokorny <jpokorny at redhat.com>
Date: Tue Nov 30 21:29:13 2010 +0100
initscript, spec: normalized redirection
- ">/dev/null" instead of "> /dev/null"
- "&>" instead of ">&" (this preference taken from man bash)
- scriptlets in spec now uses inline "|| :" instead of standalone
"exit 0" (where applicable)
input_files/initscript/initscript.in | 46 +++++++++++++++++-----------------
luci.spec | 10 +++----
2 files changed, 27 insertions(+), 29 deletions(-)
---
diff --git a/input_files/initscript/initscript.in \
b/input_files/initscript/initscript.in index 689d893..373cf95 100755
--- a/input_files/initscript/initscript.in
+++ b/input_files/initscript/initscript.in
@@ -7,13 +7,13 @@
#
#
### BEGIN INIT INFO
-# Provides: luci
-# Required-Start: $named $network $time
-# Required-Stop: $network $time
+# Provides: luci
+# Required-Start: $named $network $time
+# Required-Stop: $network $time
# Default-Start:
# Default-Stop:
-# Short-Description: Starts and stops luci
-# Description: Starts and stops the luci high availability management \
application +# Short-Description: Starts and stops luci
+# Description: Starts and stops the luci high availability management application
### END INIT INFO
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin"
@@ -79,7 +79,7 @@ luci_certconfig_complete() {
for IP_ADDR in $IP_ADDRS; do
DOM_NAME=$(python -c "from socket import getfqdn; \
print(getfqdn('$IP_ADDR'))" 2>/dev/null) if [ -n "$DOM_NAME" -a "$DOM_NAME" != \
"$IP_ADDR" ]; then
- echo "DNS.$CNT_DOM_NAME = $DOM_NAME" >> "$LUCI_CERT_CONFIG"
+ echo "DNS.$CNT_DOM_NAME = $DOM_NAME" >>"$LUCI_CERT_CONFIG"
echo -e "\tDNS: $DOM_NAME"
let CNT_DOM_NAME++
fi
@@ -90,12 +90,12 @@ luci_certconfig_complete() {
# with this IP
for IP_ADDR in $IP_ADDRS; do
if [ "$IP_ADDR" == "$LUCI_HOST" ]; then
- echo "IP.$CNT_IP_ADDR = $IP_ADDR" >> "$LUCI_CERT_CONFIG"
+ echo "IP.$CNT_IP_ADDR = $IP_ADDR" >>"$LUCI_CERT_CONFIG"
echo -e "\tIP: $IP_ADDR"
let CNT_IP_ADDR++
DOM_NAME=$(python -c "from socket import getfqdn; \
print(getfqdn('$IP_ADDR'))" 2>/dev/null)
if [ -n "$DOM_NAME" -a "$DOM_NAME" != "$IP_ADDR" ]; then
- echo "DNS.$CNT_DOM_NAME = $DOM_NAME" >> "$LUCI_CERT_CONFIG"
+ echo "DNS.$CNT_DOM_NAME = $DOM_NAME" >>"$LUCI_CERT_CONFIG"
echo -e "\tDNS: $DOM_NAME"
let CNT_DOM_NAME++
fi
@@ -117,16 +117,16 @@ luci_certconfig_complete() {
luci_init() {
# Ensure existence of base configuration file
if [ ! -f "$LUCI_BASE_CONFIG" ]; then
- /usr/bin/paster make-config luci "$LUCI_BASE_CONFIG" --no-default-sysconfig \
--no-install >& /dev/null + /usr/bin/paster make-config luci \
"$LUCI_BASE_CONFIG" --no-default-sysconfig --no-install &>/dev/null if [ $? -ne 0 ]; \
then
- rm -f -- "$LUCI_BASE_CONFIG" >& /dev/null
+ rm -f -- "$LUCI_BASE_CONFIG" &>/dev/null
echo "Unable to create the luci base configuration file."
return 1
fi
chown $LUCI_USER:$LUCI_GROUP "$LUCI_BASE_CONFIG" \
&& chmod 600 "$LUCI_BASE_CONFIG"
if [ $? -ne 0 ]; then
- rm -f -- "$LUCI_BASE_CONFIG" >& /dev/null
+ rm -f -- "$LUCI_BASE_CONFIG" &>/dev/null
echo "Unable to change ownership/attributes of the luci base \
configuration file." return 1
fi
@@ -134,16 +134,16 @@ luci_init() {
# Ensure the existence of database file
if [ ! -f "$LUCI_DB_FILE" ]; then
- /usr/bin/paster setup-app "$LUCI_BASE_CONFIG" --no-default-sysconfig \
--no-install >& /dev/null + /usr/bin/paster setup-app "$LUCI_BASE_CONFIG" \
--no-default-sysconfig --no-install &>/dev/null if [ $? -ne 0 ]; then
- rm -f -- "$LUCI_DB_FILE" >& /dev/null
+ rm -f -- "$LUCI_DB_FILE" &>/dev/null
echo "Unable to create the luci database file."
return 1
fi
chown $LUCI_USER:$LUCI_GROUP "$LUCI_DB_FILE" \
&& chmod 600 "$LUCI_DB_FILE"
if [ $? -ne 0 ]; then
- rm -f -- "$LUCI_DB_FILE" >& /dev/null
+ rm -f -- "$LUCI_DB_FILE" &>/dev/null
echo "Unable to change ownership/attributes of the luci database file."
return 1
fi
@@ -163,7 +163,7 @@ luci_init() {
if [ ! -f "$LUCI_CERT_PEM" ]; then
# Generate the SSL certificate (PEM file containing also private key)
luci_certconfig_complete
- : > "$LUCI_CERT_RND"
+ : >"$LUCI_CERT_RND"
RANDFILE="$LUCI_CERT_RND" /usr/bin/openssl req \
-new -x509 -nodes -sha1 \
-newkey rsa:"$LUCI_CERT_KEY_BITS" \
@@ -173,16 +173,16 @@ luci_init() {
-keyout "$LUCI_CERT_PEM" \
-out "$LUCI_CERT_PEM" 2>&1 | sed "/^[.+-]/d"
if [ $? -ne 0 ]; then
- rm -f -- "$LUCI_CERT_PEM" "$LUCI_CERT_RND" >& /dev/null
+ rm -f -- "$LUCI_CERT_PEM" "$LUCI_CERT_RND" &>/dev/null
echo "Unable to generate the luci host certificate file."
return 1
else
- rm -f -- "$LUCI_CERT_RND" >& /dev/null
+ rm -f -- "$LUCI_CERT_RND" &>/dev/null
fi
chown $LUCI_USER:$LUCI_GROUP "$LUCI_CERT_PEM" \
&& chmod 600 "$LUCI_CERT_PEM"
if [ $? -ne 0 ]; then
- rm -f -- "$LUCI_CERT_PEM" >& /dev/null
+ rm -f -- "$LUCI_CERT_PEM" &>/dev/null
echo "Unable to change ownership/attributes of the luci host certificate \
file." return 1
fi
@@ -192,9 +192,9 @@ luci_init() {
}
luci_start_server() {
- service saslauthd start >&/dev/null
+ service saslauthd start &>/dev/null
- luci_status >& /dev/null
+ luci_status &>/dev/null
if [ $? -eq 0 ]; then
# echo already started
return 0
@@ -205,7 +205,7 @@ luci_start_server() {
}
luci_stop() {
- luci_status >& /dev/null
+ luci_status &>/dev/null
if [ $? -ne 0 ]; then
# already stopped
return 0
@@ -216,7 +216,7 @@ luci_stop() {
}
luci_restart() {
- luci_status >& /dev/null
+ luci_status &>/dev/null
if [ $? -eq 0 ]; then
luci_stop || return 1
fi
@@ -271,7 +271,7 @@ restart|reload|force-reload)
ret=$?
;;
condrestart)
- luci_status >& /dev/null
+ luci_status &>/dev/null
if [ $? -eq 0 ]; then
luci_restart
ret=$?
diff --git a/luci.spec b/luci.spec
index 506345a..2548702 100644
--- a/luci.spec
+++ b/luci.spec
@@ -217,21 +217,19 @@ fi
exit 0
%post
-/sbin/chkconfig --add "%{luciservice}"
-exit 0
+/sbin/chkconfig --add "%{luciservice}" || :
%preun
if [ "$1" == "0" ]; then
- /sbin/service "%{luciservice}" stop >&/dev/null
+ /sbin/service "%{luciservice}" stop &>/dev/null
/sbin/chkconfig --del "%{luciservice}"
fi
exit 0
%postun
-if [ "$1" == "1" ]; then
- /sbin/service "%{luciservice}" condrestart >&/dev/null
+if [ "$1" -ge "1" ]; then
+ /sbin/service "%{luciservice}" condrestart &>/dev/null || :
fi
-exit 0
%changelog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic