diff --git a/.gitignore b/.gitignore index 691f0a16..faf6c92f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,11 @@ drone.sublime-project drone.sublime-workspace .vagrant +# ignore the drone binary, but makes sure +# that subdirs named drone aren't ignored +drone +!dist/** + *~ ~* *.sqlite @@ -17,10 +22,12 @@ drone.sublime-workspace *.min.js bindata.go -drone -drone-build -drone-bot +# generate binaries +cmd/drone/drone +cmd/drone-build/drone-build +cmd/drone-agent/drone-agent +# generated binaries bin/drone bin/drone-build -bin/drone-bot +bin/drone-agent diff --git a/bin/README b/bin/README new file mode 100644 index 00000000..a8783add --- /dev/null +++ b/bin/README @@ -0,0 +1 @@ +This is where Drone binaries go after running "make" in the root directory. \ No newline at end of file diff --git a/dist/README b/dist/README new file mode 100644 index 00000000..f85ea17d --- /dev/null +++ b/dist/README @@ -0,0 +1 @@ +This is where Drone packages go after running "make dist" in the root directory. \ No newline at end of file diff --git a/dist/drone/DEBIAN/conffiles b/dist/drone/DEBIAN/conffiles new file mode 100644 index 00000000..980d34ea --- /dev/null +++ b/dist/drone/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/etc/init/drone.conf +/etc/drone/drone.toml diff --git a/dist/drone/DEBIAN/control b/dist/drone/DEBIAN/control new file mode 100644 index 00000000..3f0a756a --- /dev/null +++ b/dist/drone/DEBIAN/control @@ -0,0 +1,7 @@ +Package: drone +Version: 0.4 +Section: base +Priority: optional +Architecture: amd64 +Maintainer: Brad Rydzewski +Description: Drone continuous integration server diff --git a/dist/drone/DEBIAN/postinst b/dist/drone/DEBIAN/postinst new file mode 100755 index 00000000..fd835bb8 --- /dev/null +++ b/dist/drone/DEBIAN/postinst @@ -0,0 +1,24 @@ +#!/bin/sh +set -e + +case "$1" in + abort-upgrade|abort-remove|abort-deconfigure|configure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +echo "Starting drone ..." +if [ -f /etc/init/drone.conf ]; then + if pidof /usr/local/bin/drone >/dev/null; then + service drone stop || exit $? + fi + service drone start && echo "Drone started." +fi + +#DEBHELPER# + +exit 0 diff --git a/dist/drone/DEBIAN/prerm b/dist/drone/DEBIAN/prerm new file mode 100755 index 00000000..a0f7be8c --- /dev/null +++ b/dist/drone/DEBIAN/prerm @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e +set -u + +case "$1" in + remove|remove-in-favour|deconfigure|deconfigure-in-favour) + if [ -f /etc/init/drone.conf ]; then + echo "Stopping drone ..." + service drone stop || exit $? + echo "Drone Stopped." + fi + ;; + + upgrade|failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/dist/drone/etc/init/drone.conf b/dist/drone/etc/init/drone.conf new file mode 100644 index 00000000..e855388b --- /dev/null +++ b/dist/drone/etc/init/drone.conf @@ -0,0 +1,8 @@ +start on (filesystem and net-device-up) + +chdir /var/lib/drone +console log + +script + drone --config /etc/drone/drone.toml +end script \ No newline at end of file