Skip to content

Commit 9dd57c2

Browse files
author
John Kinsella
committed
CLOUDSTACK-6129: removing hard-coded script names
Replacing whatami with $0 which is how UNIX shell scripts should get the script's name. BUG-ID: CLOUDSTACK-6129 Bugfix-for: Reviewed-by: Reported-by: Signed-off-by: John Kinsella <jlk@stratosec.co> 1392660036 -0800
1 parent 9f72443 commit 9dd57c2

17 files changed

Lines changed: 51 additions & 85 deletions

File tree

agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424

2525
. /etc/rc.d/init.d/functions
2626

27-
whatami=cloud-agent
28-
2927
# set environment variables
3028

31-
SHORTNAME="$whatami"
32-
PIDFILE=@PIDDIR@/"$whatami".pid
29+
SHORTNAME="$0"
30+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3331
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
3432
LOGFILE=@AGENTLOG@
3533
PROGNAME="Cloud Agent"
@@ -114,7 +112,7 @@ case "$1" in
114112
fi
115113
;;
116114
*)
117-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
115+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
118116
RETVAL=3
119117
esac
120118

agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424

2525
. /etc/rc.d/init.d/functions
2626

27-
whatami=cloud-agent
28-
2927
# set environment variables
3028

31-
SHORTNAME="$whatami"
32-
PIDFILE=@PIDDIR@/"$whatami".pid
29+
SHORTNAME="$0"
30+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3331
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
3432
LOGFILE=@AGENTLOG@
3533
PROGNAME="Cloud Agent"
@@ -114,7 +112,7 @@ case "$1" in
114112
fi
115113
;;
116114
*)
117-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
115+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
118116
RETVAL=3
119117
esac
120118

agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@
3131
. /lib/lsb/init-functions
3232
. /etc/rc.status
3333

34-
whatami=cloud-agent
35-
3634
# set environment variables
3735

38-
SHORTNAME="$whatami"
39-
PIDFILE=@PIDDIR@/"$whatami".pid
36+
SHORTNAME="$0"
37+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
4038
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
4139
LOGFILE=@AGENTLOG@
4240
PROGNAME="Cloud Agent"
@@ -166,7 +164,7 @@ case "$1" in
166164
start
167165
;;
168166
*)
169-
echo $"Usage: $whatami {start|stop|restart|status|help}"
167+
echo $"Usage: $SHORTNAME {start|stop|restart|status|help}"
170168
RETVAL=3
171169
esac
172170

agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424

2525
. /etc/rc.d/init.d/functions
2626

27-
whatami=cloud-agent
28-
2927
# set environment variables
3028

31-
SHORTNAME="$whatami"
32-
PIDFILE=@PIDDIR@/"$whatami".pid
29+
SHORTNAME="$0"
30+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3331
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
3432
LOGFILE=@AGENTLOG@
3533
PROGNAME="Cloud Agent"
@@ -114,7 +112,7 @@ case "$1" in
114112
fi
115113
;;
116114
*)
117-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
115+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
118116
RETVAL=3
119117
esac
120118

agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@
3131
. /lib/lsb/init-functions
3232
. /etc/rc.status
3333

34-
whatami=cloud-agent
35-
3634
# set environment variables
3735

38-
SHORTNAME="$whatami"
39-
PIDFILE=@PIDDIR@/"$whatami".pid
36+
SHORTNAME="$0"
37+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
4038
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
4139
LOGFILE=@AGENTLOG@
4240
PROGNAME="Cloud Agent"
@@ -166,7 +164,7 @@ case "$1" in
166164
start
167165
;;
168166
*)
169-
echo $"Usage: $whatami {start|stop|restart|status|help}"
167+
echo $"Usage: $SHORTNAME {start|stop|restart|status|help}"
170168
RETVAL=3
171169
esac
172170

packaging/centos63/cloud-agent.rc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424

2525
. /etc/rc.d/init.d/functions
2626

27-
whatami=cloudstack-agent
28-
2927
# set environment variables
3028

31-
SHORTNAME="$whatami"
32-
PIDFILE=/var/run/"$whatami".pid
29+
SHORTNAME="$0"
30+
PIDFILE=/var/run/"$SHORTNAME".pid
3331
LOCKFILE=/var/lock/subsys/"$SHORTNAME"
3432
LOGDIR=/var/log/cloudstack/agent
3533
LOGFILE=${LOGDIR}/agent.log
@@ -112,7 +110,7 @@ case "$1" in
112110
fi
113111
;;
114112
*)
115-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
113+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
116114
RETVAL=3
117115
esac
118116

packaging/centos63/cloud-ipallocator.rc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323

2424
. /etc/rc.d/init.d/functions
2525

26-
whatami=cloud-external-ipallocator
27-
2826
# set environment variables
2927

30-
SHORTNAME="$whatami"
31-
PIDFILE=/var/run/"$whatami".pid
28+
SHORTNAME="$0"
29+
PIDFILE=/var/run/"$SHORTNAME".pid
3230
LOCKFILE=/var/lock/subsys/"$SHORTNAME"
3331
LOGFILE=/var/log/cloudstack/ipallocator/ipallocator.log
3432
PROGNAME="External IPAllocator"
@@ -90,7 +88,7 @@ case "$1" in
9088
fi
9189
;;
9290
*)
93-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
91+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
9492
RETVAL=3
9593
esac
9694

python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323

2424
. /etc/rc.d/init.d/functions
2525

26-
whatami=cloud-external-ipallocator
27-
2826
# set environment variables
2927

30-
SHORTNAME="$whatami"
31-
PIDFILE=@PIDDIR@/"$whatami".pid
28+
SHORTNAME="$0"
29+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3230
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
3331
LOGFILE=@IPALOCATORLOG@
3432
PROGNAME="External IPAllocator"
@@ -90,7 +88,7 @@ case "$1" in
9088
fi
9189
;;
9290
*)
93-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
91+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
9492
RETVAL=3
9593
esac
9694

python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323

2424
. /etc/rc.d/init.d/functions
2525

26-
whatami=cloud-external-ipallocator
27-
2826
# set environment variables
2927

30-
SHORTNAME="$whatami"
31-
PIDFILE=@PIDDIR@/"$whatami".pid
28+
SHORTNAME="$0"
29+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3230
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
3331
LOGFILE=@AGENTLOG@
3432
PROGNAME="Cloud Agent"
@@ -90,7 +88,7 @@ case "$1" in
9088
fi
9189
;;
9290
*)
93-
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
91+
echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}"
9492
RETVAL=3
9593
esac
9694

python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
. /lib/lsb/init-functions
3131
. /etc/rc.status
3232

33-
whatami=cloud-external-ipallocator
34-
3533
# set environment variables
3634

37-
SHORTNAME="$whatami"
38-
PIDFILE=@PIDDIR@/"$whatami".pid
35+
SHORTNAME="$0"
36+
PIDFILE=@PIDDIR@/"$SHORTNAME".pid
3937
LOCKFILE=@LOCKDIR@/"$SHORTNAME"
4038
LOGFILE=@AGENTLOG@
4139
PROGNAME="Cloud Agent"
@@ -110,7 +108,7 @@ case "$1" in
110108
start
111109
;;
112110
*)
113-
echo $"Usage: $whatami {start|stop|restart|status|help}"
111+
echo $"Usage: $SHORTNAME {start|stop|restart|status|help}"
114112
RETVAL=3
115113
esac
116114

0 commit comments

Comments
 (0)