-
Notifications
You must be signed in to change notification settings - Fork 131
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
Script for creating Debian package #32
Open
JensRantil
wants to merge
9
commits into
bitly:master
Choose a base branch
from
JensRantil:dpkg
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cdd577b
feat(dpkg): script for building Debian package
JensRantil 4ad6402
doc(dpkg/readme): How to create Deb package
JensRantil 14c8e45
feat(dpkg): support custom server flags
JensRantil fca2419
Fix: correct fail-early option
JensRantil 55eb8a7
put fail-early option in file header
JensRantil c07d630
deb: add `Homepage` to control file
JensRantil 7d6adbf
fix(deb/init): avoid duplicate `setuid`
JensRantil 1215e83
deb: set `setgid` in init config
JensRantil 2adc14b
fix: avoid unnecessary `|| echo ""`
JensRantil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1 +1 @@ | ||
statsdaemon | ||
/statsdaemon |
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
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,30 @@ | ||
#!/bin/bash | ||
# Inspired by http://ubuntuforums.org/showthread.php?t=910717. | ||
set -o errexit | ||
|
||
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 | ||
|
||
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 |
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,8 @@ | ||
Package: statsdaemon | ||
Version: VERSION | ||
Section: base | ||
Priority: optional | ||
Architecture: ARCH | ||
Maintainer: Jens Rantil <[email protected]> | ||
Description: A binary statsd server implemented in Go. | ||
Homepage: https://github.com/bitly/statsdaemon |
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,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 || true |
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,4 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
|
||
deluser statsdaemon || true |
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,6 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
|
||
if [ -e /etc/init/statsdaemon.conf ]; then | ||
service statsdaemon stop || echo "" | ||
fi |
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,6 @@ | ||
#!/bin/bash | ||
set -o errexit | ||
|
||
if [ -e /etc/init/statsdaemon.conf ]; then | ||
service statsdaemon stop || echo "" | ||
fi |
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,3 @@ | ||
# Additional settings for statsdaemon | ||
|
||
STATSDAEMON_OPTS= |
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,18 @@ | ||
# statsdaemon - binary statsd server. | ||
|
||
description "statsdaemon server" | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
respawn | ||
respawn limit 360 180 | ||
setuid statsdaemon | ||
setgid statsdaemon | ||
|
||
script | ||
STATSDAEMON_OPTS= | ||
if [ -e /etc/default/statsdaemon ];then | ||
. /etc/default/statsdaemon | ||
fi | ||
exec /usr/local/bin/statsdaemon $STATSDAEMON_OPTS | ||
end script |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd also include
Homepage:
in this control fileThere 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.
Done.