Skip to content
This repository has been archived by the owner on May 25, 2018. It is now read-only.

Commit

Permalink
initial debianization
Browse files Browse the repository at this point in the history
  • Loading branch information
betehess committed Aug 21, 2013
1 parent e770ea3 commit 14b1a2d
Show file tree
Hide file tree
Showing 21 changed files with 414 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ test/resources/w3c-cache/*
public/js public/js
conf/application-dev.conf conf/application-dev.conf
conf/application-test.conf conf/application-test.conf
debian/lib
debian/debian/vs
debian/debian/wgrep
debian/debian/vs.install
*.deb
*.build
*.changes
24 changes: 24 additions & 0 deletions debian/build.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -ex

cd `dirname $0`

# copy the jars and the configuration file
rm -Rf lib
mkdir -p lib
cp ../target/staged/*.jar lib
cp ../conf/application.conf .

# update vs.install
cat > debian/vs.install <<EOF
managed.conf etc/vs/conf/
application.conf etc/vs/conf/
wgrep usr/bin/
EOF
for i in lib/*.jar; do
f=$(basename $i)
echo "lib/$f usr/share/vs" >> debian/vs.install
done

debuild -us -uc -b

rm -Rf lib application.conf
5 changes: 5 additions & 0 deletions debian/debian/changelog
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
vs (1.0.0-1) unstable; urgency=low

* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>

-- Alexandre Bertails <bertails@w3.org> Tue, 20 Aug 2013 11:05:33 -0400
1 change: 1 addition & 0 deletions debian/debian/compat
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
8
16 changes: 16 additions & 0 deletions debian/debian/control
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: vs
Section: devel
Priority: extra
Maintainer: Alexandre Bertails <bertails@w3.org>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: https://valid.w3.org/
Vcs-Git: git@github.com:w3c/validator-suite.git
Vcs-Browser: https://github.com/w3c/validator-suite/

Package: vs
Architecture: all
Depends: openjdk-7-jre
Description: W3C Validator Suite
W3C Validator Suite is a service providing a new integrated view for
evaluating Web site quality.
12 changes: 12 additions & 0 deletions debian/debian/copyright
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: vs

Files: *
Copyright: 2013 W3C
License: Not licensed for redistribution.

# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2013 World Wide Web Consortium <validator-feedback@w3.org>
License: Not licensed for redistribution.
1 change: 1 addition & 0 deletions debian/debian/files
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
vs_1.0.0-1_all.deb devel extra
114 changes: 114 additions & 0 deletions debian/debian/init.d
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: vs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop vs application
### END INIT INFO

# Author: Alexandre Bertails <bertails@w3.org>

PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
DESC="start/stop vs server"
NAME="vs"
DAEMON="/usr/bin/java"
DAEMON_ARGS='-Dhttp.port=8080 -Dconfig.file="conf/application.conf" -cp "lib/*" play.core.server.NettyServer "/usr/local/vs"'
PIDFILE="/usr/local/vs/RUNNING_PID"
SCRIPTNAME=/etc/init.d/$NAME
USER="play"
APPDIR="/usr/local/vs"
export JAVA_OPTS="-server"

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
start-stop-daemon --start --quiet --background --chdir $APPDIR --verbose --chuid $USER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
echo $DAEMON_ARGS | xargs start-stop-daemon --start --quiet --background --chdir $APPDIR --verbose --chuid $USER --pidfile $PIDFILE --exec $DAEMON -- \
|| return 2
LOGFILE="$APPDIR/logs/application.log"
for i in 3 2 1; do
if [ ! -e "$LOGFILE" ]; then
sleep 1
else
break
fi
done
wgrep 60 "$LOGFILE" 'play - Application started (Prod)'
RETVAL=$?
if [ $RETVAL -ne 0 ] || [ ! -e "$LOGFILE" ]; then
rm -f "$PIDFILE"
return 2
fi
return $RETVAL
}

#
# Function that stops the daemon/service
#
do_stop()
{
start-stop-daemon --stop --quiet --chuid $USER --oknodo --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PIDFILE
return "$RETVAL"
}

case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

:
39 changes: 39 additions & 0 deletions debian/debian/postinst.ex
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
# postinst script for vs
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
configure)
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
37 changes: 37 additions & 0 deletions debian/debian/postrm.ex
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# postrm script for vs
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
35 changes: 35 additions & 0 deletions debian/debian/preinst.ex
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
# preinst script for vs
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
install|upgrade)
;;

abort-upgrade)
;;

*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
38 changes: 38 additions & 0 deletions debian/debian/prerm.ex
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# prerm script for vs
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
remove|upgrade|deconfigure)
;;

failed-upgrade)
;;

*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
13 changes: 13 additions & 0 deletions debian/debian/rules
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
dh $@
1 change: 1 addition & 0 deletions debian/debian/source/format
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
10 changes: 10 additions & 0 deletions debian/debian/vs.default.ex
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
# Defaults for vs initscript
# sourced by /etc/init.d/vs
# installed at /etc/default/vs by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Additional options that are passed to the Daemon.
DAEMON_OPTS=""
8 changes: 8 additions & 0 deletions debian/debian/vs.postinst.debhelper
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,8 @@
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vs" ]; then
if [ ! -e "/etc/init/vs.conf" ]; then
update-rc.d vs defaults >/dev/null
fi
invoke-rc.d vs start || exit $?
fi
# End automatically added section
5 changes: 5 additions & 0 deletions debian/debian/vs.postrm.debhelper
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d vs remove >/dev/null
fi
# End automatically added section
5 changes: 5 additions & 0 deletions debian/debian/vs.prerm.debhelper
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vs" ]; then
invoke-rc.d vs stop || exit $?
fi
# End automatically added section
1 change: 1 addition & 0 deletions debian/debian/vs.substvars
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
misc:Depends=
Loading

0 comments on commit 14b1a2d

Please sign in to comment.