Skip to content

Commit b64b4ef

Browse files
committed
Merge pull request #107 from sandain/master
Display the correct program name
2 parents 713dc98 + fa6ff3a commit b64b4ef

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

mscs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# This is a wrapper to msctl that imitates traditional mscs behaviour:
1313
# uses the same default user, config file and location.
1414

15+
# Get executable name
16+
PROG=$(basename $0)
17+
1518
# Load the mscs default file if it exists.
1619
MSCS_DEFAULTS="/etc/default/mscs"
1720
if [ -r $MSCS_DEFAULTS ]; then
@@ -26,7 +29,7 @@ USER_NAME=${USER_NAME:-minecraft}
2629
LOCATION=${LOCATION:-"/opt/mscs"}
2730

2831
# Setup the arguments to the msctl script.
29-
MSCS_ARGS="$MSCS_ARGS-l $LOCATION $@"
32+
MSCS_ARGS="-p $PROG -l $LOCATION $MSCS_ARGS $@"
3033

3134
# Run the msctl script.
3235
if [ "$USER_NAME" = "$(whoami)" ]; then

msctl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ EOF
147147
# ---------------------------------------------------------------------------
148148
while [ "$1" != "${1#-}" ]; do
149149
case "$1" in
150+
-p)
151+
if [ -n "$2" ]; then
152+
PROG="$2"
153+
shift
154+
else
155+
echo "$PROG: '-p' needs a program name argument."
156+
exit 1
157+
fi
158+
;;
150159
-c)
151160
if [ -n "$2" ]; then
152161
MSCS_DEFAULTS_CL="$2"

0 commit comments

Comments
 (0)