提交 e62bf8fc 编写于 作者: sangshuduo's avatar sangshuduo

add taoswrapper and install hook. now it works.

上级 f1bd15fa
#!/bin/sh
if [ ! -d /var/lib/taos ]; then
mkdir -p /var/lib/taos
fi
if [ ! -d /var/log/taos ]; then
mkdir -p -m777 /var/log/taos
fi
if [ ! -d /etc/taos ]; then
mkdir -p /etc/taos
fi
if [ ! -f /etc/taos/taos.cfg ]; then
cp $SNAP/etc/taos/taos.cfg /etc/taos/taos.cfg
fi
...@@ -15,7 +15,11 @@ case "$SNAP_USER_COMMON" in ...@@ -15,7 +15,11 @@ case "$SNAP_USER_COMMON" in
*) COMMON=$SNAP_USER_COMMON ;; *) COMMON=$SNAP_USER_COMMON ;;
esac esac
CONFIG_FILE="$SNAP/etc/taos" if [ -d /etc/taos ]; then
CONFIG_FILE="/etc/taos"
else
CONFIG_FILE="$SNAP/etc/taos"
fi
# Launch the snap # Launch the snap
$SNAP/usr/bin/taosd -c $CONFIG_FILE $@ $SNAP/usr/bin/taosd -c $CONFIG_FILE $@
#!/bin/sh
# Wrapper to check for custom config in $SNAP_USER_COMMON or $SNAP_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 or
# SNAP_COMMON so that people can refer to it.
#
# The decision about whether to use SNAP_USER_COMMON or SNAP_COMMON is taken
# based on the user that runs the command. If the user is root, it is assumed
# that mosquitto is being run as a system daemon, and SNAP_COMMON will be used.
# If a non-root user runs the command, then SNAP_USER_COMMON will be used.
case "$SNAP_USER_COMMON" in
*/root/snap/tdengine/common*) COMMON=$SNAP_COMMON ;;
*) COMMON=$SNAP_USER_COMMON ;;
esac
if [ -d /etc/taos ]; then
CONFIG_FILE="/etc/taos"
else
CONFIG_FILE="$SNAP/etc/taos"
fi
# Launch the snap
$SNAP/usr/bin/taos -c $CONFIG_FILE $@
name: tdengine name: tdengine
base: core18 # the base snap is the execution environment for this snap base: core18 # the base snap is the execution environment for this snap
version: '2.0.0.6' # just for humans, typically '1.2+git' or '1.3.2' version: '2.0.0.6' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary summary: an open-source big data platform designed and optimized for IoT.
description: | description: |
TDengine is an open-source big data platform designed and optimized for Internet of Things (IoT), Connected Vehicles, and Industrial IoT. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and costs of development and operations. TDengine is an open-source big data platform designed and optimized for Internet of Things (IoT), Connected Vehicles, and Industrial IoT. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and costs of development and operations.
...@@ -16,19 +16,25 @@ apps: ...@@ -16,19 +16,25 @@ apps:
plugs: plugs:
- network - network
- network-bind - network-bind
- system-observe
- systemfiles - systemfiles
taos: taos:
command: usr/bin/taos command: taoswrapper.sh
plugs: plugs:
- network - network
- systemfiles - systemfiles
taosdemo:
command: usr/bin/taosdemo
plugs:
- network
plugs: plugs:
systemfiles: systemfiles:
interface: system-files interface: system-files
read: read:
- /etc/taos - /etc
- /var/lib/taos - /var/lib/taos
- /tmp - /tmp
write: write:
...@@ -42,6 +48,7 @@ parts: ...@@ -42,6 +48,7 @@ parts:
source: snap/local/ source: snap/local/
prime: prime:
- launcher.sh - launcher.sh
- taoswrapper.sh
tdengine: tdengine:
source: . source: .
...@@ -57,12 +64,21 @@ parts: ...@@ -57,12 +64,21 @@ parts:
if [ ! -d $SNAPCRAFT_STAGE/usr ]; then if [ ! -d $SNAPCRAFT_STAGE/usr ]; then
mkdir $SNAPCRAFT_STAGE/usr mkdir $SNAPCRAFT_STAGE/usr
fi fi
if [ ! -d $SNAPCRAFT_STAGE/etc/taos ]; then if [ ! -d $SNAPCRAFT_STAGE/etc/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/etc/taos mkdir -p $SNAPCRAFT_STAGE/etc/taos
fi fi
cp $SNAPCRAFT_PART_BUILD/build/* -rf $SNAPCRAFT_STAGE/usr/ cp $SNAPCRAFT_PART_BUILD/build/* -rf $SNAPCRAFT_STAGE/usr/
cp $SNAPCRAFT_PART_SRC/packaging/cfg/taos.cfg -rf $SNAPCRAFT_STAGE/etc/taos/ cp $SNAPCRAFT_PART_SRC/packaging/cfg/taos.cfg -rf $SNAPCRAFT_STAGE/etc/taos/
if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/var/lib/taos
fi
if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/var/log/taos
fi
prime: prime:
- etc/taos/taos.cfg - etc/taos/taos.cfg
- usr/bin/taosd - usr/bin/taosd
...@@ -72,7 +88,24 @@ parts: ...@@ -72,7 +88,24 @@ parts:
- usr/lib/libtaos.so.1 - usr/lib/libtaos.so.1
- usr/lib/libtaos.so - usr/lib/libtaos.so
override-prime: |
snapcraftctl prime
if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then
cp -rf $SNAPCRAFT_STAGE/var/lib/taos $SNAPCRAFT_PRIME
fi
if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then
cp -rf $SNAPCRAFT_STAGE/var/log/taos $SNAPCRAFT_PRIME
fi
layout:
/var/lib/taos:
bind: $SNAP_DATA/var/lib/taos
/var/log/taos:
bind: $SNAP_DATA/var/log/taos
/etc/taos/taos.cfg:
bind-file: $SNAP_DATA/etc/taos/taos.cfg
#layout: hooks:
# usr/bin/taosd: install:
#bind-file: debug/build/bin/taosd plugs: [systemfiles]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册