Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
cdist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ungleich-public
cdist
Commits
07df829b
Commit
07df829b
authored
Feb 26, 2020
by
fnux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import __matterbridge type
parent
b8266d5a
Pipeline
#953
passed with stage
in 52 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
0 deletions
+176
-0
cdist/conf/type/__matterbridge/files/matterbridge.service.sh
cdist/conf/type/__matterbridge/files/matterbridge.service.sh
+18
-0
cdist/conf/type/__matterbridge/man.rst
cdist/conf/type/__matterbridge/man.rst
+56
-0
cdist/conf/type/__matterbridge/manifest
cdist/conf/type/__matterbridge/manifest
+100
-0
cdist/conf/type/__matterbridge/parameter/required
cdist/conf/type/__matterbridge/parameter/required
+2
-0
cdist/conf/type/__matterbridge/singleton
cdist/conf/type/__matterbridge/singleton
+0
-0
No files found.
cdist/conf/type/__matterbridge/files/matterbridge.service.sh
0 → 100755
View file @
07df829b
#!/bin/sh
cat
<<
EOF
[Unit]
Description=IM bridging daemon
Wants=network-online.target
After=network-online.target
[Service]
User=
$USER
Group=
$GROUP
Type=simple
Restart=on-failure
ExecStart=
$BINARY_PATH
-conf=/etc/matterbridge/matterbridge.toml
[Install]
WantedBy=multi-user.target
EOF
cdist/conf/type/__matterbridge/man.rst
0 → 100644
View file @
07df829b
cdist-type__matterbridge(7)
===========================
NAME
----
cdist-type__matterbridge - Install matterbridge from upstream binary
DESCRIPTION
-----------
This singleton type install a matterbridge service from binary.
REQUIRED PARAMETERS
-------------------
version
Release (git tag) to fetch from the project github's page.
config
Matterbridge configuration (TOML).
OPTIONAL PARAMETERS
-------------------
None.
BOOLEAN PARAMETERS
------------------
None.
EXAMPLES
--------
.. code-block:: sh
__matterbridge --version 1.16.3 --config - << EOF
[...]
EOF
SEE ALSO
--------
- `Matterbridge github repository <https://github.com/42wim/matterbridge>`_
AUTHORS
-------
Timothée Floure <timothee.floure@ungleich.ch>
COPYING
-------
Copyright \(C) 2020 Timothée Floure. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
cdist/conf/type/__matterbridge/manifest
0 → 100755
View file @
07df829b
#!/bin/sh -e
#
# 2020 Timothée Floure (timothee.floure@ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os
=
$(
cat
"
$__global
/explorer/os"
)
case
"
$os
"
in
debian
)
# This type assume systemd for service installation.
;;
*
)
printf
"Your operating system (%s) is currently not supported by this type (%s)
\n
"
"
$os
"
"
${
__type
##*/
}
"
>
&2
printf
"Please contribute an implementation for it if you can.
\n
"
>
&2
exit
1
;;
esac
# Required parameters.
VERSION
=
$(
cat
"
$__object
/parameter/version"
)
if
[
-f
"
$__object
/parameter/config"
]
;
then
CONFIG
=
"
$(
cat
"
$__object
/parameter/config"
)
"
if
[
"
$CONFIG
"
=
"-"
]
;
then
CONFIG
=
$(
cat
"
$__object
/stdin"
)
fi
fi
# Hardcoded values used in templates.
export
BINARY_PATH
=
/usr/local/bin/matterbridge
export
CONFIG_PATH
=
/etc/matterbridge/matterbridge.toml
export
USER
=
matterbridge
export
GROUP
=
$USER
# Internal variables.
artefact
=
"matterbridge-
$VERSION
-linux-64bit"
checksum_file
=
"checksums.txt"
release_download_url
=
https://github.com/42wim/matterbridge/releases/download
binary_url
=
"
$release_download_url
/v
$VERSION
/
$artefact
"
checksum_file_url
=
"
$release_download_url
/v
$VERSION
/
$checksum_file
"
config_dir
=
$(
dirname
$CONFIG_PATH
)
systemd_unit_path
=
'/etc/systemd/system/matterbridge.service'
# Check if curl is available.
if
!
command
-v
curl
>
/dev/null
;
then
echo
"curl is required for this type, but could not be found. Exiting."
>
&2
exit
1
fi
# Initialize working directory.
mkdir
-p
"
$__object
/files"
# Download and check matterbridge binary.
curl
-L
"
$binary_url
"
-o
"
$__object
/files/
$artefact
"
curl
-L
"
$checksum_file_url
"
-o
"
$__object
/files/
$checksum_file
"
ls
"
$__object
/files/"
>
&2
cat
"
$__object
/files/checksums.txt"
>
&2
if
!
(
cd
"
$__object
/files"
;
sha256sum
--ignore-missing
--check
$checksum_file
)
;
then
echo
"Matterbridge binary checksum failed."
>
&2
exit
1
fi
# Create service user.
__user
$USER
--home
"/var/lib/
$USER
"
# Deploy matterbridge binary.
require
=
"__user/
$USER
"
__file
"
$BINARY_PATH
"
\
--source
"
$__object
/files/
$artefact
"
\
--owner
"
$USER
"
--mode
755
# Generate and deploy configuration file.
"
$__type
/files/matterbridge.service.sh"
>
"
$__object
/files/matterbridge.service"
require
=
"__user/
$USER
"
__directory
"
$config_dir
"
\
--owner
"
$USER
"
--mode
0755
--parents
\
require
=
"__directory/
$config_dir
"
echo
"
$CONFIG
"
| __file
"
$CONFIG_PATH
"
\
--owner
"
$USER
"
\
--mode
0640
\
--source
-
__file
"
$systemd_unit_path
"
\
--source
"
$__object
/files/matterbridge.service"
# Deal with init system.
require
=
"__file/
$systemd_unit_path
"
__start_on_boot matterbridge
require
=
"__file/
$BINARY_PATH
__file/
$CONFIG_PATH
__file/
$systemd_unit_path
"
__service matterbridge
--action
restart
cdist/conf/type/__matterbridge/parameter/required
0 → 100644
View file @
07df829b
version
config
cdist/conf/type/__matterbridge/singleton
0 → 100644
View file @
07df829b
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment