-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a launcher script to use a config file from a user writeable
area in the home directory. It will also copy the example config in to the same location so that people can use it as a reference.
- Loading branch information
Showing
4 changed files
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
port 1883 | ||
persistence false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
# Wrapper to check for custom config in $SNAP_USER_COMMON and use it | ||
# otherwise fall back to the included basic config which will at least | ||
# allow mosquitto to run and do something. | ||
# This script will also copy the full example config in to SNAP_USER_COMMON | ||
# so that people can refer to it. | ||
|
||
CONFIG_FILE="$SNAP/default_config.conf" | ||
CUSTOM_CONFIG="$SNAP_USER_COMMON/mosquitto.conf" | ||
|
||
|
||
# Copy the example config if it doesn't exist | ||
if [ ! -e "$SNAP_USER_COMMON/mosquitto_example.conf" ] | ||
then | ||
echo "Copying example config to $SNAP_USER_COMMON/mosquitto_example.conf" | ||
echo "You can create a custom config by creating a file called $CUSTOM_CONFIG" | ||
cp $SNAP/mosquitto.conf $SNAP_USER_COMMON/mosquitto_example.conf | ||
fi | ||
|
||
|
||
# Does the custom config exist? If so use it. | ||
if [ -e "$CUSTOM_CONFIG" ] | ||
then | ||
echo "Found config in $CUSTOM_CONFIG" | ||
CONFIG_FILE=$CUSTOM_CONFIG | ||
else | ||
echo "Using default config from $CONFIG_FILE" | ||
fi | ||
|
||
# Launch the snap | ||
$SNAP/usr/local/sbin/mosquitto -c $CONFIG_FILE $@ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters