-
Notifications
You must be signed in to change notification settings - Fork 129
Script for creating Debian package #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
cdd577b
4ad6402
14c8e45
fca2419
55eb8a7
c07d630
7d6adbf
1215e83
2adc14b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| statsdaemon | ||
| /statsdaemon |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/bin/bash | ||
| # Inspired by http://ubuntuforums.org/showthread.php?t=910717. | ||
|
|
||
| if [ "$#" -ne 2 ]; then | ||
| echo "$0 <version> <386|amd64>" | ||
| echo | ||
| echo "where version is something like 'X.Y-Z'." | ||
| exit 1 | ||
| fi | ||
|
|
||
| VERSION=$1 | ||
| BASEDIR=statsdaemon_$VERSION | ||
| ARCH=$2 | ||
|
|
||
| # Fail early | ||
| set -e errexit | ||
|
|
||
| GOOS=linux GOARCH=$ARCH go build statsdaemon.go | ||
|
|
||
| if [ -d $BASEDIR ];then | ||
| rm -frv $BASEDIR | ||
| fi | ||
| cp -r deb $BASEDIR | ||
| mkdir -pv $BASEDIR/usr/local/bin | ||
| cp -v statsdaemon $BASEDIR/usr/local/bin | ||
|
|
||
| sed "s/VERSION/$VERSION/g" deb/DEBIAN/control | sed "s/ARCH/$ARCH/g" > $BASEDIR/DEBIAN/control | ||
|
|
||
| if [ -e ${BASEDIR}.deb ];then | ||
| rm -v ${BASEDIR}.deb | ||
| fi | ||
| dpkg-deb --build $BASEDIR | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Package: statsdaemon | ||
| Version: VERSION | ||
| Section: base | ||
| Priority: optional | ||
| Architecture: ARCH | ||
| Maintainer: Jens Rantil <[email protected]> | ||
| Description: A binary statsd server implemented in Go. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd also include
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/bin/bash | ||
| set -o errexit | ||
|
|
||
| USER=statsdaemon | ||
| USER_HOME=/tmp | ||
|
|
||
| if [ "$1" = configure ]; then | ||
| adduser --system \ | ||
| --quiet \ | ||
| --home "$USER_HOME" \ | ||
| --no-create-home \ | ||
| --disabled-password \ | ||
| --group "$USER" | ||
| fi | ||
|
|
||
| service statsdaemon start || echo "" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you intend the |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
| set -e errexit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another |
||
|
|
||
| deluser statsdaemon || echo "" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
| set -o errexit | ||
|
|
||
| if [ -e /etc/init/statsdaemon.conf ]; then | ||
| service statsdaemon stop || echo "" | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
| set -o errexit | ||
|
|
||
| if [ -e /etc/init/statsdaemon.conf ]; then | ||
| service statsdaemon stop || echo "" | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Additional settings for statsdaemon | ||
|
|
||
| STATSDAEMON_OPTS= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # statsdaemon - binary statsd server. | ||
|
|
||
| description "statsdaemon server" | ||
|
|
||
| start on runlevel [2345] | ||
| stop on runlevel [!2345] | ||
| respawn | ||
| respawn limit 360 180 | ||
| setuid statsdaemon | ||
| setuid statsdaemon | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same line twice |
||
|
|
||
| script | ||
| STATSDAEMON_OPTS= | ||
| if [ -e /etc/default/statsdaemon ];then | ||
| . /etc/default/statsdaemon | ||
| fi | ||
| exec /usr/local/bin/statsdaemon $STATSDAEMON_OPTS | ||
| end script | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean
set -o errexit. that's equivalent toset -e. Also, if you use the long-name form, the comment is superfluous